From da14a482f281e8d330ef5210ef22335a43eb726c Mon Sep 17 00:00:00 2001 From: Diptangshu Dey Date: Tue, 16 Nov 2021 10:45:23 +0100 Subject: Fix T90866: Python operator templates are not accessible from menus Python Operator templates made accessible from respective menus (required to also use F3 search for quick access) Also fixed Modal Draw Operator id_name (had duplicate name from other template) Maniphest Tasks: T90866 Differential Revision: https://developer.blender.org/D13182 --- doc/python_api/examples/bpy.types.Operator.4.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/python_api/examples/bpy.types.Operator.4.py') diff --git a/doc/python_api/examples/bpy.types.Operator.4.py b/doc/python_api/examples/bpy.types.Operator.4.py index 6b74a96eb2b..00c9cd250b1 100644 --- a/doc/python_api/examples/bpy.types.Operator.4.py +++ b/doc/python_api/examples/bpy.types.Operator.4.py @@ -41,8 +41,13 @@ class CustomDrawOperator(bpy.types.Operator): col.prop(self, "my_string") +# Only needed if you want to add into a dynamic menu +def menu_func(self, context): + self.layout.operator(CustomDrawOperator.bl_idname, text="Custom Draw Operator") +# Register and add to the object menu (required to also use F3 search "Custom Draw Operator" for quick access) bpy.utils.register_class(CustomDrawOperator) +bpy.types.VIEW3D_MT_object.append(menu_func) # test call bpy.ops.object.custom_draw('INVOKE_DEFAULT') -- cgit v1.2.3