help on cmds.ls flag options

help on cmds.ls flag options

Anonymous
Not applicable
648 Views
2 Replies
Message 1 of 3

help on cmds.ls flag options

Anonymous
Not applicable

Hi guys,

 

I am trying to use cmds.ls with the flag of material=True to get the name dag object and linked material of my selected objects in maya. However I am not getting back the material information.

This is the code line I have;

 

cmds.ls( dag=True, ap=True, sl=True, mat=True, textures=True )

 

I am getting back;

 

[u'pipeline_pipeline1:pTorus1', u'pipeline_pipeline1:pTorusShape1']

 

And I have selected a Thorus geometry with a Blinn shader linked to it. Any thought of how I could get back also the shader?

 

Many thanks in advance!

 

Joan

0 Likes
Accepted solutions (1)
649 Views
2 Replies
Replies (2)
Message 2 of 3

rajasekaransurjen
Collaborator
Collaborator
Accepted solution

Hi,

This May Help....

 

import maya.cmds as cmds
SlObj =  cmds.ls(dag=1,o=1,s=1,sl=1)
print SlObj
list = cmds.listConnections(SlObj,type ='shadingEngine')
print list
shaders = cmds.ls(cmds.listConnections(list),materials=1) 
print shaders

 

Best regards,
Rajasekaran Surjen.

0 Likes
Message 3 of 3

Anonymous
Not applicable

Thanks! That's just what I needed, I'm gonna try...

Cheers

0 Likes