Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 08-10-2012 , 07:57 AM
Registered User
Join Date: May 2012
Posts: 31

shader switch

Hello every,

is it possible to switch a shading material already connected to selected faces without having to re select the faces all over again? If anyone knows how this is done i would greatly appreciate.

# 2 08-10-2012 , 08:35 AM
PixalZA's Avatar
Lifetime Member
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
In Hypershade right click on the material that you already assigned and select "Select Objects with Material".


Earth: The crazy asylum of the universe.
# 3 08-10-2012 , 08:42 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
Or if you don't have hypershade open, you can select the shader and use this bit of code :

Code:
hyperShade -o "";
It'll select whatever objects that are using the selected shader. You can drop that onto a shelf.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 4 08-10-2012 , 08:51 AM
PixalZA's Avatar
Lifetime Member
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
Cool. Didn't know about that one. Thanks


Earth: The crazy asylum of the universe.
# 5 08-10-2012 , 12:04 PM
Registered User
Join Date: May 2012
Posts: 31
Guys im talking about FACES. How do i change the shaders connected to those FACES without reselecting it.

# 6 08-10-2012 , 12:35 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
I'm confused, what are you asking exactly? Switching one shader out for another, or editing the attributes of different shaders that are applied to different faces on the same object?


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 7 08-10-2012 , 12:45 PM
honestdom's Avatar
The Nurb Herd
Join Date: Oct 2007
Location: London
Posts: 2,381

In Hypershade right click on the material that you already assigned and select "Select Objects with Material".

then right click the new shader "assign to selected objects"

# 8 09-10-2012 , 07:20 AM
Registered User
Join Date: May 2012
Posts: 31
Guys this is quiet simple. If you have a cube primitive and you decided to apply a shader to one of its faces, how would you change that shader without reselecting it.

# 9 09-10-2012 , 08:02 AM
honestdom's Avatar
The Nurb Herd
Join Date: Oct 2007
Location: London
Posts: 2,381
The answer is also quite simple. But there is a lot of jargon that comes with maya. If you don't understand, show a bit of humility and say "I don't get it". Dont put it back on us like we dont understand. Did you even attempt what was suggested? Probably not.

# 10 09-10-2012 , 08:27 AM
Registered User
Join Date: May 2012
Posts: 31
Ofcourse not because i already know how to do what was suggested and that is not what im talking about. Is this really hard to understand.

Every polygon object is made up of faces, edges and vertices. So let say my object is made up of 40 faces and i decided to select 10 faces and applied a phong shader to it, how do i change that phong shader without reselecting those faces again.

Thank you

# 11 09-10-2012 , 09:10 AM
honestdom's Avatar
The Nurb Herd
Join Date: Oct 2007
Location: London
Posts: 2,381
ahhhh well that changes nothing then.

Originally Posted by PixalZA View Post

In Hypershade right click on the material that you already assigned and select "Select Objects with Material".

then right click the new shader "assign to selected objects"


# 12 09-10-2012 , 10:24 AM
Registered User
Join Date: May 2012
Posts: 31
Ahhh dame, my apologies thank guys, much appreciated

# 13 26-09-2019 , 10:01 AM
Registered User
Join Date: Sep 2019
Posts: 1

SOLUTION

is it possible to switch a shading material already connected to selected faces without having to re select the faces all over again? If anyone knows how this is done i would greatly appreciate.

The MEL script is quite easy (maybe it can be done in a more efficient way, but this works):
Select the materials you want to replace, select the target material last and run the script.

With the optimize scene command in the file menu you can afterwards remove all unused shading nodes.

//Copy from here to....
undoInfo -ock;
$target = `ls -selection -tail 1`;
select -tgl $target;
$selection = `ls -sl`;
for ($material in $selection) {
hyperShade -objects $material;
hyperShade -assign $target;
}
undoInfo -cck;
//...Here

If you don't know how to run MEL Script in Maya then watch a video on YouTube.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads