Read camera cmdline params and applying them to a cam node

Forums: Read camera cmdline params and applying them to a cam node
Forum for OctaneRender Lua scripting examples, discussion and support.

Read camera cmdline params and applying them to a cam node

Postby matej » Sat Apr 26, 2014 3:50 pm

matej Sat Apr 26, 2014 3:50 pm
Hi, I need some help with Lua scripting.

It is possible to get the command line args that were passed to the Octane process? And then update some (camera) node in the loaded project with them? The problem is that the camera cmdline args are saved to some default camera, that is used when you click on a geometry node, but I'd need those parameters to be saved in some Render Target camera (or arbitrary camera node the user specifies).

Or if it's not possible to know the cmdline args, it is possible to read that "default" camera which receives them on project load?
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
matej
Licensed Customer
Licensed Customer
 
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Re: Read camera cmdline params and applying them to a cam node

Postby matej » Mon Apr 28, 2014 3:00 pm

matej Mon Apr 28, 2014 3:00 pm
nvm I got this.

I'd still like to know if it's possible to get (with Lua) the cmd line args that were passed to Octane process?
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
matej
Licensed Customer
Licensed Customer
 
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Re: Read camera cmdline params and applying them to a cam node

Postby Tugpsx » Wed Apr 30, 2014 5:25 am

Tugpsx Wed Apr 30, 2014 5:25 am
Usually when you open in the built-in editor it will echo the command it the status bar as the script is being ran
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: Read camera cmdline params and applying them to a cam node

Postby matej » Wed Apr 30, 2014 7:49 am

matej Wed Apr 30, 2014 7:49 am
Tugpsx wrote:Usually when you open in the built-in editor it will echo the command it the status bar as the script is being ran


What I'm interested in is to programatically read the command line arguments Octane was started with. I already solved my problem differently, but having this info available to you through Lua, might be a useful thing for future automation tasks.
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
matej
Licensed Customer
Licensed Customer
 
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Re: Read camera cmdline params and applying them to a cam node

Postby stratified » Wed Apr 30, 2014 8:16 pm

stratified Wed Apr 30, 2014 8:16 pm
matej wrote:
Tugpsx wrote:Usually when you open in the built-in editor it will echo the command it the status bar as the script is being ran


What I'm interested in is to programatically read the command line arguments Octane was started with. I already solved my problem differently, but having this info available to you through Lua, might be a useful thing for future automation tasks.


You can do this partially. You can't read the normal command line arguments but you can pass a string argument to the script from the command line. These arguments are available in the global variable arg with arg[0] being the program. For example:

Code: Select all
./octane --script ~/dev/lua/command-line-args.lua --script-args "this is passed verbatim to lua" --stop-after-script


You can capture this in your script:

Code: Select all
-- print out the command line args
for i=0,#arg do
    print(string.format("arg%d : %s", i, arg[i]))
end


Make sure logging is redirected to stdout our you won't see much in this example.

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

Re: Read camera cmdline params and applying them to a cam node

Postby matej » Thu May 01, 2014 8:18 am

matej Thu May 01, 2014 8:18 am
stratified wrote:You can do this partially. You can't read the normal command line arguments but you can pass a string argument to the script from the command line.

I see. After thinking it through a little more, reading cmd line args. isnt that useful, because you can pass data only for one camera, one resolution, one imager, one frame basically... It's much more flexible & powerfull to save everything you need in a Lua script - that is in my case generated from Blender and then run on Octane start.

Thanks for your help!
SW: Octane 3.05 | Linux Mint 18.1 64bit | Blender 2.78 HW: EVGA GTX 1070 | i5 2500K | 16GB RAM Drivers: 375.26
cgmo.net
User avatar
matej
Licensed Customer
Licensed Customer
 
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

Re: Read camera cmdline params and applying them to a cam node

Postby stratified » Thu May 01, 2014 8:44 am

stratified Thu May 01, 2014 8:44 am
matej wrote:
stratified wrote:You can do this partially. You can't read the normal command line arguments but you can pass a string argument to the script from the command line.

I see. After thinking it through a little more, reading cmd line args. isnt that useful, because you can pass data only for one camera, one resolution, one imager, one frame basically... It's much more flexible & powerfull to save everything you need in a Lua script - that is in my case generated from Blender and then run on Octane start.

Thanks for your help!


Sure, it's more powerful. Of course it's more cumbersome as well because Octane just passes the string verbatim. It's up to the script to fully fledge out the command line arguments.

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

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 18 guests

Fri Apr 19, 2024 11:22 pm [ UTC ]