Colour Help

Colour Help

Anonymous
Not applicable
328 Views
1 Reply
Message 1 of 2

Colour Help

Anonymous
Not applicable
What I'm trying to do is have a colour picker change the first colour of a falloff map, and then have the second colour of the falloff map be a slightly darker version of the colour.

colorpicker theColor "Colour" color: modal:false pos:
on theColor changed new_col do
(
meditMaterials.texmap_diffuse.color1 = new_col
meditMaterials.texmap_diffuse.color2 = new_col.value - 50
)

Now from what I've been reading up from the maxscript help is that colors are 3point values. However the color component properties such as H.S.V are floats. So what I was trying to do here is decrease the value by 50, yet it comes back with a "Unable to convert to Point 3" error...

What am I misunderstanding?

Thanks

And Merry Christmas!
0 Likes
Accepted solutions (1)
329 Views
1 Reply
Reply (1)
Message 2 of 2

Swordslayer
Advisor
Advisor
Accepted solution
You are quite close, to better understand what's going on look at what happens when you try to assign the second color: first, you get the value of the picked color (float), subtract your predefined number from it (integer, so far so good) - a basic arithmetic operation that returns a float. And now you try to assign this float as a color (Point3)...

You have to either copy the color and modify the copy, then assign that, or modify it in place and assign the modified color. If it's only a short little function like this, you can even get away with something like this (though I would suggest doing the modification on a separate line, before the assignment, anyway).

meditmaterials.texmap_diffuse.color2 = (new_col.value -= 50; new_col)
0 Likes