Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   color attribute (https://simplymaya.com/forum/showthread.php?t=6542)

train_ucl 26-06-2003 09:37 PM

color attribute
 
Hello

as a total newb i got a newb question:

how do i have to write a color ?
i want to assign a color to my lambert material with a mel-script:

lamMAT_matrix.color = ;

i dont know how the mel script wants the color ...
thanks for help


-train~

kbrown 26-06-2003 10:19 PM

It's a vector variable so you write it:
lamMAT_matrix.color = << r, g, b >>;

where r = red, g = green and blue ranging from 0 to 1.
Black would be << 0, 0, 0 >>, white would be << 1, 1, 1 >> and mid green would be << 0, 0.5, 0 >>. Get it?

train_ucl 27-06-2003 08:47 AM

HEllo! First, thanks for your help ...
i did it befor that way as well, because i found this expression for a vector in the maya help, but it tried it and maya gave me this answer (to the exact same line you wrote) :
"Error: Attributes must be of float, integer, or boolean types: color" ...
and thats what i don´t get ;) ...the rest i am familiar with from photoshop.
do you have any idea why maya doesn´t accept that line ?

-train~

kbrown 27-06-2003 09:01 AM

Uh... I talked BS before :p
It's not a vector variable. It's a float3. You also (may) need to use the setAttr command:

setAttr lambert1.color 1 1 1;

Sorry, my bad...

mark_wilkins 27-06-2003 05:31 PM

In an expression, you set the R, G, and B like this:

lambert1.colorR = 0;
lambert1.colorG = 1;
lambert1.colorB = 0;

You can connect another float3 attribute to lambert1.color, which is a compound attribute that includes colorR, colorG, and colorB.

Look in the Node and Attribute Reference to see this stuff -- these attributes are listed on the page for the Lambert node.

-- Mark


All times are GMT. The time now is 12:03 PM.

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