Created
January 20, 2016 23:21
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 | |
class Rotator(bpy.types.Operator): | |
bl_idname = "pieops.set_manip" | |
bl_label = "Set the manip" | |
def execute(self, context): | |
try: | |
context.space_data.transform_manipulators = {'ROTATE'} | |
except: | |
print('failed to set') | |
return {'FINISHED'} | |
class NewPie(bpy.types.Menu): | |
bl_idname = 'kwanza' | |
bl_label = "Select Mode" | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
pie.operator("mesh.primitive_cube_add") | |
pie.operator("pieops.set_manip", text="ROTATE") | |
addon_keymaps = [] | |
def register(): | |
bpy.utils.register_class(Rotator) | |
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(Rotator) | |
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