diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-11-16 12:57:26 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-11-16 12:57:26 +0300 |
commit | 7da714f387d6708f844fd9ab7fa552283a173877 (patch) | |
tree | 6ec2b4f4a838dff675d981843751dc55b25fde15 /doc/python_api/examples/bpy.types.Operator.5.py | |
parent | d4c868da9f97a06c3457b8eafd344a23ed704874 (diff) | |
parent | da14a482f281e8d330ef5210ef22335a43eb726c (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'doc/python_api/examples/bpy.types.Operator.5.py')
-rw-r--r-- | doc/python_api/examples/bpy.types.Operator.5.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.Operator.5.py b/doc/python_api/examples/bpy.types.Operator.5.py index f1880a70018..a0b4a6d6841 100644 --- a/doc/python_api/examples/bpy.types.Operator.5.py +++ b/doc/python_api/examples/bpy.types.Operator.5.py @@ -55,8 +55,13 @@ class ModalOperator(bpy.types.Operator): context.window_manager.modal_handler_add(self) return {'RUNNING_MODAL'} +# Only needed if you want to add into a dynamic menu +def menu_func(self, context): + self.layout.operator(ModalOperator.bl_idname, text="Modal Operator") +# Register and add to the object menu (required to also use F3 search "Modal Operator" for quick access) bpy.utils.register_class(ModalOperator) +bpy.types.VIEW3D_MT_object.append(menu_func) # test call bpy.ops.object.modal_operator('INVOKE_DEFAULT') |