Hey everyone,
So I am jumping into scripting. I want to create a script for batch rendering. I am new to this... But I have watched a few videos on it now. I am stuck. I can get it to open the octane viewport and render and saves the file. Yay go me.
I am using the octane save animation command so it automatically uses my settings I have set and saves to that location set. (I plan on setting this manually the better I get with the octane save command and this question might enable that too)
But how to I get it to close the viewport after it reaches max samples or do anything after it reaches max samples? I tried looking into how it switched after it finished a frame (because it obviously reached max samples before it switched) but couldn't find anything.
I was trying some types of if statements but kept getting errors..
Thats what I have now, but I get an error because I know its trying to quit the app (I had close scene before too) before it hits the max samples... If I can get it to reach max samples before moving on, it would solve a few headaches for me.
lx.eval("octane.openViewport")
lx.eval("octane.command animate")
lx.eval("app.quit")
I am by no means trying to make something to sell or distribute. Just a down and dirty script for me to queue a bunch of stills or animations if I tweak the code.
Thanks!
Octane - Modo Batch Rendering Script
Moderator: face_off
It keeps failing when I bring in lines like this from the commands
lx.eval(octane.renderAndSave png8 "C:\Users\-----\Desktop\testing\untitled")
I am guessing I am formatting that wrong... I read somewhere if you put lx.eval in front of whatever the command was it should work. But I am guessing that isn't the case for octane. But it did work with the lx.eval("octane.openViewport")
and lx.eval("octane.command animate") commands.
Edit - I have everything running exactly how I want, but its just still not saving the actual file... Here is the line of code for rendering and savings
lx.eval("octane.renderAndSave png8 {C:\Users\-----\Desktop\testing\untitled.png}") What am I doing wrong?!
Is there anymore documentation on this process at all by any chance? Like Modo-Octane coding? I know that's pretty specific..
lx.eval(octane.renderAndSave png8 "C:\Users\-----\Desktop\testing\untitled")
I am guessing I am formatting that wrong... I read somewhere if you put lx.eval in front of whatever the command was it should work. But I am guessing that isn't the case for octane. But it did work with the lx.eval("octane.openViewport")
and lx.eval("octane.command animate") commands.
Edit - I have everything running exactly how I want, but its just still not saving the actual file... Here is the line of code for rendering and savings
lx.eval("octane.renderAndSave png8 {C:\Users\-----\Desktop\testing\untitled.png}") What am I doing wrong?!
Is there anymore documentation on this process at all by any chance? Like Modo-Octane coding? I know that's pretty specific..
Win 10, Threadripper Pro, Dual 3090s
Sorry for the late reply. It would be great it you could share some of your code once done, as it might be useful to others.
Thanks
Paul
Thanks
Paul
Win7/Win10/Mavericks/Mint 17 - GTX550Ti/GT640M
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
Its really down and dirty right now but it works. VERY MINIMAL TESTING TOO. So don't go crazy on me if something breaks. I am going to work on making it easier to setup too but for now, it will work in a pinch. There's your disclaimer.
Also, be sure to open a fresh scene of modo with the octane viewport closed, otherwise you will get an error.
in the #Opens the scene line, you need to set the name of the project file and
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/cbe.lxo} normal") <--- Change that to your first project file. IF YOU COPY AND PASTE FROM WINDOWS EXPLORER BE SURE TO CHANGE THE "\"'s to "/"s.
#Renders current scene be sure to change the file type here "png8" to whatever you want it to be. Then also where you want to write the file to and file name. Once again change the \ to /.
lx.eval("octane.renderAndSave png8 {C:/Users/-----/Desktop/testing/untitled.png}")
Then just copy and paste for more and more scenes. BUTTTTT in the second section of code, be sure to not include the code -
#Opens Octane Render Viewport
lx.eval("octane.openViewport")
Because the viewport will already be open. So when you copy and paste either take that out, or just use what I have because its already out.
And thats it, its pretty simple, especially if you save as the scenes to a single location, then you can easily copy and paste the scene locations.
Like I said, I haven't done much testing. But it uses mostly octane commands that are preset and work well.
My next step is to include animation into the code.
And my disclaimer again - I am no means a coder by any stretch of the imagination, this is my first script and it actually solves a very large problem for me, so I will hopefully stick with it and make this better.
Also, another thing that I found great is, this is opening in the background and a progress bar pops up for the rendering status in samples. I am sure Paul knows why this is, but its super awesome, because it doesn't take time to open the scene. I have no idea how that works though, but its awesome
.
Next step is to include a line of code for animations to work in tandem with stills. I will report when I finish it, ha, IF I finish it without pulling my hair out.
Enjoy!
HERES THE FINAL CODE TO ADD MORE COPY AND PASTE THE SECOND BLOCK OF CODE!
#Batch Rendering Script
#Opens the scene
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/cbe.lxo} normal")
#Opens Octane Render Viewport
lx.eval("octane.openViewport")
#Renders current scene
lx.eval("octane.renderAndSave png8 {C:/Users/-----/Desktop/testing/untitled.png}")
#Close current scene
lx.eval("scene.close")
#Next Render
#Opens next scene
lx.eval("scene.open {C:/Users/----/Desktop/Temp/longer.lxo} normal")
#Renders - Viewport is already open from first render.
lx.eval("octane.renderAndSave png8 {C:/Users/----/Desktop/testing/longer.png}")
#Closes Current Scene
lx.eval("scene.close")
Also, be sure to open a fresh scene of modo with the octane viewport closed, otherwise you will get an error.
in the #Opens the scene line, you need to set the name of the project file and
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/cbe.lxo} normal") <--- Change that to your first project file. IF YOU COPY AND PASTE FROM WINDOWS EXPLORER BE SURE TO CHANGE THE "\"'s to "/"s.
#Renders current scene be sure to change the file type here "png8" to whatever you want it to be. Then also where you want to write the file to and file name. Once again change the \ to /.
lx.eval("octane.renderAndSave png8 {C:/Users/-----/Desktop/testing/untitled.png}")
Then just copy and paste for more and more scenes. BUTTTTT in the second section of code, be sure to not include the code -
#Opens Octane Render Viewport
lx.eval("octane.openViewport")
Because the viewport will already be open. So when you copy and paste either take that out, or just use what I have because its already out.
And thats it, its pretty simple, especially if you save as the scenes to a single location, then you can easily copy and paste the scene locations.
Like I said, I haven't done much testing. But it uses mostly octane commands that are preset and work well.
My next step is to include animation into the code.
And my disclaimer again - I am no means a coder by any stretch of the imagination, this is my first script and it actually solves a very large problem for me, so I will hopefully stick with it and make this better.
Also, another thing that I found great is, this is opening in the background and a progress bar pops up for the rendering status in samples. I am sure Paul knows why this is, but its super awesome, because it doesn't take time to open the scene. I have no idea how that works though, but its awesome

