Execute python code after a "Render to Disk in Background"

   335   4   0
User Avatar
Member
4 posts
Joined: Dec. 2021
Offline
Hello!

I'm trying to execute a function after a render "in background" has finished (on nodes like mantra or filecache).
I can launch the "Render to Disk in Background" in python using something like:
hou.hscript('opparm -c /out/mantra executebackground')
But I don't know how to have a callback or something when the render is over.
Does somebody know how to do it?
Thanks!
User Avatar
Member
2197 posts
Joined: June 2008
Offline
ROP nodes offer a Scripts tab where you can execute code before/after the render of the frame. Take a look there.
Using Houdini Indie 19.5.
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
4 posts
Joined: Dec. 2021
Offline
Interesting, I didn't know. The "filecache" and "mantra" node indeed have a Script tab (sadly not the rop_alembic node).
The Scripts do work in "Save to Disk", but in both nodes they don't activate in "Save to Disk in Background" it seems...
User Avatar
Member
5990 posts
Joined: Sept. 2011
Online
Aquakwak
The Scripts do work in "Save to Disk", but in both nodes they don't activate in "Save to Disk in Background" it seems...

They do, but in the background. Are you looking for a way to execute scripts in the foreground when a background task completes? I think the only way would be to use a PDG task graph.
User Avatar
Member
4 posts
Joined: Dec. 2021
Offline
Hi! Thanks for the answer.
Do you know how to debug "background" task? In terminal or inside houdini's Python Shell I have no result for prints to see if it's working or not.
Also like you said executing scripts in foreground looks interesting, do you know where I can find tuts or infos about PDG task graph? It's the first time I hear about it and I don't find much online.

Thanks!
  • Quick Links