[Closed] Progress bar Not working
How do we link progress bar color with slider value of 0 to 1…
this above method works but it snaps back from the beginning…
Just recently got into scripting so I am Sure this is not the best way of linking it…
Why are you using a loop when the spinner changes? Shouldn’t you just be setting the progress bar values once based on the spinner’s value?
Don’t know if the loop generally make sence… But to make max “responseable” add this in the loop:
windows.processPostedMessages()
How about multiplying the spinner value by 100?
on spr changed v do
(
pb.value = v * 100
)
Think about what the loop in your screenshot actually does. The first 99 iterations are redundant, since the values they set on the progressbar are overwritten in the following iteration.
I found windows.processPostedMessages() somewhere in a maxscript thread here
I didn’t find it in the MAXScript Reference… I don’t know more about it, unless it helps in some situations, if you do expensive things in loops. I suspect it slows down the execution, but you can see more, e.g. prints in the listener…
EDIT: found this: http://forums.cgsociety.org/showthread.php?t=958314
How do we link Slider Spinner with progress bar !! I did it but i am sure this is not the best way…
ca = attributes Boxattributes
(
Parameters boxpar Rollout:boxrol
(
stretch type:#float ui:(spr,sld,pb)
)
Rollout Boxrol "Box Rollout"
(
spinner spr "Stretch Factor" type:#float range:[0,1,0]
slider sld "" type:#float range:[0,1,0]
progressBar pb "" pos:[16.5,70] width:125 height:15 value:sld.value
color:[0,0,0]
on sld changed val do
(
b = sld.value
pb.value = b*100
z = pb.value
pb.color.r = ((255/100)*z)
pb.color.g = (255-((255/100)*z))
pb.color.b = 0
)
on spr changed val do
(
b = spr.value
pb.value = b*100
z = pb.value
pb.color.r = ((255/100)*z)
pb.color.g = (255-((255/100)*z))
pb.color.b = 0
)
)
)
custattributes.add $.modifiers[1] ca
#(sld, spr).value ( :banghead: )
Help me out !!