I am trying to make a script that will automatically connect an asset to a newly created placement node,
the script is working on the scene root but stops working when I do it inside a group because the placement node is still created on the scene root.
How can I get the location of selection and make the placement node appear on the correct spot to be able to connect it?
Thanks in advance.
Cheers
Filipe
- Code: Select all
-- @shortcut alt+p
local rendertarget = octane.render.getRenderTargetNode()
local camera = rendertarget:getInputNode(octane.P_CAMERA)
local pos = camera:getPinValue(octane.P_TARGET)
local selection = octane.project.getSelection()
nodepos = selection[1].position
local placementnode = octane.node.create
{
type = octane.NT_GEO_PLACEMENT,
name = "placement node",
position = {nodepos[1], nodepos[2]+50}
}
matrix = {
{1,0,0,pos[1]},
{0,1,0, pos[2]},
{0,0,1, pos[3]},
}
placementnode:setPinValue(octane.P_TRANSFORM,matrix)
placementnode:connectToIx(2, selection[1])