3ds max color-coded progressbar

Does anyone know a way to add a color-coded progress bar to a rollout similar to the old pre-max9 polygon counter?


(image from web)

I’m sure there’s a dotnet control, but before going that route I was wondering if anyone knew of something native.

You could create your own bitmap and display it in a rollout?

Hmm, sorry that would be too easy.

Does anyone have a really convoluted and hacky method that takes a bunch more work?

[QUOTE=floatvoid;6715]Hmm, sorry that would be too easy.

Does anyone have a really convoluted and hacky method that takes a bunch more work?[/QUOTE]

You could always go with butterflies :nod:

hacky, not quite like the polygon counter, but colorful…

try (destroyDialog ProgressBarExample) catch()

rollout ProgressBarExample "ProgressBar Example" width:187 height:77
(
	button doit "Do Something" pos:[50,7] width:83 height:21
	label progLabel "" pos:[8,41] width:170 height:14
	progressBar prog "" pos:[8,55] width:170 height:10 color:(color 0 0 0)
	
	
	on doit pressed do
	(
		myNumber = 1000
		for i in 1 to myNumber do
		(
			--print i
			sleep .005
			prog.value = 100.*i/myNumber
			progLabel.caption = ("Processing vert #" + i as string + " of " + myNumber as string)
			colornum = (255.*i/myNumber)
			prog.color = (color(colorNum) 0 (255-colorNum))
		)
		prog.value = 0
		progLabel.caption = "Done!"
	)
)

createDialog ProgressBarExample

another hacky way would be to use dotnet GDI, here is a simple example(not very accurate). I have used dotnet label and GDI to draw on it.:


(
global _dupPolyCounter
try (destroyDialog _dupPolyCounter) catch()

rollout _dupPolyCounter "Duplicate Polycounter" width:250
(
	local _min = 100,_max =200
	group "Progress Test"
	(
		label _bdgt "Budget:" pos:[20,25]
		spinner spn_max "" pos:[65,25] range:[100,1000,_max] width:55 type:#integer
		label _crnt "Current:" pos:[140,25]
		spinner spn_val "" pos:[185,25] range:[1,spn_max.value,_min] width:55 type:#integer
		dotnetcontrol lbl "label" height:10 width:200 pos:[25,50]
	)
	local acolor = dotnetclass "system.drawing.color"
	
	mapped fn dispose gdiobj =
		(
			gdiobj.Dispose
		)
	on lbl Paint args do
	(
		local margin = 2
		graphics = args.graphics
		width = ((lbl.clientRectangle.width)/40)
		_val = ((float(_min)/_max)*40)
		X = lbl.clientRectangle.X+margin
		Y = lbl.clientRectangle.Y+margin
		for i = 1 to _val do
		(			
			rect = dotnetobject "System.Drawing.Rectangle" X Y (width-1) (lbl.clientRectangle.Height-2*margin)
			_col = acolor.green
			if i > 35  then _col = acolor.red else (if i>27 then _col = acolor.yellow else _col = acolor.green)
			foreBrush=dotnetobject "System.Drawing.SolidBrush" _col
			graphics.FillRectangle foreBrush rect
			X += width
			dispose #(foreBrush)
		)
	)
	on spn_val changed val do
	(
		_min = val
		lbl.invalidate()
	)
	on spn_max changed val do
	(
		_max = val
		spn_val.range = [1,spn_max.value,_min]
		lbl.invalidate()
	)
 	on _dupPolyCounter open do
	(
		lbl.backColor = lbl.backColor.Black
	) 
)

createDialog _dupPolyCounter
)

I was totally kidding guys, but thanks :stuck_out_tongue:

steev kelly: hey, I dig that!