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 abstrax » Tue Dec 17, 2013 8:51 pm

abstrax Tue Dec 17, 2013 8:51 pm
phdubrov wrote:How to manipulate static pins attributes inside nodes?
For example how to set camera aperture inside render target without creating camera node?

You can't. To provide values you need nodes. That's their whole purpose.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5484
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: Nodes and Nodegraphs in Lua.

Postby phdubrov » Tue Dec 17, 2013 9:26 pm

phdubrov Tue Dec 17, 2013 9:26 pm
So if i need create compact preset with not default camera and kernel i create nodegraph with render target out and mesh input and make inside rendertarget, camera and kernel nodes with my defaults? It works but there is no more compact way to make it?
phdubrov
Licensed Customer
Licensed Customer
 
Posts: 15
Joined: Sun Mar 03, 2013 1:47 pm

Re: Nodes and Nodegraphs in Lua.

Postby stratified » Tue Dec 17, 2013 9:41 pm

stratified Tue Dec 17, 2013 9:41 pm
You could create your setup once and then save it as an OCS file.

Code: Select all
-- create your setup in a graph
...

-- save your graph out as an OCS file
xml = myGraph:writeOCs()
file = io.open("/path/to/file.ocs", "w")
file:write(xml)
file:close()

-- in another script you could load your setup again in the root graph
xml = file:read("*a")
octane.project.readOcs(xml, myGraph)


Hope this helps...

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 abstrax » Tue Dec 17, 2013 9:56 pm

abstrax Tue Dec 17, 2013 9:56 pm
phdubrov wrote:So if i need create compact preset with not default camera and kernel i create nodegraph with render target out and mesh input and make inside rendertarget, camera and kernel nodes with my defaults? It works but there is no more compact way to make it?

I think here is something not clear enough yet: When you create a new node, it will be configured, i.e. for most pins an internal default node is created. You then only have to modify those things you need to modify and leave the rest alone. So if you create a new render target node, it already has an internal camera node, kernel node etc. Only the P_MESH will stay empty.

As an alternative you can set up whatever you want interactively in Octane Standalone and save it as .ocs file. Then load it into some temporary root node graph, like Thomas described and then copy the content of the root node graph into the root node graph of the current project. This way you won't loose the content of your current project, but merge the .ocs file into it.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5484
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: Nodes and Nodegraphs in Lua.

Postby phdubrov » Wed Dec 18, 2013 12:41 pm

phdubrov Wed Dec 18, 2013 12:41 pm
I tried set camera attributes via rendertarget node not internal camera node. My bad. Didn't get internal nodes concept.
working code
Code: Select all
frontCamera = frontRT:getOwnedItem(octane.P_CAMERA)
frontCamera:setPinValue(octane.P_APERTURE, 0, true)
phdubrov
Licensed Customer
Licensed Customer
 
Posts: 15
Joined: Sun Mar 03, 2013 1:47 pm

Re: Nodes and Nodegraphs in Lua.

Postby abstrax » Wed Dec 18, 2013 7:29 pm

abstrax Wed Dec 18, 2013 7:29 pm
phdubrov wrote:I tried set camera attributes via rendertarget node not internal camera node. My bad. Didn't get internal nodes concept.
working code
Code: Select all
frontCamera = frontRT:getOwnedItem(octane.P_CAMERA)
frontCamera:setPinValue(octane.P_APERTURE, 0, true)

Don't know how your code above can work, but you would actually write:
Code: Select all
frontCamera = frontRT:getConnectedNode(octane.P_CAMERA)
frontCamera:setPinValue(octane.P_APERTURE, 0, true)

The key here is that a pin is not only connected to external nodes, but also to internal nodes. By fetching the connected node instead of the owned item, it would work if the pin is connected to an internal or an external node.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5484
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: Nodes and Nodegraphs in Lua.

Postby phdubrov » Wed Dec 18, 2013 9:35 pm

phdubrov Wed Dec 18, 2013 9:35 pm
Why it shouldn't work? But your code is better, thanks.
phdubrov
Licensed Customer
Licensed Customer
 
Posts: 15
Joined: Sun Mar 03, 2013 1:47 pm

Re: Nodes and Nodegraphs in Lua.

Postby abstrax » Wed Dec 18, 2013 10:23 pm

abstrax Wed Dec 18, 2013 10:23 pm
phdubrov wrote:Why it shouldn't work? But your code is better, thanks.

I was wrong, your code should work as long as the pin has an internal node.
In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
User avatar
abstrax
OctaneRender Team
OctaneRender Team
 
Posts: 5484
Joined: Tue May 18, 2010 11:01 am
Location: Auckland, New Zealand

Re: Nodes and Nodegraphs in Lua.

Postby Tugpsx » Sat Jan 04, 2014 10:12 pm

Tugpsx Sat Jan 04, 2014 10:12 pm
Quick question, although this may have been answered elsewhere.
Since saving shaders is currently disabled, can we create a script to export shaders nodes to ocm files that we can load and use later.
It would make life easier not to recreate the settings every time I use these characters. I know mine isn't as complicated as others but every bit help.


Materialnode.JPG
Material Node example.
Dell Win Vista 32 | NVIDIA Quadro NVS135M | Core2 Duo T7500 2.20GHz | 4GB
CyberPowerPC Win 7 64| NVIDIA GTX660Ti (3G) GTX480(1.5G) | 16GB
Tugpsx
Licensed Customer
Licensed Customer
 
Posts: 1145
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL

Re: Nodes and Nodegraphs in Lua.

Postby stratified » Sat Jan 04, 2014 10:37 pm

stratified Sat Jan 04, 2014 10:37 pm
Tugpsx wrote:Quick question, although this may have been answered elsewhere.
Since saving shaders is currently disabled, can we create a script to export shaders nodes to ocm files that we can load and use later.
It would make life easier not to recreate the settings every time I use these characters. I know mine isn't as complicated as others but every bit help.


Materialnode.JPG


Hi,

I don't think it's worth to create the script because we shall re-enable material macros in one of the next releases... . You could save your materials with Octane 1.20 for now, the macros are compatible with this version.

cheers,
Thomas
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand
PreviousNext

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 28 guests

Thu Apr 25, 2024 7:30 am [ UTC ]