Actually I got it for the vert and the edges but the face does not work Why is that? How do you know like why 0 == 1 is vert and 1 == 1 is edge?
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
if bpy.context.scene.tool_settings.mesh_select_mode[0] == 1:
layout.operator("mesh.primitive_uv_sphere_add", text="Vert")
if bpy.context.scene.tool_settings.mesh_select_mode[2] == 2:
layout.operator("mesh.primitive_uv_sphere_add", text="Face")
if bpy.context.scene.tool_settings.mesh_select_mode[1] == 1:
layout.operator("mesh.primitive_uv_sphere_add", text="Edge")
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")
I think I figured but the only issue I have with this is that when I go fo object mode. I still get the options that were shown for last used selection mode. So If I had edges selected when I exit I still get the message “Edgeeee”. Is there any way to hide that? My object mode code is this
if bpy.context.mode == 'OBJECT':
And I also use this generic
if bpy.context.mode == 'EDIT MESH':
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
if bpy.context.scene.tool_settings.mesh_select_mode[0] == True:
layout.operator("mesh.primitive_uv_sphere_add", text="Vert")
if bpy.context.scene.tool_settings.mesh_select_mode[1] == True:
layout.operator("mesh.primitive_uv_sphere_add", text=" Edgeeeeeeeeeeeeeeee")
if bpy.context.scene.tool_settings.mesh_select_mode[2] == True:
layout.operator("mesh.primitive_uv_sphere_add", text=" ffffffffffffFace")
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.op