Thanks Roy!

I agree with Justin, great tip :)



On Tuesday, August 26, 2014 11:01:13 AM UTC+2, Justin Israel wrote:
>
> Naw I would give it much more credit than a "micro-optimization". It is 
> definitely better to leave the selection list as it is, if you can help it, 
> in addition to getting a bump for not having to change it :-)
>
> Thanks!
>
>
> On Tue, Aug 26, 2014 at 7:50 PM, Roy Nieterau <[email protected] 
> <javascript:>> wrote:
>
>> Just to add on top of Justin's version. You don't need to perform the 
>> actual selection, both ls() and filterExpand() can operate on input 
>> objects. Like so:
>>
>> mat_list = cmds.ls(mat=True, sl=True) 
>>
>> for mat in mat_list:
>>     sg_list = cmds.listConnections(mat, type='shadingEngine')
>>     if not sg_list:
>>         continue
>>
>>     for sg in sg_list:
>>
>>         members = cmds.sets(sg, q=True)
>>
>>         meshes = cmds.ls(members, exactType="mesh")
>>         for mesh in meshes:
>>             print "[mesh]", mesh
>>
>>         faces = cmds.filterExpand(members, sm=34, expand=False) or []
>>         for face in faces:
>>             print "[face]", faces
>>
>> Of course this would be a micro-optimization I assume. :)
>>
>> -Roy
>>
>>  -- 
>> 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] <javascript:>.
>>  To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/b0898a82-b8bf-4d7a-97c0-0d26e03272f8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/b0898a82-b8bf-4d7a-97c0-0d26e03272f8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/c5327663-d5fd-48ce-abbd-fed09a69af66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to