[Bf-blender-cvs] [a9813f2] master: Tweak doc section about overriding context - point out context.copy() usage!

Bastien Montagne noreply at git.blender.org
Sun Feb 14 18:27:51 CET 2016


Commit: a9813f23802c54bb102df2c5f11ab1621fb707c1
Author: Bastien Montagne
Date:   Sun Feb 14 18:26:34 2016 +0100
Branches: master
https://developer.blender.org/rBa9813f23802c54bb102df2c5f11ab1621fb707c1

Tweak doc section about overriding context - point out context.copy() usage!

===================================================================

M	doc/python_api/examples/bpy.ops.1.py

===================================================================

diff --git a/doc/python_api/examples/bpy.ops.1.py b/doc/python_api/examples/bpy.ops.1.py
index b4137e5..d89a136 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)




More information about the Bf-blender-cvs mailing list