Nodes and Nodegraphs in Lua.

Forums: Nodes and Nodegraphs in Lua.
Forum for OctaneRender Lua scripting examples, discussion and support.

Re: Nodes and Nodegraphs in Lua.

Postby stratified » Tue Jan 21, 2014 7:42 pm

stratified Tue Jan 21, 2014 7:42 pm
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Nodes and Nodegraphs in Lua.

Postby Slide3D » Wed Jan 22, 2014 12:38 am

Slide3D Wed Jan 22, 2014 12:38 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
Slide3D
Licensed Customer
Licensed Customer
 
Posts: 44
Joined: Mon Nov 26, 2012 2:16 am

Re: Nodes and Nodegraphs in Lua.

Postby roeland » Wed Jan 22, 2014 1:48 am

roeland Wed Jan 22, 2014 1:48 am
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
User avatar
roeland
OctaneRender Team
OctaneRender Team
 
Posts: 1810
Joined: Wed Mar 09, 2011 10:09 pm

Re: Nodes and Nodegraphs in Lua.

Postby Slide3D » Wed Jan 22, 2014 1:56 am

Slide3D Wed Jan 22, 2014 1:56 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
Slide3D
Licensed Customer
Licensed Customer
 
Posts: 44
Joined: Mon Nov 26, 2012 2:16 am
Previous

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 10 guests

Fri Apr 19, 2024 5:49 am [ UTC ]