Results 1 to 7 of 7

Thread: 3ds max color-coded progressbar

  1. #1

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

  2. #2
    Administrator Rob Galanakis's Avatar
    Join Date
    Jun 2008
    Location
    Reykjavik, Iceland
    Posts
    1,242

    Default

    You could create your own bitmap and display it in a rollout?
    Forum Administrator
    www.robg3d.com

  3. #3

    Default

    Hmm, sorry that would be too easy.

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

  4. #4
    Moderator Eiktyrner's Avatar
    Join Date
    Aug 2008
    Location
    Uppsala, Sweden
    Posts
    60

    Default

    Quote Originally Posted by floatvoid View Post
    Hmm, sorry that would be too easy.

    Does anyone have a really convoluted and hacky method that takes a bunch more work?
    You could always go with butterflies


  5. #5
    Art Team Lead steev kelly's Avatar
    Join Date
    Aug 2008
    Location
    Austin, TX
    Posts
    28

    Default

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

    Code:
    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

  6. #6
    Tech Art akira's Avatar
    Join Date
    Apr 2009
    Location
    Singapore
    Posts
    28

    Default

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

    Code:
    (
    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
    )
    Last edited by akira; 06-23-2010 at 04:46 PM. Reason: Corrected Code and added image
    Akram 'Akira' Parvez
    Technical Artist
    http://www.akramparvez.com/

  7. #7

    Default

    I was totally kidding guys, but thanks :P

    steev kelly: hey, I dig that!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •