View Full Version : Pre-Render Callback Halting for user input
05 May 2008, 09:58 PM
I'm creating a sort of render settings checker for our shop and I've registered a callback to evaluate a function at #preRender but the problem is it doesn't halt the rendering waiting for user response. There must be a simple way to do it, can I unhook the render from taking place until a user clicks "Continue Rendering" or something?
I found a way that works as intended, adding a "QueryBox" halts the rendering, but isn't what I need because it doesn't allow the user to press any buttons in the rollout or anything, take a look. Run the script and press render.
callbacks.addScript #preRender "VRayRenderCheck()" id:#VRRenderChk
fn VRayRenderCheck = (
if true then ( -- if a problem is found then create the dialog and allow the user to click "Fix" on problem areas
print "VRayRenderCheck in Progress..."
createDialog rlt_SceneChecker 300 200
rollout rlt_SceneChecker "Scene Checker v1.0" (
listbox lst_SceneErrors "Problems: "
button btn_Fix "Fix Problems"
on rlt_SceneChecker open do (
on btn_Fix pressed do (
05 May 2008, 11:17 PM
add "modal:true" to the line that creates the dialog...
createDialog rlt_SceneChecker 300 200 modal:true
Should stop the renderer and allow you to effect objects and materials in the scene, the renderer's settings will not be able to be changed...
05 May 2008, 11:25 PM
Thanks Kram! Many thanks, works great. If the user decides to halt rendering entirely is there a way I can stop the rendering from taking place on the click of the button?
05 May 2008, 11:47 PM
Sure that's easy...
doscommand "taskkill /F /IM 3dsmax.exe"
ha ha.... Oh you wanted to keep the session of max open didn't you...
No I don't know of a way to abort the render command after the render starts...
Maybe... Remember the scene's state in an array and hide everything... at least it'll render quickly and then restore the scene.... kinda hokey but it'll save a little time... or just messagebox the user to abort the render...
05 May 2008, 12:33 AM
You can always send a mouse click / enter event to the button in the render progress dialog using AutoIt or any number of command-line utilities. Similar to the taskkill DOSCommand, except without the undesirable side-effects ;)
Edit: that's AutoIt, not AutoHotKey; the two are similar but AutoHotKey tends to be more... hotkey-oriented.
05 May 2008, 12:55 AM
edit: ignore.. the render progress dialog DOES register with dialogmonitorops (didn't at first; but who cares).
So you can use the dialogMonitorOps in combination with UIAccessor to effectively abort the render.
fn checkDialog = (
local hwnd = dialogMonitorOps.getWindowHandle()
if (uiAccessor.getWindowText hwnd == "Rendering") then (
if (querybox "Cancel?") then ( uiAccessor.pressButtonByName hwnd "Cancel" )
dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification checkDialog id:#test
Edit 2: "comvination"? yeesh.
05 May 2008, 03:59 PM
f'n sweet.. I'm definitely stowing that snibit away... thanks...
05 May 2008, 05:08 PM
Def, thanks Zeboxx2!
05 May 2008, 05:08 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.