CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 08-17-2012, 09:26 PM   #1
sanlight
New Member
portfolio
Santosh Dwivedi
Lighting Artist
Xentrix Studios
Bangalore, India
 
Join Date: Apr 2010
Posts: 3
query shader name

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.
 
Old 08-21-2012, 07:21 AM   #2
zoharl
A newbie
 
zoharl's Avatar
portfolio
Zohar
Wellington, New Zealand
 
Join Date: Mar 2009
Posts: 1,821
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.
 
Old 08-21-2012, 05:11 PM   #3
sanlight
New Member
portfolio
Santosh Dwivedi
Lighting Artist
Xentrix Studios
Bangalore, India
 
Join Date: Apr 2010
Posts: 3
I just want to select one object and change it's texture with a button click.

Last edited by sanlight : 08-21-2012 at 05:16 PM.
 
Old 08-21-2012, 07:28 PM   #4
rgkovach123
Know-it-All
robert
austin, USA
 
Join Date: Nov 2006
Posts: 364
 
Old 08-21-2012, 07:29 PM   #5
zoharl
A newbie
 
zoharl's Avatar
portfolio
Zohar
Wellington, New Zealand
 
Join Date: Mar 2009
Posts: 1,821
listConnections() on an object with give you the connections to the shading groups as well. Using the sets() command you can change these connections.
 
Old 08-21-2012, 08:40 PM   #6
fezz
Render slave
 
fezz's Avatar
portfolio
Michael Fessenden
Pipeline TD, Mr. X
Toronto, Canada
 
Join Date: Aug 2005
Posts: 254
Send a message via AIM to fezz
Code:
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')]
 
Old 08-21-2012, 08:40 PM   #7
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:31 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.