I want to append some code to the bpy.app.handlers.render_post
operator.
But I need to know whether the bpy.ops.render.render()
operator has been called with the animation
parameter (/argument?) set to True
or False
.
import bpy
def mRenderOutput(scene):
print(getattr(bpy.ops.render.render, "animation"))
#something like: if bpy.ops.render.render.animation == True: do my code
def register():
bpy.app.handlers.render_post.append(mRenderOutput)
def unregister():
bpy.app.handlers.render_post.remove(mRenderOutput)
if __name__ == "__main__":
register()
Unfortunately, this throws:
Traceback (most recent call last): File "C:\Users\morph3us\Desktop\mRenderOutput\mSaveRender001.blend\Text.004", line 4, in mRenderOutput AttributeError: 'BPyOpsSubModOp' object has no attribute 'animation'
So my question: How can I detect in an if clause inside of "mRenderOutput" whether a still image or an animation has been rendered?
bpy.ops.foo.bar
is not an instance of nor the operator class. Have a look atcontext.active_operator
or in the window managers operators collection. $\endgroup$