Pre-Render Callback Halting for user input


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.

-- Rollouts
global rlt_SceneChecker
-- Functions
global VRayRenderCheck
-- Variables
-- Callbacks
callbacks.removeScripts id:#VRRenderChk
callbacks.addScript #preRender "VRayRenderCheck()" id:#VRRenderChk

try(destroyDialog rlt_SceneChecker)catch()

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 (
		-- something



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…


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?



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…


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

Edit: that’s AutoIt, not AutoHotKey; the two are similar but AutoHotKey tends to be more… hotkey-oriented.


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.

 dialogMonitorOps.unRegisterNotification id:#test
 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.


f’n sweet… I’m definitely stowing that snibit away… thanks…


Def, thanks Zeboxx2!


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.