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
path: root/doc
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-02-14 20:26:34 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-02-14 20:27:35 +0300
commita9813f23802c54bb102df2c5f11ab1621fb707c1 (patch)
tree016a79ee6a52cc9e5afa40fb6a3269316c93fd2e /doc
parent1538f526e9fbd011ff9e1ebd325862819bec85cf (diff)
Tweak doc section about overriding context - point out context.copy() usage!
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bpy.ops.1.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/python_api/examples/bpy.ops.1.py b/doc/python_api/examples/bpy.ops.1.py
index b4137e5c740..d89a1360c1c 100644
--- a/doc/python_api/examples/bpy.ops.1.py
+++ b/doc/python_api/examples/bpy.ops.1.py
@@ -10,9 +10,14 @@ 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}``.
+
+.. note::
+ You will nearly always want to use a copy of the actual current context as basis
+ (otherwise, you'll have to find and gather all needed data yourself).
"""
# remove all objects in scene rather than the selected ones
import bpy
-override = {'selected_bases': list(bpy.context.scene.object_bases)}
+override = bpy.context.copy()
+override['selected_bases'] = list(bpy.context.scene.object_bases)
bpy.ops.object.delete(override)