Skip to main content
fixed typo
Source Link
olonge
  • 151
  • 1
  • 2
    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        #pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        pie.operator("object.mode_set", text="Object"text="Sculpt", icon='SCULPTMODE_HLT').mode='SCULPT'
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()
    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        #pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        pie.operator("object.mode_set", text="Object", icon='SCULPTMODE_HLT').mode='SCULPT'
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()
    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        #pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        pie.operator("object.mode_set", text="Sculpt", icon='SCULPTMODE_HLT').mode='SCULPT'
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()
Acknowledged that Gaia Clary had already answered the question, but that this was an answer to an extended question which took me another hour to figure out
Source Link
olonge
  • 151
  • 1
  • 2

I know this has somewhat being answered correctly by Gaia Clary , but I needed to do a similar thing, and it took me a little while to find the exact code needed, so here it is. Hope it saves someone else a few minutes I wanted to be able to pick some (but not all of the mesh select menus).The code below shows how I achieved this.

    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        pie#pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        pie.operator("object.mode_set", text="Object", icon='SCULPTMODE_HLT').mode='SCULPT'
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()

I know this has somewhat being answered, but I needed to do a similar thing, and it took me a little while to find the exact code needed, so here it is. Hope it saves someone else a few minutes.

    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()

I know this has being answered correctly by Gaia Clary , but I needed to do a similar thing, and it took me a little while to find the exact code needed, so here it is. I wanted to be able to pick some (but not all of the mesh select menus).The code below shows how I achieved this.

    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        #pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        pie.operator("object.mode_set", text="Object", icon='SCULPTMODE_HLT').mode='SCULPT'
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()
Source Link
olonge
  • 151
  • 1
  • 2

I know this has somewhat being answered, but I needed to do a similar thing, and it took me a little while to find the exact code needed, so here it is. Hope it saves someone else a few minutes.

    bl_info = {
    "name": "Yomi_Pie_Menus",
    "author": "Oluwayomi Longe",
    "version": (0, 0, 1),
    "blender": (2, 73),
    "description": "Custom Pie Menus",
    "category": "3D View",}

import bpy
from bpy.types import Menu

# Pie Select Mode - Tab
class PieTabMode(Menu):
    bl_idname = "pie.tabmode"
    bl_label = "Select Mode"
    
    def draw(self, context):
        layout = self.layout
        pie = layout.menu_pie()
        
        #4 - LEFT
        # use the commented line below if you want to toggle Edit and object mode
        #pie.operator("object.editmode_toggle", text="Edit/Object", icon='OBJECT_DATAMODE')          
        
        pie.operator("object.mode_set", text="Edit", icon='EDITMODE_HLT').mode='EDIT' 
        #6 - RIGHT
        pie.operator("object.mode_set", text="Object", icon='OBJECT_DATAMODE').mode='OBJECT'
        
        #3 - BOTTOM - RIGHT
        box = pie.split().column()
        row = box.row(align=True)
        box.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
        box.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
        box.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
        #8 - TOP
        pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT')
        
        
def register():
    bpy.utils.register_class(PieTabMode)    
    # or any other classes you add
    
    wm = bpy.context.window_manager
    
    if wm.keyconfigs.addon:
        #Select Mode
        km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
        kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
        kmi.properties.name = "pie.tabmode"    


def unregister(): 
    bpy.utils.unregister_class(PieTabMode)
     # or any other classes you add
    
    for km, kmi in addon_keymaps:
        km.keymap_items.remove(kmi)
    addon_keymaps.clear()


if __name__ == "__main__":
    register()