ui_pie_menu.py 769 B

1234567891011121314151617181920212223242526272829303132
  1. import bpy
  2. from bpy.types import Menu
  3. # spawn an edit mode selection pie (run while object is in edit mode to get a valid output)
  4. class VIEW3D_MT_PIE_template(Menu):
  5. # label is displayed at the center of the pie menu.
  6. bl_label = "Select Mode"
  7. def draw(self, context):
  8. layout = self.layout
  9. pie = layout.menu_pie()
  10. # operator_enum will just spread all available options
  11. # for the type enum of the operator on the pie
  12. pie.operator_enum("mesh.select_mode", "type")
  13. def register():
  14. bpy.utils.register_class(VIEW3D_MT_PIE_template)
  15. def unregister():
  16. bpy.utils.unregister_class(VIEW3D_MT_PIE_template)
  17. if __name__ == "__main__":
  18. register()
  19. bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_template")