Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/python_api/examples/bpy.ops.2.py')
-rw-r--r--doc/python_api/examples/bpy.ops.2.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.ops.2.py b/doc/python_api/examples/bpy.ops.2.py
new file mode 100644
index 00000000000..86b7438888c
--- /dev/null
+++ b/doc/python_api/examples/bpy.ops.2.py
@@ -0,0 +1,18 @@
+"""
+Overriding Context
+++++++++++++++++++
+
+It is possible to override context members that the operator sees, so that they
+act on specified rather than the selected or active data, or to execute an
+operator in the different part of the user interface.
+
+The context overrides are passed as a dictionary, with keys matching the context
+member names in bpy.context. For example to override bpy.context.active_object,
+you would pass {'active_object': object}.
+"""
+
+# remove all objects in scene rather than the selected ones
+import bpy
+override = {'selected_bases': list(bpy.context.scene.object_bases)}
+bpy.ops.object.delete(override)
+