PyAPI: remove context override argument from bpy.ops

Remove deprecated context override argument to operator execution and
poll() method in favor of context.temp_override().
This commit is contained in:
Campbell Barton
2023-05-23 14:34:09 +10:00
parent ab5fc46872
commit ac263a9bce
8 changed files with 79 additions and 164 deletions

View File

@@ -20,7 +20,7 @@ you would pass ``{'active_object': object}`` to :class:`bpy.types.Context.temp_o
# Remove all objects in scene rather than the selected ones.
import bpy
from bpy import context
override = context.copy()
override["selected_objects"] = list(context.scene.objects)
with context.temp_override(**override):
context_override = context.copy()
context_override["selected_objects"] = list(context.scene.objects)
with context.temp_override(**context_override):
bpy.ops.object.delete()

View File

@@ -27,17 +27,11 @@ Keywords and Positional Arguments
For calling operators keywords are used for operator properties and
positional arguments are used to define how the operator is called.
There are 3 optional positional arguments (documented in detail below).
There are 2 optional positional arguments (documented in detail below).
.. code-block:: python
bpy.ops.test.operator(override_context, execution_context, undo)
- override_context - ``dict`` type.
.. deprecated:: 3.2
:class:`bpy.types.Context.temp_override` should be used instead of this argument.
bpy.ops.test.operator(execution_context, undo)
- execution_context - ``str`` (enum).
- undo - ``bool`` type.