Page 1 of 1

Read camera cmdline params and applying them to a cam node

Posted: Sat Apr 26, 2014 3:50 pm
by matej
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?

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

Posted: Mon Apr 28, 2014 3:00 pm
by matej
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?

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

Posted: Wed Apr 30, 2014 5:25 am
by Tugpsx
Usually when you open in the built-in editor it will echo the command it the status bar as the script is being ran

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

Posted: Wed Apr 30, 2014 7:49 am
by matej
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.

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

Posted: Wed Apr 30, 2014 8:16 pm
by stratified
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

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

Posted: Thu May 01, 2014 8:18 am
by matej
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!

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

Posted: Thu May 01, 2014 8:44 am
by stratified
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