View Full Version : Query file node name from material selection

11 November 2012, 02:50 PM
This should be easy - but I just can't find the right command.

I need to get the name of the "file" associated with a particular material. This material is already selected/highlighted by the user in the hypershade, so a $matName = `ls -sl -mat`; will always give the name of the material.

11 November 2012, 02:58 PM
use listConnections to find all the fileNodes connected to the material. Once you have the fileNodes, loop through them and use getAttr on the attribute fileTextureName to get the actual filename of the texture.

CGTalk Moderation
11 November 2012, 02:58 PM
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.