Nodes and Nodegraphs in Lua.

Forum for OctaneRender Lua scripting examples, discussion and support.
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

hi there,

octane.project.select adds an item to the current selection (the items with a yellow border in the nodegraph editor).

If you don't want to select nodes manually, you have to search for them in the scene's root graph (octane.nodegraph.getRootGraph()). You can search by name (octane.nodegraph.findItemsByName) or by type (octane.nodegraph.findNodes). In your case I guess it's the easiest to search by name:

Code: Select all

nodes = octane.nodegraph.getRootGraph():findItemsByName("V6Torso")
cheers,
Thomas
Slide3D
Licensed Customer
Posts: 44
Joined: Mon Nov 26, 2012 2:16 am

stratified wrote:hi there,

octane.project.select adds an item to the current selection (the items with a yellow border in the nodegraph editor).

If you don't want to select nodes manually, you have to search for them in the scene's root graph (octane.nodegraph.getRootGraph()). You can search by name (octane.nodegraph.findItemsByName) or by type (octane.nodegraph.findNodes). In your case I guess it's the easiest to search by name:

Code: Select all

nodes = octane.nodegraph.getRootGraph():findItemsByName("V6Torso")
cheers,
Thomas
does not work :(

Code: Select all

local  v6mesh, mface = nil, nil

local selection = octane.project.getSelection()
if selection[1]:getProperties().type == octane.NT_GEO_MESH then
v6mesh = selection[1]
else
    error("a mesh need to be selected")
end

mface = octane.nodegraph.getRootGraph():findItemsByName("face")


v6mesh:connectTo("Face", mface)
Attachments
Снимок.JPG
i7 2600k, 16gb, Quadro FX1800(not use in Octane) + GTX580 1536Mb
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

The error message tells you the problem:

Code: Select all

bad argument #2 to 'connectTo' (octane.node expected, got table)
findItemsByName gives you a list of nodes with this name, not a single node. You can check these things in the API browser (click the button with the question mark). So this second argument should be mface[1].

--
Roeland
Slide3D
Licensed Customer
Posts: 44
Joined: Mon Nov 26, 2012 2:16 am

roeland wrote:The error message tells you the problem:

Code: Select all

bad argument #2 to 'connectTo' (octane.node expected, got table)
findItemsByName gives you a list of nodes with this name, not a single node. You can check these things in the API browser (click the button with the question mark). So this second argument should be mface[1].

--
Roeland
Thanks!!!
it's worked!
i7 2600k, 16gb, Quadro FX1800(not use in Octane) + GTX580 1536Mb
Post Reply

Return to “Lua Scripting”