Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bl_info = {
- "name": "UV Unwrap Pie Menu",
- "description": "Pie Menu for UV Unwrap and Mark Seams function. default key U in category Mesh as mesh.pie_uvmap",
- "author": "Filipe xeoncat Miranda",
- "version": (0, 1),
- "blender": (2, 79, 0),
- "location": "",
- "warning": "",
- "wiki_url": "",
- "category": "Pie Menu"
- }
- import bpy
- from bpy.types import Menu
- class MESH_PIE_uvproject(Menu):
- bl_idname = "mesh.pie_uvproject"
- bl_label = "Pie UV Project"
- bl_options = {'REGISTER', 'UNDO'}
- def draw(self, context):
- layout = self.layout
- pie = layout.menu_pie()
- box = pie.split().column()
- box.operator("uv.cube_project", text="Cube Project", icon='MESH_CUBE')
- box.operator("uv.cylinder_project", text="Cylinder Project", icon='MESH_CYLINDER')
- box.operator("uv.sphere_project", text="Sphere Project", icon='MESH_UVSPHERE')
- box.operator("uv.lightmap_pack")
- box.operator("uv.follow_active_quads")
- box.operator("uv.project_from_view").scale_to_bounds = True
- class MESH_PIE_uvmap(Menu):
- bl_label = "UV Mapping"
- bl_idname = "mesh.pie_uvmap"
- bl_options = {'REGISTER', 'UNDO'}
- def draw(self, context):
- layout = self.layout
- pie = layout.menu_pie()
- pie.operator("mesh.mark_seam", text="Mark Seam", icon='ZOOMIN').clear = False
- pie.operator("mesh.mark_seam", text="Clear Seam", icon='ZOOMOUT').clear = True
- pie.menu("mesh.pie_uvproject", text="Other Projections", icon='TRIA_DOWN')
- pie.operator("uv.unwrap", text="UV Unwrap", icon='MESH_GRID')
- pie.operator("uv.smart_project")
- pie.operator("uv.reset")
- classes = (
- MESH_PIE_uvproject,
- MESH_PIE_uvmap,
- )
- addon_keymaps = []
- def register():
- for cls in classes:
- bpy.utils.register_class(cls)
- wm = bpy.context.window_manager
- kc = wm.keyconfigs.addon
- if kc:
- km = wm.keyconfigs.addon.keymaps.new(name='Mesh')
- kmi = km.keymap_items.new('wm.call_menu_pie', 'U', 'PRESS', shift=False,ctrl=False)
- kmi.properties.name = "mesh.pie_uvmap"
- addon_keymaps.append((km, kmi))
- def unregister():
- wm = bpy.context.window_manager
- kc = wm.keyconfigs.addon
- if kc:
- for km, kmi in addon_keymaps:
- km.keymap_items.remove(kmi)
- addon_keymaps.clear()
- for cls in classes:
- bpy.utils.unregister_class(cls)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment