DeprecationWarning: Passing in context overrides is deprecated in favor of Context.temp_override(..), calling "object.modifier_apply"
bpy.ops.object.modifier_apply({"object": obj}, modifier="Boolean")
In Blender 3.2+ there was added new method for context temp_override
that can be used to override some elements of the context and suppose to be used with “with block”. Which is very convenient - makes code more readable and it’s easier to use a chain of operators in the same context.
Previously (<3.2) it was possible to pass dictionary with paramaters to override elements of the context.
kwargs = {'selected_objects': [bpy.data.objects['Camera']]}
# 3.2+
with bpy.context.temp_override(**kwargs):
bpy.ops.transform.translate(value=(0, 3.10345, 0), orient_axis_ortho='X')
# <3.2
bpy.ops.transform.translate(kwargs, value=(0, 3.10345, 0), orient_axis_ortho='X')
But the problem is that they are not interchangable - I mean you can’t write some code that would work on both all blender versions and won’t throw warnings at you.
QUESTION. When the old method is going to be deprecated and we’ll need to stick to the one method? On blender.org it says that 2.93 will be part of Long-term Support until June 2023. The other blender version in LTSC is 3.3 which already has temp_override
. So is it like the method will be deprecated in Blender 3.6 which is planned to be released in June 2023 also?