Sorry for this noob question. I tried to find as much information as I can about how to do this. I though I understood it but I keep getting errors, so I'm requesting your help.
What I'm trying to achieve:
Using a Transform Scale node to randomize some transformation I'm doing.
It was working well using a basic float input like I'm doing for the translation and rotation. But I wanted the possibility to lock the 3 values together like we have with a Transform scale.
However, I'm having trouble accessing the float values of the Transform Scale node
- Code: Select all
function ScriptGraph.onInit(self, graph)
local inputs = self:setInputLinkers(
{
{
label = "Random Translation",
type = octane.PT_FLOAT,
defaultNodeType = octane.NT_FLOAT,
defaultValue = { 0, 0, 0 },
sliderBounds = { 0, 1 },
logarithmic = true,
},
{
label = "Random Rotation",
type = octane.PT_FLOAT,
defaultNodeType = octane.NT_FLOAT,
defaultValue = { 0, 0, 0 },
sliderBounds = { 0, 1 },
logarithmic = true,
},
{
label = "Random Scale",
type = octane.PT_TRANSFORM,
defaultNodeType = octane.NT_TRANSFORM_SCALE,
defaultValue = { 0, 0, 0 },
sliderBounds = { 0, 10 },
logarithmic = true,
},
{
label = "Seed",
type = octane.PT_INT,
defaultNodeType = octane.NT_INT,
defaultValue = { 1 },
sliderBounds = { 1,1000 },
logarithmic = true,
},
})
IN_TRANSLATION_RAND = inputs[1]
IN_ROTATION_RAND = inputs[2]
IN_SCALE_RAND = inputs[3]
IN_SEED = inputs[4]
local randTrans = self:getInputValue(IN_TRANSLATION_RAND)
local randRot = self:getInputValue(IN_ROTATION_RAND)
local randScale = self:getConnectedNode(IN_SCALE_RAND):getInputValue(octane.P_SCALE)
I'm not pasting the entire code but just the areas that concern my issue.
It was perfectly working until I tried to improve a bit my script.
At this line:
- Code: Select all
local randScale = self:getConnectedNode(IN_SCALE_RAND):getInputValue(octane.P_SCALE)
What I'm trying to store in this variable is an array of value like I can get with my randTrans and randRot variables.
I tried a lot of different syntax and combination without success.
The error on this one is
- Code: Select all
attempt to call a nil value (method 'getConnectedNode')
Thank you very much for your help!