Paste Code
Paste Blends
Paste Images
bl_info = {    "name": "Pie Edit Menu",
"author": "Jimmy Livefjord (code from Cédric Lepiller) ",
"version": (1, 0, 0),
"blender": (2, 71, 4),
"description": "Enable pie Menus Edit Mode",
"category": "3D View",}

import bpy
from bpy.types import Menu


# Define Class Object Mode


class ClassObject(bpy.types.Operator):
bl_idname = "class.object"
bl_label = "Class Object"

def execute(self, context):
layout = self.layout

if bpy.context.object.mode == "OBJECT":
bpy.ops.object.mode_set(mode="EDIT")
else:
bpy.ops.object.mode_set(mode="OBJECT")


return {'FINISHED'}



# Define Class Vertex


class ClassVertex(bpy.types.Operator):
bl_idname = "class.vertex"
bl_label = "Class Vertex"

def execute(self, context):
layout = self.layout

if bpy.context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
if bpy.ops.mesh.select_mode != "EDGE, FACE":
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')

return {'FINISHED'}

# Define Class Edge


class ClassEdge(bpy.types.Operator):
bl_idname = "class.edge"
bl_label = "Class Edge"

def execute(self, context):
layout = self.layout

if bpy.context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
if bpy.ops.mesh.select_mode != "VERT, FACE":
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')

return {'FINISHED'}
# Define Class Face


class ClassFace(bpy.types.Operator):
bl_idname = "class.face"
bl_label = "Class Face"

def execute(self, context):
layout = self.layout

if bpy.context.object.mode != "EDIT":
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
if bpy.ops.mesh.select_mode != "VERT, EDGE":
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')

return {'FINISHED'}







# Pie Menu


class VIEW3D_PIE_edit(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Select Mode"


def draw(self, context):
layout = self.layout

ob = context
if ob.object.type == 'MESH':


pie = layout.menu_pie()
pie.operator("class.vertex", text="Vertex", icon='VERTEXSEL')
pie.operator("class.edge", text="Edge", icon='EDGESEL')
pie.operator("class.face", text="Face", icon='FACESEL')
pie.operator("class.object", text="Object/Edit Mode", icon='OBJECT_DATAMODE')




elif ob.object.type == 'CURVE':

pie = layout.menu_pie()
pie.operator("object.editmode_toggle")

elif ob.object.type == 'ARMATURE':

pie = layout.menu_pie()
pie.operator("object.editmode_toggle")

elif ob.object.type == 'FONT':

pie = layout.menu_pie()
pie.operator("object.editmode_toggle")

elif ob.object.type == 'SURFACE':

pie = layout.menu_pie()
pie.operator("object.editmode_toggle")



addon_keymaps = []


def register():
bpy.utils.register_class(VIEW3D_PIE_edit)
bpy.utils.register_class(ClassObject)
bpy.utils.register_class(ClassVertex)
bpy.utils.register_class(ClassEdge)
bpy.utils.register_class(ClassFace)

wm = bpy.context.window_manager

if wm.keyconfigs.addon:

km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
#kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
#kmi.properties.name = 'VIEW3D_PIE_edit'




addon_keymaps.append(km)




def unregister():
bpy.utils.unregister_class(VIEW3D_PIE_edit)
bpy.utils.unregister_class(ClassObject)
bpy.utils.unregister_class(ClassVertex)
bpy.utils.unregister_class(ClassEdge)
bpy.utils.unregister_class(ClassFace)


wm = bpy.context.window_manager


if wm.keyconfigs.addon:
for km in addon_keymaps:
for kmi in km.keymap_items:
km.keymap_items.remove(kmi)


wm.keyconfigs.addon.keymaps.remove(km)


# clear the list
del addon_keymaps[:]


if __name__ == "__main__":
register()


#bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_edit")
  1. bl_info = {    "name": "Pie Edit Menu",
  2.     "author": "Jimmy Livefjord (code from C├ędric Lepiller) ",
  3.     "version": (1, 0, 0),
  4.     "blender": (2, 71, 4),
  5.     "description": "Enable pie Menus Edit Mode",
  6.     "category": "3D View",}
  7.    
  8. import bpy
  9. from bpy.types import Menu    
  10.  
  11.  
  12. # Define Class Object Mode
  13.  
  14.  
  15. class ClassObject(bpy.types.Operator):
  16.     bl_idname = "class.object"
  17.     bl_label = "Class Object"
  18.    
  19.     def execute(self, context):
  20.         layout = self.layout
  21.        
  22.         if bpy.context.object.mode == "OBJECT":
  23.             bpy.ops.object.mode_set(mode="EDIT")
  24.         else:
  25.             bpy.ops.object.mode_set(mode="OBJECT")  
  26.            
  27.            
  28.         return {'FINISHED'}
  29.  
  30.  
  31.  
  32. # Define Class Vertex
  33.  
  34.  
  35. class ClassVertex(bpy.types.Operator):
  36.     bl_idname = "class.vertex"
  37.     bl_label = "Class Vertex"
  38.    
  39.     def execute(self, context):
  40.         layout = self.layout
  41.        
  42.         if bpy.context.object.mode != "EDIT":
  43.             bpy.ops.object.mode_set(mode="EDIT")
  44.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
  45.         if bpy.ops.mesh.select_mode != "EDGE, FACE":
  46.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT')
  47.            
  48.             return {'FINISHED'}
  49.  
  50. # Define Class Edge
  51.  
  52.  
  53. class ClassEdge(bpy.types.Operator):
  54.     bl_idname = "class.edge"
  55.     bl_label = "Class Edge"
  56.    
  57.     def execute(self, context):
  58.         layout = self.layout
  59.        
  60.         if bpy.context.object.mode != "EDIT":
  61.             bpy.ops.object.mode_set(mode="EDIT")
  62.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
  63.         if bpy.ops.mesh.select_mode != "VERT, FACE":
  64.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
  65.            
  66.             return {'FINISHED'}
  67. # Define Class Face
  68.  
  69.  
  70. class ClassFace(bpy.types.Operator):
  71.     bl_idname = "class.face"
  72.     bl_label = "Class Face"
  73.    
  74.     def execute(self, context):
  75.         layout = self.layout
  76.        
  77.         if bpy.context.object.mode != "EDIT":
  78.             bpy.ops.object.mode_set(mode="EDIT")
  79.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
  80.         if bpy.ops.mesh.select_mode != "VERT, EDGE":
  81.             bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')
  82.            
  83.             return {'FINISHED'}
  84.        
  85.  
  86.  
  87.  
  88.  
  89.        
  90.        
  91. # Pie Menu
  92.  
  93.  
  94. class VIEW3D_PIE_edit(Menu):
  95.     # label is displayed at the center of the pie menu.
  96.     bl_label = "Select Mode"
  97.  
  98.  
  99.     def draw(self, context):
  100.         layout = self.layout
  101.            
  102.         ob = context
  103.         if ob.object.type == 'MESH':
  104.  
  105.  
  106.             pie = layout.menu_pie()
  107.             pie.operator("class.vertex", text="Vertex", icon='VERTEXSEL')
  108.             pie.operator("class.edge", text="Edge", icon='EDGESEL')
  109.             pie.operator("class.face", text="Face", icon='FACESEL')
  110.             pie.operator("class.object", text="Object/Edit Mode", icon='OBJECT_DATAMODE')
  111.            
  112.  
  113.            
  114.  
  115.         elif ob.object.type == 'CURVE':
  116.            
  117.             pie = layout.menu_pie()
  118.             pie.operator("object.editmode_toggle")
  119.            
  120.         elif ob.object.type == 'ARMATURE':
  121.            
  122.             pie = layout.menu_pie()
  123.             pie.operator("object.editmode_toggle")  
  124.        
  125.         elif ob.object.type == 'FONT':
  126.            
  127.             pie = layout.menu_pie()
  128.             pie.operator("object.editmode_toggle")      
  129.        
  130.         elif ob.object.type == 'SURFACE':
  131.            
  132.             pie = layout.menu_pie()
  133.             pie.operator("object.editmode_toggle")  
  134.        
  135.  
  136.            
  137. addon_keymaps = []
  138.  
  139.  
  140. def register():
  141.     bpy.utils.register_class(VIEW3D_PIE_edit)
  142.     bpy.utils.register_class(ClassObject)
  143.     bpy.utils.register_class(ClassVertex)
  144.     bpy.utils.register_class(ClassEdge)
  145.     bpy.utils.register_class(ClassFace)
  146.    
  147.     wm = bpy.context.window_manager
  148.    
  149.     if wm.keyconfigs.addon:
  150.        
  151.         km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal')
  152.         #kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS')
  153.         #kmi.properties.name = 'VIEW3D_PIE_edit'
  154.        
  155.  
  156.  
  157.  
  158.         addon_keymaps.append(km)
  159.  
  160.  
  161.  
  162.  
  163. def unregister():
  164.     bpy.utils.unregister_class(VIEW3D_PIE_edit)
  165.     bpy.utils.unregister_class(ClassObject)
  166.     bpy.utils.unregister_class(ClassVertex)
  167.     bpy.utils.unregister_class(ClassEdge)
  168.     bpy.utils.unregister_class(ClassFace)
  169.  
  170.  
  171.     wm = bpy.context.window_manager
  172.  
  173.  
  174.     if wm.keyconfigs.addon:
  175.         for km in addon_keymaps:
  176.             for kmi in km.keymap_items:
  177.                 km.keymap_items.remove(kmi)
  178.  
  179.  
  180.             wm.keyconfigs.addon.keymaps.remove(km)
  181.  
  182.  
  183.     # clear the list
  184.     del addon_keymaps[:]
  185.  
  186.  
  187. if __name__ == "__main__":
  188.     register()
  189.  
  190.  
  191. #bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_edit")
go to heaven