Page 6 of 6
Re: Nodes and Nodegraphs in Lua.
Posted: Tue Jan 21, 2014 7:42 pm
by stratified
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
Re: Nodes and Nodegraphs in Lua.
Posted: Wed Jan 22, 2014 12:38 am
by Slide3D
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)
Re: Nodes and Nodegraphs in Lua.
Posted: Wed Jan 22, 2014 1:48 am
by roeland
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
Re: Nodes and Nodegraphs in Lua.
Posted: Wed Jan 22, 2014 1:56 am
by Slide3D
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!