Notifications
Clear all

[Closed] Display progress on standard render progress dialog

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…

Thanks

5 Replies

Not that I know of. Is there any reason the ProgressBar Control wouldn’t work?

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.

ready for some scary code?


 -- remove any previous instance of this stuff
 DialogMonitorOPS.UnRegisterNotification id:#test
 
 -- pre-define some windows messages
 PBM_SETRANGE = 1025
 PBM_SETSTEP = 1028
 PBM_STEPIT = 1029
 WM_SETTEXT = 12
 
 -- 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
 	true
 )
 
 -- 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.

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

That really is scary! But interesting.
Thanks
– MartinB