[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35597] trunk/blender/doc/python_api/ examples: add sphinx api reference note that menu's layout. operator_context defaults to EXEC_REGION_WIN rather then INVOKE_DEFAULT.

Campbell Barton ideasman42 at gmail.com
Thu Mar 17 23:49:47 CET 2011


Revision: 35597
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35597
Author:   campbellbarton
Date:     2011-03-17 22:49:46 +0000 (Thu, 17 Mar 2011)
Log Message:
-----------
add sphinx api reference note that menu's layout.operator_context defaults to EXEC_REGION_WIN rather then INVOKE_DEFAULT.

Modified Paths:
--------------
    trunk/blender/doc/python_api/examples/bpy.types.Menu.py
    trunk/blender/doc/python_api/examples/bpy.types.Operator.2.py

Modified: trunk/blender/doc/python_api/examples/bpy.types.Menu.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.types.Menu.py	2011-03-17 16:40:53 UTC (rev 35596)
+++ trunk/blender/doc/python_api/examples/bpy.types.Menu.py	2011-03-17 22:49:46 UTC (rev 35597)
@@ -10,6 +10,12 @@
 .. note::
 
    Menu subclasses must be registered before referencing them from blender.
+
+.. note::
+   Menu's have their :class:`Layout.operator_context` initialized as
+   'EXEC_REGION_WIN' rather then 'INVOKE_DEFAULT', so if the operator context
+   needs to initialize inputs from the :class:`Operator.invoke` function
+   then this needs to be explicitly set.
 """
 import bpy
 

Modified: trunk/blender/doc/python_api/examples/bpy.types.Operator.2.py
===================================================================
--- trunk/blender/doc/python_api/examples/bpy.types.Operator.2.py	2011-03-17 16:40:53 UTC (rev 35596)
+++ trunk/blender/doc/python_api/examples/bpy.types.Operator.2.py	2011-03-17 22:49:46 UTC (rev 35597)
@@ -39,6 +39,7 @@
 
 # Only needed if you want to add into a dynamic menu
 def menu_func(self, context):
+    self.layout.operator_context = 'INVOKE_DEFAULT'
     self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
 
 # Register and add to the file selector




More information about the Bf-blender-cvs mailing list