MEL for changing multiple shader values

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  03 March 2005
Question MEL for changing multiple shader values

i've searched the archives for this but drew a blank - i only know the basic MEL commands to control shader attributes individually, not all together. selecting a bunch of shaders and changing the values in the channel box doesn't work because that will only change shaders of 1 type (blinn or lambert etc, whichever is selected last i think). and that also doesn't work with non-keyable attributes.

basically i want to control the "miIrradianceColor" attribute on all materials in the scene. the problem is by default its a non-keyable attrbute, so i need MEL to first unlock it and then set the RGB values.

its pretty lame that maya hasn't had some sort of global shader control gui built-in since version 1.... it would be such a useful feature.

any help on this would be greatly appreciated.
 
  03 March 2005
this will set the "miIrradianceColor" on all the selected shaders that have that attribute.

Just change the red, green, and blue variables to the values you want. Select the shaders you want to affect, and run this in the script editor.


{
  	//change these to the RGB values you want
  	float $red = 0.35;
  	float $green = 0.5;
  	float $blue = 0.75;
  
  	string $sel[] = `ls -sl`;
  	for($i = 0;$i < size($sel);$i++)
  	{
  		if(`attributeExists miIrradianceColor $sel[$i]`)
      		setAttr ($sel[$i] + ".miIrradianceColor") -type double3 $red $green $blue;
  	}
  }


Any questions, just ask.

Later,
Trevor
__________________
|
| www.tddev.com -My gallery and MEL Tutorials.
| My demo reel
| YIM: smaxmaker
| AIM: smaxmaker
|
 
  03 March 2005


a neat script - thanks heaps dude
 
  03 March 2005
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



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
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:30 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.