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$
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$
  • $\begingroup$ You need to have def unhide(self):, then it works. $\endgroup$ – BlendingJake Jan 14 '15 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.