Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 16-12-2006 , 05:59 AM
caligraphics's Avatar
Registered User
Join Date: Mar 2003
Location: Billund, Denmark
Posts: 992

Anyone who can do this little MEL ?

I am in the need of changing a bunch of shaders and turn the Ambient color = 0,0,0 and the translucency = 0

can anyone do that for me ?


Carsten Lind
Senior 3D Artist,
Maya Software Manager & Maya Instructor
LEGO Systems A/S
# 2 16-12-2006 , 06:29 AM
enhzflep's Avatar
Subscriber
Join Date: Oct 2006
Location: Melbourne
Posts: 313
I can't work out a way to quickly do it with MEL, but the first question that springs to mind is how are you going to select the materials that you want to change?

If they al had a similar name i.e blinn1, blinn2, blinn3 etc then a MEL would be great; just type in the string to search for and then apply the modifications to all shaders whose names contain that string..

If however, you were going to pick them all in the hypershade then you could just open up the channel box and change all materials in 6 very short steps. I'm not able to think of a situation that would warrant all the extra coding just to save a few simple steps, here's my way:

(1) Select Materials in hypershade
(2) Open channel box
(3) Drag-select the 3 Ambient fields to the right of the name
(4) Enter 0
(5) Select Translucence
(6) Enter 0

Then you're done.. one material or 2 hundred, the only difference is the time taken to select them in the Hypershade, steps 2 to six are identical for 1 or 200 shaders.


hope it's helpfull
Simon

# 3 16-12-2006 , 06:34 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Select your shaders in the hypershade and run this:
Code:
{
	string $sSel[] = `ls -sl`;
	string $sItem;
	
	for($sItem in $sSel)
	{
		if(objExists($sItem + ".ambientColorR"))
		{
			setAttr($sItem + ".ambientColorR") 0;
			setAttr($sItem + ".ambientColorG") 0;
			setAttr($sItem + ".ambientColorB") 0;
		}
		if(objExists($sItem + ".translucence"))
		{
			setAttr($sItem + ".translucence") 0;
		}
	}
}


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 4 16-12-2006 , 07:14 AM
caligraphics's Avatar
Registered User
Join Date: Mar 2003
Location: Billund, Denmark
Posts: 992
Thanks a ton !!! I wish I could do MEL, would make lots of stuff easier!!


Carsten Lind
Senior 3D Artist,
Maya Software Manager & Maya Instructor
LEGO Systems A/S
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