mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
add sphinx api reference note that menu's layout.operator_context defaults to EXEC_REGION_WIN rather then INVOKE_DEFAULT.
This commit is contained in:
parent
a84e43c48b
commit
35dae4f0b5
2 changed files with 7 additions and 0 deletions
|
|
@ -10,6 +10,12 @@ convention for menus.
|
|||
.. 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
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class ExportSomeData(bpy.types.Operator):
|
|||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue