Run python scripts in a Custom ROP OTL

   8016   6   1
User Avatar
Member
58 posts
Joined: Sept. 2009
Offline
Is there a way what I run python scripts when a custom ROP OTL is running (rendering)?

I have tried to create a button which has a callback script and the button links to the render button( which is gray out in the type properties ), so the callback script runs when the render button is pushed. However, if I run a Hscript “render” on that custom ROP, this will just execute the render operation and has no effect on my button, which means no callback script runs as I expect.

basically, what I want is something like python type OTL ROP. and can be executed by Hscript “render” command.
User Avatar
Member
7715 posts
Joined: July 2005
Offline
Why not just use the pre-render script parm?
User Avatar
Member
58 posts
Joined: Sept. 2009
Offline
edward
Why not just use the pre-render script parm?

Pre-render script requires a ROP as a base which I want that is my ROP OTL. I do not want to add the script in a Mantra ROP or Geometry ROP because I do not need to render out any image or bgeo. All I need is get the values from the OTL parm and pass it to my script.
User Avatar
Member
7715 posts
Joined: July 2005
Offline
Use a Shell ROP then with an empty shell command and use the Pre-Render Script parm.
User Avatar
Member
58 posts
Joined: Sept. 2009
Offline
this is a good idea! thank you!

but I am still wondering is there a way we can make our own ROP otl being executed by render command in hscrip?
User Avatar
Member
383 posts
Joined: June 2010
Offline
Just stumbled about the same problem .. is the shell rop still the way to go or is there a more “elegant” solution ??
www.woogieworks.at
User Avatar
Member
23 posts
Joined: April 2013
Offline
Okay. This was driving me crazy and this thread kept popping up. Here's the solution I found.

Version: H15.5.480

Scenerio: Created a new Output Driver via the New Operator Type prompt. Need to attach the “Render to Disk” button to a python script, but the callback script option is disabled.

Solution:

1. Open up the type properties pane
2. Add a file parameter with the name “soho_program”
3. Assuming you have a PythonModule setup in the scripts section, type “opdef:.?PythonModule” into the field
4. Add a file parameter with the name “soho_outputmode”
5. Type “2” into the field

Now that “Render to Disk” button will run the PythonModule defined in the scripts tab. “soho_program” defines the python script that'll run. Output mode 2 will prevent anything special happening on stdout.

I still need to test it more, but I typed this up as soon as I got a print statement through.

Edit: If you need to pass in the current node, you can use hou.pwd() to get the current node. Essentially that operator is your current working directory.

Recommended reading: SOHO [sidefx.com], opdef: [sidefx.com]
Edited by sburrichter - Oct. 21, 2016 14:16:34
  • Quick Links