problems with the turntable script

Forums: problems with the turntable script
Forum for OctaneRender Lua scripting examples, discussion and support.

problems with the turntable script

Postby grimm » Mon Dec 30, 2013 11:46 pm

grimm Mon Dec 30, 2013 11:46 pm
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 20 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 460.56
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1321
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: problems with the turntable script

Postby stratified » Tue Dec 31, 2013 12:21 am

stratified Tue Dec 31, 2013 12:21 am
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
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: problems with the turntable script

Postby grimm » Tue Dec 31, 2013 2:06 am

grimm Tue Dec 31, 2013 2:06 am
Perfect, thanks. :D
Linux Mint 20 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 460.56
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1321
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 12 guests

Fri Apr 19, 2024 9:53 am [ UTC ]