Next step is to include a line of code for animations to work in tandem with stills. I will report when I finish it, ha, IF I finish it without pulling my hair out.
Enjoy!

HERES THE FINAL CODE TO ADD MORE COPY AND PASTE THE SECOND BLOCK OF CODE!
#Batch Rendering Script
#Opens the scene
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/cbe.lxo} normal")
#Opens Octane Render Viewport
lx.eval("octane.openViewport")
#Renders current scene
lx.eval("octane.renderAndSave png8 {C:/Users/-----/Desktop/testing/untitled.png}")
#Close current scene
lx.eval("scene.close")
#Next Render
#Opens next scene
lx.eval("scene.open {C:/Users/----/Desktop/Temp/longer.lxo} normal")
#Renders - Viewport is already open from first render.
lx.eval("octane.renderAndSave png8 {C:/Users/----/Desktop/testing/longer.png}")
#Closes Current Scene
lx.eval("scene.close")
Win 10, Threadripper Pro, Dual 3090s
Hey Paul so I have this simple code for animations, but it keeps wanting to close before the animation is done. Which makes sense. Any idea on how I can have it wait until the animation is completel before it tries to close the scene. Then it should be easy to implement into having stills and animations in the same script.
#Opens next scene
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/longeranimated.lxo} normal")
#Renders - Viewport is already open from first render.
lx.eval("octane.command animate")
#Closes Current Scene
lx.eval("scene.close")
#Opens next scene
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/longeranimated.lxo} normal")
#Renders - Viewport is already open from first render.
lx.eval("octane.command animate")
#Closes Current Scene
lx.eval("scene.close")
Win 10, Threadripper Pro, Dual 3090s
I am midway through trying to get the plugin working with Octane 2020.2, so cannot run it at the moment, but you could try something like the following to close the viewport:LFedit wrote:Hey Paul so I have this simple code for animations, but it keeps wanting to close before the animation is done. Which makes sense. Any idea on how I can have it wait until the animation is completel before it tries to close the scene. Then it should be easy to implement into having stills and animations in the same script.
#Opens next scene
lx.eval("scene.open {C:/Users/-----/Desktop/Temp/longeranimated.lxo} normal")
#Renders - Viewport is already open from first render.
lx.eval("octane.command animate")
#Closes Current Scene
lx.eval("scene.close")
Code: Select all
layout.createOrClose octaneRenderViewportFrameCookie octaneViewportLayout title:{OctaneRender Viewport} persistent:true style:standard width:600 height:40
Paul
Win7/Win10/Mavericks/Mint 17 - GTX550Ti/GT640M
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
Thanks Paul, no worries. Its not a big deal for me to keep the viewport open. My problem is the scene close command is running right away when I run the animate command, instead of waiting for the render to finish. The stills command renders and doesn't move on to close scene until its done rendering and saved. But the octane animate command is letting the close scene command run right away. I need some way to make it wait until the entire animation is complete before it runs the close scene command.
Thanks!
Thanks!
Win 10, Threadripper Pro, Dual 3090s
Yes - the python script does not get blocked by the 'octane.command animate' command, so terminates with the scene close. I think the way around this is check the current Modo frame every second, and once it is the last frame, you know the animation is complete.LFedit wrote:Thanks Paul, no worries. Its not a big deal for me to keep the viewport open. My problem is the scene close command is running right away when I run the animate command, instead of waiting for the render to finish. The stills command renders and doesn't move on to close scene until its done rendering and saved. But the octane animate command is letting the close scene command run right away. I need some way to make it wait until the entire animation is complete before it runs the close scene command.
Thanks!
Paul
Win7/Win10/Mavericks/Mint 17 - GTX550Ti/GT640M
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
Octane Plugin Support : Poser, ArchiCAD, Revit, Inventor, AutoCAD, Rhino, Modo, Nuke
Pls read before submitting a support question
- Hesekiel2517
- Posts: 457
- Joined: Mon Nov 23, 2015 10:57 pm
I don't know if that helps, but "Render Monkey" is open source https://github.com/9bstudios/mecco_renderMonkey maybe this is a great foundation for a octane Batch render utility.