View Full Version : Display progress on standard render progress dialog

06 June 2008, 05:54 PM
I've prerender and postrender callbacks that take some time on big scenes, I was wondering if the render progress dialog is accessible from callbacks? So I can display the status of the script in the standard dialog.

Ideally the "Current Task :" label item and the Progress bar below that...


06 June 2008, 06:24 PM
Not that I know of. Is there any reason the ProgressBar Control wouldn't work?

06 June 2008, 08:04 PM
Network rendering, the standard UI is minimized hence the ProgessBar isn't initalized... plus I'm just trying to keep it clean... I currently have a seperate dialog popping up, but it would be nice to use the max standard dialog.

06 June 2008, 06:18 AM
ready for some scary code?

-- remove any previous instance of this stuff
DialogMonitorOPS.UnRegisterNotification id:#test

-- pre-define some windows messages

-- our main function, skip down to below this function then come back here.
fn test = (
-- get the handle for the dialog that just opened
hwnd = DialogMonitorOPS.GetWindowHandle()
-- and then the titlebar text (not fool-proof)
hwnd_title = UIAccessor.GetWindowText hwnd
-- if it appears to be the render progress dialog
if (hwnd_title == "Rendering") then (
-- then press the Pause button so we can watch what's happening
UIAccessor.PressButtonByName hwnd "Pause"
-- let's get all the controls in that window and collect the two progressbars
-- (note: 3ds Max 2008 or AVGuard only)
progressBars = for control in (windows.getChildrenHWND hwnd) collect (
if (control[4] == "msctls_progress32") then ( control[1] )
else ( dontcollect )
-- now that we have the progress bars (the first one is the one we're interested in mostly)
-- we can set/change its range. This is done with an lParam yadda yadda.
-- Suffice to say that we're just going to set the range from 0 to 100 using bit shifty stuff
UIAccessor.SendMessage progressBars[1] PBM_SETRANGE 0 (bit.shift 100 16)
-- and let's set the step size to 5
UIAccessor.SendMessage progressBars[1] PBM_SETSTEP 5 0
-- which means we get to do 20 steps
for i = 1 to 20 do (
-- so let's do just that
UIAccessor.SendMessage progressBars[1] PBM_STEPIT 0 0
sleep 1
-- but can we change the text of the label to show what the current task is?
-- we can get the label
-- currentTaskControl = (windows.getChildrenHWND hwnd)[4]
-- but how to create a string buffer for SendMessage? No idea :)
-- UIAccessor.SendMessage currentTaskControl[1] WM_SETTEXT 0 <insert pointer to string buffer here>
-- return true or the dialog monitor goes medieval on you

-- enable the dialog monitor - this is 3ds Max r9+ stuff
DialogMonitorOPS.Enabled = true

-- and register the above function. Anytime a dialog opens, that function gets called.
DialogMonitorOPS.RegisterNotification test id:#test

Edit: Windows2008.. hehe. That's 3ds Max 2008, of course.

06 June 2008, 03:21 PM
I was looking at DialogMonitorOPS stuff, from an example you posted about canceling the render on another thread, but it would've taken me a good long while to figure this one out.... and you've one of my favorite comment lines ever...

"--return true or the dialog monitor goes medieval on you" ha ha..

Thanks a ton, the DialogMonitorOPS is definitely stuff worth knowing ! ! !

06 June 2008, 12:15 PM
ready for some scary code?
Edit: Windows2008.. hehe. That's 3ds Max 2008, of course.

That really is scary! But interesting. ;-)
-- MartinB

CGTalk Moderation
06 June 2008, 12:15 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.