My problem is I had to write custom modal Render Animation operator for my add-on because using the original one together with my add-on crashes Blender. My operator makes some changes in the scene, changes the current frame, launches bpy.ops.render.render('INVOKE_DEFAULT', animation=False, write_still=True), waits until the render is finished with use of bpy.app.handlers - and repeats this process until all the frames in the scene are rendered. The operator itself works fine, but once bpy.ops.render.render is called with write_still == True Blender somehow stores this choice in the memory and the original Blender's Render Image button also starts to save the render result to the file after the render, although it should not by default. It is not so obvious and may ruin some user's progress so I would like to prevent it, if possible.

The question is - is there a way to set bpy.ops.render.render() write_still argument back to False without another unnecessary call of the render operator? I've been thinking of changing it directly somewhere in the bpy.types.RENDER_OT_render.properties but as you may know bpy.ops.render.render() is not a Python operator and it is not registered in bpy.types.

For now the only solution I see is to remember original Render Samples and Scene Resolution settings, render just 1 pixel with 1 sample with write_still=False and then set Scene settings back. But from my previous experience I know that such ultra-fast renders with changing Scene settings there and back may lead to crashes because of C internal errors which can not be handled from the Python API, and the probability is pretty high. So I hope there is a way to set write_still to False in some proper way. Any suggestions?


1 Answer 1



If the operator has been called previously to retrieve the settings when last called

>>> props = C.window_manager.operator_properties_last("render.render")
>>> props
<bpy_struct, RENDER_OT_render at 0x7fe35d131fa8>

>>> props.write_still

If the operator has not been called, props will have value None

Press F12 it uses this setting. Outputs to system console.

Saved: '/tmp/xxx.png'
 Time: 00:00.63 (Saving: 00:00.12)


>>> props.write_still = False

press F12 again and now it's off.

How can I access view3d.select_circle radius value?

Is there a way to access a bpy.types.Operator value

Accessing Transform Operator History inclusive constraint_axis in Python script

  • $\begingroup$ When this is done from inside the modal operator, right before return {'FINISHED'}, write_still in the scene becomes True again. I found out that this can be solved with adding a function to depsgraph_update_post handler which once sets write_still to False if it becomes True and removes itself from the handler. $\endgroup$ Sep 8, 2021 at 8:49
  • 1
    $\begingroup$ also consider render_complete handler, (would normally say don't mix handlers and context .. the window manager is possibly one exception) , or via a bpy.app.timer as tacked on here to kill a draw callback blender.stackexchange.com/a/237437/15543 $\endgroup$
    – batFINGER
    Sep 8, 2021 at 9:09
  • $\begingroup$ write_still in my operator changes after render_complete, so unfortunately it doesn't help, while bpy.app.timers should do the trick, although I haven't tested it yet. $\endgroup$ Sep 8, 2021 at 11:51

You must log in to answer this question.

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