Maya python - select texture file nodes


#1

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


#2

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 )


#3

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 :slight_smile:


 import maya.cmds as cmds
 
 files = cmds.ls(type='file')
 
 
 

#4

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.