Hi again,

Regarding the "getLayerSelection" MEL script. I had a look at the proc 
found in: (C:/Program 
Files/Autodesk/Maya2019/scripts/startup/layerEditor.mel) and it seems like 
it loops through the layer editor and appends the selected layers to an 
array which is then returned. This means that we can not get the layers in 
the order they were selected. Can this be done someway? (Not super 
important but interesting to know)

BR,
Johan

On Wednesday, October 21, 2020 at 7:33:18 PM UTC+2 johan Borgström wrote:

> Hi Neil,
>
> Thank you very much!
>
>
> On Wednesday, October 21, 2020 at 3:14:25 PM UTC+2 Neil Roche wrote:
>
>> 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 <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/4dd7afab-3bba-411d-9dd4-c78711d6369bn%40googlegroups.com.

Reply via email to