PDA

View Full Version : Progress bar Not working


umar6419
04-14-2012, 11:27 AM
http://i.imgur.com/OpQ9R.jpg

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..

Pjanssen
04-14-2012, 12:06 PM
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?

jedie
04-14-2012, 01:14 PM
Don't know if the loop generally make sence... But to make max "responseable" add this in the loop:
windows.processPostedMessages()

umar6419
04-14-2012, 02:25 PM
thanks .. :rolleyes:

Pjanssen
04-14-2012, 02:51 PM
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.

umar6419
04-14-2012, 04:20 PM
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.

Hey Pjanssen, thanks .. :applause:
worked like a charm..

http://i.imgur.com/ELI6R.jpg

denisT
04-14-2012, 08:14 PM
Don't know if the loop generally make sence... But to make max "responseable" add this in the loop:
windows.processPostedMessages()
it's not a first time when i see it... where did you hear about this myth?

jedie
04-15-2012, 04:14 PM
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

umar6419
05-12-2012, 05:01 PM
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 !!

CGTalk Moderation
05-12-2012, 05:01 PM
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.