Thread: shader switch
View Single Post
# 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.