Hi Johan,
You need to use the layerButton command after setting the visibility of the
layer:
layer = pm.PyNode('layer1')
layer.visibility.set(False)
layerVisibility = layer.visibility.get()
# True
layerButton(layer, e = True, layerVisible = layerVisibility)
On Saturday, 3 October 2020 at 12:18:34 UTC+1 johan Borgström wrote:
> Hi,
>
> I am trying to set layer visibility, tried both pymel and cmds:
>
> import pymel.core as pm
>
> layer = pm.PyNode('layer1')
> layer.visibility.set(True)
> print layer.visibility.get()
> # True
>
> import maya.cmds
> cmds.setAttr('layer1.visibility', True)
> print cmds.getAttr('layer1.visibility')
> # True
>
> The layer visibility is set but the display layer editor won´t reflect
> this. Is this a bug? Do I need to call an "refresh/update" on the editor or
> set the vis "through" the editor object somehow...
>
> Regards, Johan
>
>
>
>
>
> On Wednesday, September 30, 2020 at 6:42:43 PM UTC+2 johan Borgström wrote:
>
>> Hi Dave,
>>
>> Thanks a lot!
>>
>> Regards, Johan
>>
>> On Wednesday, September 30, 2020 at 5:47:08 PM UTC+2 thirstydevil wrote:
>>
>>> Hi Johan,
>>>
>>> getLayerSelection "Display" is the MEL command you need
>>>
>>> Regards
>>>
>>> -Dave
>>>
>>> On Wed, Sep 30, 2020 at 7:45 AM johan Borgström <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>> I am trying to get the selected display layer.
>>>> I know you can get the display layers with:
>>>>
>>>> *pm.ls <http://pm.ls>(type='displayLayer')*
>>>>
>>>> But that just returns a list of the available layers. As far as I could
>>>> see there were no attribute on the returned layers to hold info whether
>>>> they were "selected" or not. So I am guessing I need to get that info from
>>>> the "layer editor itself".
>>>>
>>>> Should be quite straightforward, but I havent found any good docs on
>>>> how to do this, any tips?
>>>>
>>>> Cheers, Johan
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Python Programming for Autodesk Maya" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/python_inside_maya/7a508a51-5b35-48bc-9934-7e59314a6a0an%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/python_inside_maya/7a508a51-5b35-48bc-9934-7e59314a6a0an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> *David Moulder*
>>> Technical Animator / Artist
>>> [email protected]
>>> *Professional Profile
>>> <http://uk.linkedin.com/pub/david-moulder/1/b12/b5a>*
>>>
>>> Mobile: +44 (0)7814033242 <+44%207814%20033242>
>>> See who we know in common
>>> <http://www.linkedin.com/e/wwk/5748982/?hs=false&tok=3tztwkse1silw1> Want
>>> a signature like this?
>>> <http://www.linkedin.com/e/sig/5748982/?hs=false&tok=3pwLU9-mBsilw1>
>>>
>>
--
*MILK <http://www.milk-vfx.com/>** VISUAL EFFECTS**
*
Threeways House,
40-44 Clipstone Street London, W1W 5DW
Tel: *+44 (0)20 3697 8448*
* *
This message is intended solely for the addressee and may contain
confidential and/or legally privileged information. Any use, disclosure or
reproduction without the sender’s explicit consent is unauthorized and may
be unlawful. If you have received this message in error, please notify Milk
VFX immediately and permanently delete it. Any views or opinions expressed
in this message are solely those of the author and do not necessarily
represent those of Milk VFX.
By engaging in professional correspondence
with Milk VFX, we may store your contact information for future reference.
This is in line with Milk’s Privacy policy which can be found here.
<http://www.milk-vfx.com/wp-content/uploads/2018/05/Milk-VFX-Privacy-Policy-May-2018.pdf>
Milk Visual Effects is a registered limited company: 0844 1256. The
registered company address is Threeways House, 40-44 Clipstone Street,
London, W1W 5DW.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/ace72144-333a-4823-8fed-fe99f03bc904n%40googlegroups.com.