7
$\begingroup$

After answering the question Always render the visible objects I realized that, rather than running the script manually, it would be easier to have it run automagically, once, before rendering (that includes the building BVH phase), however, I couldn't find a way to do this. How would that be done?

$\endgroup$

1 Answer 1

7
$\begingroup$

You should be able to do this be adding a function to:

bpy.app.handlers.render_pre.append(function_name)

This way whatever function you name will be called before the render happens. Here is a little info on it: link

Make sure your function takes self as a parameter, like so:

function_name(self): print("Test")

$\endgroup$
1
  • $\begingroup$ You need to have def unhide(self):, then it works. $\endgroup$ Jan 14, 2015 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .