0
$\begingroup$

I have been attempting to create a simple add-on to assist non-3D colleagues.

Part of the plugin uses markers as filename during the render sequence.

Below is the code that I use to render and save the image.

bpy.ops.render.render('INVOKE_DEFAULT', write_still=True)

But 'INVOKE_DEFAULT' stops the for loop. If I remove the code I don't get to see the render progress.

Is there a solution to view the render progress and save the images?

Here is the section of the code I use render and save the images with the marker names.

def execute(self, context):
    # get the scene
    scn = bpy.context.scene

    # get the output path
    output_path = scn.render.filepath

    # iterate through markers and render
    for k, m in scn.timeline_markers.items():  
        frame = m.frame
        marker_name = m.name
        scn.frame_set(frame)
        scn.render.filepath = os.path.join(output_path, marker_name + "." + scn.render.image_settings.file_format)
        bpy.ops.render.render(write_still=True)

    #reset the output path
    scn.render.filepath = output_path

    return {'FINISHED'}
$\endgroup$
5
  • $\begingroup$ Funny, looks like my take on Is it possible to set the Output name based on the current Timeline marker? 5 years ago :) Anyway, if nothing has changed in latest versions of blender it's tricky making that work properly due to the nature of the render operator. You need a modal operator and catch all potential errors: example. $\endgroup$ – p2or Jan 30 '20 at 14:15
  • $\begingroup$ It is! My version didn't work as good. Thanks for the assist. I been working on a proof of concept to implement blender in a manufacturing company. Was meant to be simple. $\endgroup$ – Sharl Jan 31 '20 at 4:37
  • $\begingroup$ Cool, if I have time I'm going to implement an operator for loom in the next weeks which allows rendering the cameras based on the markers. If you have time, I'd appreciate your help on that. Btw: I don't think you need scn.render.image_settings.file_format, jpg as it was, is just a placeholder and will be overwritten by the file format given in the ui anyway. Cheers! @Sharl $\endgroup$ – p2or Jan 31 '20 at 9:02
  • $\begingroup$ I can give you my feedback but I am not a programmer just a hack :P $\endgroup$ – Sharl Jan 31 '20 at 11:57
  • $\begingroup$ The plugin am working, is just to set the markers as filenames. Everything else is custom UI layout for focused workflow. $\endgroup$ – Sharl Jan 31 '20 at 12:04

Browse other questions tagged or ask your own question.