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 <jo...@petfactory.se> 
>> 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 python_inside_m...@googlegroups.com.
>>> 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
>> squi...@gmail.com
>> *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>
>>
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/dd2a0503-62bd-41e4-a772-d9bac66ad9e1n%40googlegroups.com.

Reply via email to