I am still messing around with Matt Ebb’s 3Delight RIB exporter. I realize this is not directly Renderman related but I did add this as a new feature to the exporter. The ability to run a piece of python code before the render occurs. So it is not a frame change event that will interact with scene. But it is a place where you can run some code before a render.
The way it works is you simply name a text document in the text window pre-render.py as noted in green highlight in the image below. An error message will appear in the console if the supplied code has any errors.
Then when you render via F12 or CTRL-F12 your code gets run before any RIB export occurs. The results of the code working are highlighted in orange in the image below.
I was not aware of any handlers in place. When I search on “bpy.app.handlers.render_pre” in the API I find no reference.
So how would you code them? If they do exist then they probably are already working in the existing 3Delight exporter. I guess my special check in the code makes it easy to just put your code in the specially named python script for execution. I don’t really have a use for it yet, but I was just curious to see if I could get it to work.
they are quite new thats probably the reason that they’re yet missing in the docs. I guess you just create your python function and then register it with bpy.app.handlers.render_pre.append(funcName).