SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Lounges / Maya Basics & Newbie Lounge / Anyone who can do this little MEL ?
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 16-12-2006, 04:59 AM   #1
caligraphics
Registered User
 
caligraphics's Avatar
 
Join Date: Mar 2003
Location: Billund, Denmark
Posts: 992
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
caligraphics is offline   Reply With Quote
Old 16-12-2006, 05:29 AM   #2
enhzflep
Subscriber
 
enhzflep's Avatar
 
Join Date: Oct 2006
Location: Melbourne
Posts: 313
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
enhzflep is offline   Reply With Quote
Old 16-12-2006, 05:34 AM   #3
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

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!
kbrown is offline   Reply With Quote
Old 16-12-2006, 06:14 AM   #4
caligraphics
Registered User
 
caligraphics's Avatar
 
Join Date: Mar 2003
Location: Billund, Denmark
Posts: 992
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
caligraphics is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 08:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 03:41 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.