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
This commit is contained in:
Diptangshu Dey
2021-11-16 10:45:23 +01:00
committed by Philipp Oeser
parent 7d985d6b69
commit da14a482f2
18 changed files with 76 additions and 6 deletions

View File

@@ -31,13 +31,17 @@ class ModalTimerOperator(bpy.types.Operator):
wm = context.window_manager
wm.event_timer_remove(self._timer)
def menu_func(self, context):
self.layout.operator(ModalTimerOperator.bl_idname, text=ModalTimerOperator.bl_label)
def register():
bpy.utils.register_class(ModalTimerOperator)
bpy.types.VIEW3D_MT_view.append(menu_func)
# Register and add to the "view" menu (required to also use F3 search "Modal Timer Operator" for quick access)
def unregister():
bpy.utils.unregister_class(ModalTimerOperator)
bpy.types.VIEW3D_MT_view.remove(menu_func)
if __name__ == "__main__":