PDA

View Full Version : query shader name


sanlight
08-17-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.

zoharl
08-21-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.

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

rgkovach123
08-21-2012, 07:28 PM
http://forums.cgsociety.org/showthread.php?f=89&t=1062072

check out this thread.

zoharl
08-21-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.

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

CGTalk Moderation
08-21-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.