Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Technical Issues (https://simplymaya.com/forum/forumdisplay.php?f=23)
-   -   shader switch (https://simplymaya.com/forum/showthread.php?t=38431)

digitalone 08-10-2012 07:57 AM

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.

PixalZA 08-10-2012 08:35 AM

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

Gen 08-10-2012 08:42 AM

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.

PixalZA 08-10-2012 08:51 AM

Cool. Didn't know about that one. Thanks

digitalone 08-10-2012 12:04 PM

Guys im talking about FACES. How do i change the shaders connected to those FACES without reselecting it.

Gen 08-10-2012 12:35 PM

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?

honestdom 08-10-2012 12:45 PM

Quote:

Originally Posted by PixalZA (Post 342912)
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"

digitalone 09-10-2012 07:20 AM

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.

honestdom 09-10-2012 08:02 AM

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.

digitalone 09-10-2012 08:27 AM

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

honestdom 09-10-2012 09:10 AM

ahhhh well that changes nothing then.

Quote:

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"

digitalone 09-10-2012 10:24 AM

Ahhh dame, my apologies thank guys, much appreciated

Hasi 26-09-2019 10:01 AM

SOLUTION
 
Quote:

Originally Posted by digitalone (Post 342911)
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.


All times are GMT. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018