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.baris not an instance of nor the operator class. Have a look atcontext.active_operatoror in the window managers operators collection. – batFINGER Oct 01 '18 at 16:44I couldnt just check the output file type because of case 3. I couldnt check the timeline length, too, one could also render one still frame from an animation. Also, first rendering an image sequence and renaming when finished is bad, as they wouldnt be renamed at all if the PC gets stuck somewhere in between. But thanks for the suggestion!
– morph3us Oct 08 '18 at 07:09