How can I check all file nodes by their file path?

12 views
Skip to first unread message

郭金锋

unread,
Jul 15, 2013, 10:19:33 AM7/15/13
to python_in...@googlegroups.com
Hey guys,
Help!
I want to write a script to check all file nodes in a scene file by checking their file path. e.g. imageName of a blinn shader.
I thought that I should select file nodes in the first place, and store them in different variables to process, but I couldn't figure out how to select file nodes,:(.

ps, the script is used to check whether any path name included in a scene file contains Chinese characters.

Thanks, :)
Jerry from China

unread,
Jul 15, 2013, 10:54:01 AM7/15/13
to python_in...@googlegroups.com
You can use maya cmds as follows:

import maya.cmds as cmds
textureNodes = cmds.ls(type="file") 

http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/ls.html

BTW: The regex expression to match Chinese characters is "[\u4e00-\u9fa5]" (quote mark not included). Not sure what Chinese character set it matches. It's from some legacy quick reference I downloaded before.

860323

unread,
Jul 16, 2013, 2:58:11 AM7/16/13
to python_in...@googlegroups.com
import maya.cmds as cmds

list_file = cmds.ls(type= "file")
for iter in list_file:
print cmds.getAttr( iter+".fileTextureName")

There just print all the file path, and if you want do anythings, you should use append() to collect the paths.

Sent from my iPhone
> --
> 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 post to this group, send email to python_in...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

860323

unread,
Jul 16, 2013, 3:07:12 AM7/16/13
to python_in...@googlegroups.com
You can get all commands in the Script Editor of Maya. Maya->......->Script Editor->History->Echo All Commands.

Set the Echo All Commands, you can get all commands(mel) when you do anything in maya, and you could use the code.

Sent from my iPhone

On 2013-7-15, at 22:19, 郭金锋 <guojinf...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages