Notifications
Clear all

[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…

8 Replies

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()
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

it’s not a first time when i see it… where did you hear about this myth?

thanks … :rolleyes:

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.

1 Reply
(@umarmuzammil)
Joined: 11 months ago

Posts: 0

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

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