Read camera cmdline params and applying them to a cam node

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

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
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

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
Tugpsx
Licensed Customer
Posts: 1150
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL
Contact:

Usually when you open in the built-in editor it will echo the command it the status bar as the script is being ran
Win 11 64GB | NVIDIA RTX3060 12GB
User avatar
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

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
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
matej
Licensed Customer
Posts: 2083
Joined: Fri Jun 25, 2010 7:54 pm
Location: Slovenia

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
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
Post Reply

Return to “Lua Scripting”