problems with the turntable script

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

I noticed that when you cancel the render, and then restart, the camera position does not return back to the original position. Unless you restart the script of course. I have tried to save the CAM_NODE and the RT_NODE variables but that doesn't work and I start getting scoping issues. I also tried to clear the animator but that didn't do anything either. I'm just not understanding how the Octane internals work to get this to work right. Thanks,

Jason
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Hi Jason,

That's a bug in the script (I fixed it in the yaw, pitch and roll script). The easiest way to fix this is to just get fresh copies of the scene, render target and camera. Creating copies is cheap. I wouldn't bother trying to restore the original state, just get a fresh copy. You would need to do this just before you start rendering:

Code: Select all

    elseif component == renderButton then 
        -- Get the render target and camera in global variables
        -- NOTE: here we create a fresh copy just before we start rendering.
        SCENE_GRAPH, RT_NODE, CAM_NODE = getSceneCopy()
        -- Start the actual rendering.
        startRender(SCENE_GRAPH, RT_NODE, CAM_NODE, OUT_PATH)
    elseif component == cancelButton then
        cancelRender()
    elseif component == window then
Saving the variables doesn't work because the value of the variable isn't the node itself, it's a reference to the node. So the saved variable just points to the same node (similar to pointer in C).

Clearing the animator doesn't work either. An animator is only like a "wrapper" around an attribute, modifying the attribute value for each time frame (and interpolating between values). So if you clear the animator, the attribute retains the last set value. The last value may or may not be the original value (depending on whether you changed the time in the scene).

I hope this clears things up a bit.

regards,
Thomas
User avatar
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Perfect, thanks. :D
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
Post Reply

Return to “Lua Scripting”