View Full Version : Undo on... RenderWidth/RenderHeight Changes...

02 February 2012, 11:07 AM
Is there any way to get an Undo action to undo changes to the Render Scene dialog? I've got a script which changes parameters in the render scene dialog, Render Width/Height, Aperture Width and these don't get undone with a standard Max Undo or maxscript Undo.

I'm thinking an easy way would be to make a callback to monitor these values and have a seperate Undo button in my script which calls a max undo and looks for the previous values.

02 February 2012, 12:29 PM
See the #renderParamsChanged general event callback.

02 February 2012, 02:46 PM
Yeah, was just thinking out loud, turns out I didn't need to make it that complicated, just stored those values before my buttons do anything and then can recall them with a custom undo button that also calls Max undo, only gives one undo level but it's better than nothing.

RenderParamschanged monitors the values I'm looking for but doesn't give you the values they were before they got changed....

02 February 2012, 09:01 AM

--// ... your procedure code here

fetchmaxfile quiet:on ; gc() -- "undo"

02 February 2012, 10:03 AM

--// ... your procedure code here

fetchmaxfile quiet:on ; gc() -- "undo"

I always think Hold/Fetch is a lazy way to code tools, it's all well and good for small scenes but when you work with CAD data it's just impractical to keep holding and fetching 2gb+ files.


02 February 2012, 10:23 AM
From my experience it is also very prone to undebuggable ***system exception***s

02 February 2012, 11:35 AM
So having sat on it for a bit I've realised rather than having a dedicated Undo button for my script the best thing to do is use the #sceneUndo callback to monitor when an undo is called, look for the name of the undo entry that I've given my function in my tool and then if it matches as well as undo-ing it also sets the renderwidth/renderheight back to the previous values as well. This way it gets around the user pressing Ctrl+Z as well.

02 February 2012, 10:59 PM
why not just set the render resolution back after !?

testSizeRatio = 0.1
-- store old resolution
origRenderWidth = renderWidth
origRenderHeight = renderHeight

-- apply new resolution
renderWidth = origRenderWidth * testSizeRatio
renderHeight = origRenderHeight * testSizeRatio
if renderSceneDialog.isOpen() then renderSceneDialog.update()
max render last

-- restore resolution
rendTimeType = origRendTimeType
rendSaveFile = origRendSaveFile
if renderSceneDialog.isOpen() then renderSceneDialog.update()

02 February 2012, 09:53 AM
Thanks Rappy, but that's not the intention of my script. My script is more similar to MartinB's Overscan script where you can modify the camera FOV and adjust the render resolution at the same time. For experimenting with different camera lenses and camera backs, image aspects etc...

Just want people to be able to undo properly.

02 February 2012, 01:13 PM
create a CA with parameters renderwidth, renderheight, etc.
add this CA to root node for example.
setting these parameters will change the global values.
make the changing of the CA parameters undoable.

02 February 2012, 05:45 PM
From my experience it is also very prone to undebuggable ***system exception***sInteresting... em i lucky man then (: will keep my eyes open though.
I agree with that hold-fetch is not applicable in many cases but i lost my trust in max undo system years ago.

CGTalk Moderation
02 February 2012, 05:45 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.