View Full Version : query shader name

08 August 2012, 09:26 PM
How to get shader name as return value. I want to switch texture on shaders . For that purpose I require the name of applied shader (ie. lambard1 ) as return so that I can use that name to switch texture.

08 August 2012, 07:21 AM
Depends if it's selected, or you just want to iterate all shaders, or you want to iterate the shaders that are connected to some object.

08 August 2012, 05:11 PM
I just want to select one object and change it's texture with a button click.

08 August 2012, 07:28 PM

check out this thread.

08 August 2012, 07:29 PM
listConnections() on an object with give you the connections to the shading groups as well. Using the sets() command you can change these connections.

08 August 2012, 08:40 PM
import maya.cmds as mc
shaders = [mc.listConnections(x + '.surfaceShader')[0] for x in mc.listConnections(, dag=True, s=True), type='shadingEngine')]

CGTalk Moderation
08 August 2012, 08:40 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.