mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
Create submenus for common template types in the text editor as the menu was getting too long. Common categories such as Gizmo, UI & Operators are now in their own directories, displayed as submenus. Menu.menu_path now supports expanding sub-menus recursively. Ref !154643
31 lines
769 B
Python
31 lines
769 B
Python
import bpy
|
|
from bpy.types import Menu
|
|
|
|
# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
|
|
|
|
|
|
class VIEW3D_MT_PIE_template(Menu):
|
|
# label is displayed at the center of the pie menu.
|
|
bl_label = "Select Mode"
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
pie = layout.menu_pie()
|
|
# operator_enum will just spread all available options
|
|
# for the type enum of the operator on the pie
|
|
pie.operator_enum("mesh.select_mode", "type")
|
|
|
|
|
|
def register():
|
|
bpy.utils.register_class(VIEW3D_MT_PIE_template)
|
|
|
|
|
|
def unregister():
|
|
bpy.utils.unregister_class(VIEW3D_MT_PIE_template)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
register()
|
|
|
|
bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_template")
|