Replace "Render button/max quick render" sequence with custom function?

Replace "Render button/max quick render" sequence with custom function?

kmackey2001
Enthusiast Enthusiast
424 Views
0 Replies
Message 1 of 1

Replace "Render button/max quick render" sequence with custom function?

kmackey2001
Enthusiast
Enthusiast

I've almost completed a scripted plugin, but Max's default render does not update the scene between frames as I need it to. I've been able to solve this by writing my own function to render animations, and would like to be able to drop it in place of the standard sequence.

dialogMonitorOps.unregisterNotification id:#test
dialogMonitorOps.enabled = false
 
fn customRender = (
    local hwnd = dialogMonitorOps.getWindowHandle()
    local hwndText = uiAccessor.getWindowText hwnd
 
    if classOf hwndText == string do (
        local substr = substring hwndText 1 9
 
        if substr == "Rendering" do (
            -- Cancel standard render
            uiAccessor.pressButtonByName hwnd "Cancel"
 
            -- Substitute scripted render
            render() -- PLACEHOLDER
        )
    )
 
    true
)
 
dialogMonitorOps.enabled = true
dialogMonitorOps.interactive = false
dialogMonitorOps.registerNotification customRender id:#test

I get the following:

-- Error occurred in customRender(); filename: C:\Users\Kevin\Documents\3dsMax\scripts\customRend er.ms; position: 462; line: 16
-- Frame:
-- hwndText: "Rendering"
-- substr: "Rendering"
-- hwnd: 5444878P

To save the trouble of counting, that's the line which in this case simply says render()
Obviously that works when run outside the function, and Max doesn't seem to want to tell me what the error actually IS. Any tips on getting this working?

0 Likes
425 Views
0 Replies
Replies (0)