Created
January 10, 2016 09:58
-
-
Save zeffii/3ee0050ec653c9b15248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from bpy.types import Menu | |
class NewPie(Menu): | |
bl_label = "Select Mode" | |
bl_idname = 'kwanza' | |
def draw(self, context): | |
layout = self.layout | |
active = context.active_object | |
if active and active.type == 'MESH': | |
mesh = active.data | |
pie = layout.menu_pie() | |
pie.row().prop(mesh, "auto_smooth_angle", text="Angle", slider=True) | |
addon_keymaps = [] | |
def register(): | |
bpy.utils.register_class(NewPie) | |
wm = bpy.context.window_manager | |
kc = wm.keyconfigs.addon | |
km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW') | |
keymaps = km.keymap_items | |
new_shortcut = keymaps.new("wm.call_menu_pie", "SEMI_COLON", "PRESS", shift=True) | |
new_shortcut.properties.name = 'kwanza' | |
addon_keymaps.append((km, new_shortcut)) | |
def unregister(): | |
bpy.utils.unregister_class(NewPie) | |
for km, shortcut in addon_keymaps: | |
km.keymap_items.remove(shortcut) | |
addon_keymaps.clear() | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment