Notifications
Clear all

[Closed] Slider changing Diffuse Colour

Hi all,

Im still learning maxscript, and have come along way…

I’m currently stuck on something which I thought would be simple. I’ve been looking at the maxscript help and the listener and am stuck.

What I’m trying to do is manipulate a materials diffuse colour by way of a slider, ultimately being able to change a falloff map with the slider. The material I have in the scene is named mat.

I’m not sure why but this just doesn’t seem to work. Also I am getting confused on how to access an individual material. I look at the maxscript listener and there seems to be a way to access from the material slots.

Here is my code, can anyone give me a hint to what I’m doing wrong?

try (closeRolloutfloater Slidertest) catch()

rollout slidertest “Slider”
(
label sliderLabel “Diffuse” pos: [0,10]
slider DiffSlider orient:#horizontal range:[-0,30,0] ticks:0 width:150 pos: [50,7]

on DiffSlider changed val do
$mat.diffuse = val

)
sliders = newrolloutfloater “Character Maker” 500 565
addrollout Slidertest sliders

Any pointers appreciated

2 Replies
 lo1

.diffuse expects a color value, you are feeding it an integer value.

What color is ‘50’?

ooo…yes…hmm I’ll look up how to convert it then.

Thanks!