This thread if for discussion and assistance of Modo scripts that interface/interact with the plugin.
Post here if you would like to share a script you have written, if you would like to request a specific script be written, or if you need help with a script you are writing.
I am sure there are expert Modo python users here, so it would be great to have their input (as I am a C++ guy!). Over time we can get a library of scripts that the community can share, use, and modify for their own needs.
viewtopic.php?f=34&t=78755&p=426557#p426557 - Assign a weightmap with unique values to selected meshes. You can then use these with a greyscale vertex attribute texture in octane
very cool idea to share some octane related scripts. I'm very new to scripting, but solved a few of my problems with python.
I often have multiple shots in one Modo scene, which I store in actions. These Shots have different frameranges, which i write in the first and last frame channel in the render item.
The octane plugin always render the current timeframe. So this script reads the values of the current action and sets the timerange accordingly.
#python
import modo
import lx
render = modo.Item('Render')
fpslst = [['film',24],['pal',25]]
first = float(render.channel('first').get())
last = float(render.channel('last').get())
fps = lx.eval('time.fps ?')
for cnt in range(0,len(fpslst)):
if fps == fpslst[cnt][0]:
fps = fpslst[cnt][1]
last = last/fps
first = first/fps
lx.eval('time.range current in:%s' % (first))
lx.eval('time.range current out:%s' % (last))
Re: OctaneRender for Modo SCRIPTS
Posted: Mon Nov 22, 2021 12:23 pm
by Hesekiel2517
Here is an unfinished script for batchrendering in octane for modo. Maybe there are some python experts, who want to help me with this.
Maybe you can also share your thoughts on this. Is this a good approach, do you have any workflow suggestions etc..
It's based on the great lua script, which can be found here: [url]https://render.otoy.com/forum
/viewtopic.php?f=73&t=70855[/url]
#python
import modo
import lx
def customfile(type, title, format, uname, ext, save_ext=None, path=None):
''' Custom file dialog wrapper function
type : Type of dialog, string value, options are 'fileOpen' or 'fileSave'
title : Dialog title, string value.
format: file format, tuple of string values
uname : internal name
ext : tuple of file extension filter strings
save_ext: output file extension for fileSave dialog
path : optional default loacation to open dialog
'''
lx.eval("dialog.setup %s" % type)
lx.eval("dialog.title {%s}" % (title))
lx.eval("dialog.fileTypeCustom {%s} {%s} {%s} {%s}" % (format, uname, ext, save_ext))
if type == 'fileSave' and save_ext != None:
lx.eval("dialog.fileSaveFormat %s extension" % save_ext)
if path != None:
lx.eval('dialog.result {%s}' % path)
try:
lx.eval("dialog.open")
return lx.eval("dialog.result ?")
except:
return None
#Static Data
octane_url = "C:\Program Files\OTOY\OctaneRender Enterprise 2021.1\octane.exe" #insert Octane.exe URL
batchscript_url = "D:\\006_Scripslibrary\\04_Octane\\cmdBatchRender_2020.2.lua" #insert Sript URL
format = "EXR_16"
#Write Batch File
batchfile = customfile('fileSave', 'Save Batch File', ('BAT',), 'batch file', ('*.bat',),'bat') #choose Filename and Location of the Batchfile
orbxfile = customfile('fileSave', 'Save Orbx File', ('ORBX',), 'orbx file', ('*.orbx',),'orbx') #choose Filename and Location of the Orbxfile
render_url = str(customfile('fileSave', 'Save EXR File', ('EXR',), 'exr file', ('*.exr',),'exr')) #choose Filename and Location of the rendered Images
render_url = render_url.rstrip('.exr') #remove File Extension from URL
#Open Batch Textfile
f= open(batchfile,"a+")
#Add Line
line = '"'+octane_url+'" '+'"'+orbxfile+'" '+"--no-gui --script "+batchscript_url+" -A "+render_url+" "+format
f.write("%s\n" % (line))
#Close File
f.close()
#Export Orbx
lx.eval('octane.saveAnimation "%s"' % (orbxfile))
Re: OctaneRender for Modo SCRIPTS
Posted: Tue Nov 23, 2021 2:30 am
by face_off
Here is an unfinished script for batchrendering in octane for modo. Maybe there are some python experts, who want to help me with this.
Maybe you can also share your thoughts on this. Is this a good approach, do you have any workflow suggestions etc..
It's based on the great lua script, which can be found here: [url]https://render.otoy.com/forum
/viewtopic.php?f=73&t=70855[/url]
Did you perhaps miss uploading the script? The video on it's own does not mean much to me, sorry.
Paul
Re: OctaneRender for Modo SCRIPTS
Posted: Tue Dec 07, 2021 5:06 am
by face_off
face_off wrote:
Here is an unfinished script for batchrendering in octane for modo. Maybe there are some python experts, who want to help me with this.
Maybe you can also share your thoughts on this. Is this a good approach, do you have any workflow suggestions etc..
It's based on the great lua script, which can be found here: [url]https://render.otoy.com/forum
/viewtopic.php?f=73&t=70855[/url]
Did you perhaps miss uploading the script? The video on it's own does not mean much to me, sorry.
Paul
I see your script now. In general, I would have thought it easier to do this sort of rendering within the plugin. I will post a sample script below....
Paul
Re: OctaneRender for Modo SCRIPTS
Posted: Tue Dec 07, 2021 5:11 am
by face_off
Following is a very simple script to render all the Passes from the currently selected Pass Groups. Change the "filename" as required. This is had no testing, so please leave feedback here with your findings.
Hey Paul,
thank you for the script! Looks great. Batch rendering in Standalone has a few advantages in my opinion:
First of all you can start rendering while working on the scene and prepare the next shot and add that to the list. Its easy to change the order of the shots to render and it's very easy to override certain settings for all shots (like max samples). Also you can add a shutdown command (I guess this is also possible in modo).
Re: OctaneRender for Modo SCRIPTS
Posted: Sun Dec 12, 2021 10:13 am
by face_off
Hesekiel2517 wrote:Hey Paul,
thank you for the script! Looks great. Batch rendering in Standalone has a few advantages in my opinion:
First of all you can start rendering while working on the scene and prepare the next shot and add that to the list. Its easy to change the order of the shots to render and it's very easy to override certain settings for all shots (like max samples). Also you can add a shutdown command (I guess this is also possible in modo).
Good points. If you have something specific you need to add to your script, let me know, and I can take a look.
Paul
Re: OctaneRender for Modo SCRIPTS
Posted: Wed Dec 15, 2021 9:22 am
by BartvanDoornik
Hi,
awesome script if i could understand scripting.
I am kinda suprised this is not in the Plugin itself. I would love to have a dedicated button in the Octane menu/Octane renderwindow. Coming from Vray this is all in there and really handy if you need to render lots of takes.
Would be awesome if we can have a Render from Pass group popup like in Modo.
Hope you can build this in natively in Octane.
Thanks,
Bart
Re: OctaneRender for Modo SCRIPTS
Posted: Tue Feb 15, 2022 5:52 am
by face_off
Here is a script to move all the Octane Override assemblies into a separate Group to they do not clutter the Workspaces dropbox box (as requested at viewtopic.php?f=34&t=79237)
import modo
scene = modo.Scene()
scene_service = lx.service.Scene()
octane_override_type = scene_service.ItemTypeLookup("material.octaneRenderer")
# Build a list of assembly groups to move
list_of_groups_to_move = []
for group in scene.groups:
for item in group.items:
if item.TestType(octane_override_type):
list_of_groups_to_move.append(group.name)
# Create the Octane Materials group if it does not already exist
try:
octane_materials_group = modo.item.Group('Octane Materials')
except:
octane_materials_group = scene.addGroup(name='Octane Materials')
# Process the list_of_groups_to_move list and set the groups parents to "Octane Materials"
for group_name in list_of_groups_to_move:
group_item = modo.item.Group(group_name)
group_item.SetParent(octane_materials_group)