PDA

View Full Version : Maya python - select texture file nodes


chiess
07-19-2012, 11:33 PM
Hi,

I can't really find the command to auto-select all texture file nodes within Maya via Python.
I am working in Maya 2010 at the moment and want to select all texture file nodes (or at least run through them) via Python. Maybe I am just blind and my search abilities are weak, but any help would be great. All solutions and scripts I found, were based on manual selected nodes.
If there is not a command for it, is there any workaround? such as select shaders and look at their connections? There must be a command - scripts like the FileTextureManager are going through all the texture file nodes as well, unfortunately in MEL I think?

Kind regards,
chiess

JayHoo
07-20-2012, 07:30 PM
Hi,
is this what you need?


import maya.cmds as cmds
array = cmds.ls( textures=True )
print array

cmds.select( array[0], r=True )
for fileNode in array:
cmds.select( fileNode, add=True )

chiess
07-23-2012, 11:14 AM
Thanks JayHoo for your reply.

I already figured it out but forgot to get back here, sorry.
Yours might work as well, but what I was looking for is way simpler :)


import maya.cmds as cmds

files = cmds.ls(type='file')

CGTalk Moderation
07-23-2012, 11:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.