I took Beppe's Animate Value script and am trying to accomplish the following-
His script:
Modify (1) a single float value, from (2) start to (3) end, over (4) time period
I am trying to:
Modify (1) all pins in an entire environment node, from (2) start to (3) end, over (4) time period
- Code: Select all
local AnimateValueScript = {}
local mStart
local mStop
local mSec
local mOutput
function AnimateValueScript.onInit(self, graph)
graph:updateProperties({name = "AnimateEntireEnvironment"})
-- create input linkers
local inputs = graph:setInputLinkers
{
{
type = octane.PT_ENVIRONMENT,
label = "Start Value",
defaultNodeType = octane.NT_ENV_DAYLIGHT,
defaultValue = 1
},
{
type = octane.PT_ENVIRONMENT,
label = "End value",
defaultNodeType = octane.NT_ENV_DAYLIGHT,
defaultValue = 1
},
{
type = octane.PT_FLOAT,
label = "Time in seconds",
defaultNodeType = octane.NT_FLOAT,
defaultValue = 10
}
}
mStart = inputs[1]
mStop = inputs[2]
mSec = inputs[3]
-- create output linker
local outputs = graph:setOutputLinkers
{
{
type = octane.PT_ENVIRONMENT,
label = "Animated Value",
defaultNodeType=octane.NT_OUT_FLOAT
}
}
mOutput = outputs[1]
end
function AnimateValueScript.onEvaluate(self, graph)
local startVal = mStart:getInputNode(octane.P_INPUT):getAttribute(octane.A_VALUE)
local endVal = mStop:getInputNode(octane.P_INPUT):getAttribute(octane.A_VALUE)
local totalT = mSec:getInputNode(octane.P_INPUT):getAttribute(octane.A_VALUE)
local Output = octane.node.create
{
type = octane.NT_ENV_DAYLIGHT,
name = "Ani Value",
graphOwner = graph
}
Output:setAnimator(octane.A_VALUE, { 0 }, { startVal, endVal}, totalT[1])
octane.changemanager.update()
mOutput:connectTo(octane.P_INPUT, Output)
AnimateValueScript:setEvaluateTimeChanges(true)
end
return AnimateValueScript
When I modified script to accomplish this environment pin morphing, it is telling me I can't index a nil figure. I imagine it has to do with the table not being able to take in all the data from the entire environment node's pins via the command I am giving it.
But I am now curious, is this even possible, to set an entire placeholder environment node (all floating & boolean sub-nodes and all), and then have that be read and fed into the active environment node channel, with the timeline, like Beppe was able to do with the single float value.
I was able to establish the physical shell (I have to select Daylight or texture), and it connects out to the environment node of a render target, but it never establishes the animation timeline like the working script from Beppe.
If anyone can give some insight that would be great. I am curious if I cannot do this at all, and what might make this work.
THANKS!
Notuiusweb