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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-28 12:17:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-28 12:17:28 +0400
commitedf244cbf70d569484b937f58aa9fd69b4243bd5 (patch)
tree6b5db10bcfc03797db976bfaf29153fb91065da8 /doc/python_api/examples/bpy.ops.2.py
parent20e854bb16b0a1063ae413288fe46a232640cfbb (diff)
document calling operators with undo enabled.
Diffstat (limited to 'doc/python_api/examples/bpy.ops.2.py')
-rw-r--r--doc/python_api/examples/bpy.ops.2.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/doc/python_api/examples/bpy.ops.2.py b/doc/python_api/examples/bpy.ops.2.py
index 575d020a5a0..01e7dc1902e 100644
--- a/doc/python_api/examples/bpy.ops.2.py
+++ b/doc/python_api/examples/bpy.ops.2.py
@@ -1,17 +1,22 @@
"""
-Overriding Context
-++++++++++++++++++
+Execution 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.
+When calling an operator you may want to pass the execution context.
-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}.
+This determines the context thats given to the operator to run in, and weather
+invoke() is called or execute().
+
+'EXEC_DEFAULT' is used by default but you may want the operator to take user
+interaction with 'INVOKE_DEFAULT'.
+
+The execution context is as a non keyword, string argument in:
+('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS',
+'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT',
+'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA',
+'EXEC_SCREEN')
"""
-# remove all objects in scene rather than the selected ones
+# group add popup
import bpy
-override = {'selected_bases': list(bpy.context.scene.object_bases)}
-bpy.ops.object.delete(override)
+bpy.ops.object.group_instance_add('INVOKE_DEFAULT') \ No newline at end of file