Changeset View
Changeset View
Standalone View
Standalone View
ui_pie_menus_official.py
| Show All 36 Lines | class VIEW3D_PIE_object_mode(Menu): | ||||
| bl_label = "Mode" | bl_label = "Mode" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| pie = layout.menu_pie() | pie = layout.menu_pie() | ||||
| pie.operator_enum("OBJECT_OT_mode_set", "mode") | pie.operator_enum("OBJECT_OT_mode_set", "mode") | ||||
| class VIEW3D_PIE_view_more(Menu): | class VIEW3D_PIE_view_more(Menu): | ||||
| bl_label = "More" | bl_label = "More" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| pie = layout.menu_pie() | pie = layout.menu_pie() | ||||
| pie.operator("VIEW3D_OT_view_persportho", text="Persp/Ortho", icon='RESTRICT_VIEW_OFF') | pie.operator("VIEW3D_OT_view_persportho", text="Persp/Ortho", icon='RESTRICT_VIEW_OFF') | ||||
| pie.operator("VIEW3D_OT_camera_to_view") | pie.operator("VIEW3D_OT_camera_to_view") | ||||
| pie.operator("VIEW3D_OT_view_selected") | pie.operator("VIEW3D_OT_view_selected") | ||||
| pie.operator("VIEW3D_OT_view_all") | pie.operator("VIEW3D_OT_view_all") | ||||
| pie.operator("VIEW3D_OT_localview") | pie.operator("VIEW3D_OT_localview") | ||||
| pie.operator("SCREEN_OT_region_quadview") | |||||
| class VIEW3D_PIE_view(Menu): | class VIEW3D_PIE_view(Menu): | ||||
| bl_label = "View" | bl_label = "View" | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| Show All 24 Lines | class VIEW3D_manipulator_set(Operator): | ||||
| bl_label = "Set Manipulator" | bl_label = "Set Manipulator" | ||||
| bl_idname = "view3d.manipulator_set" | bl_idname = "view3d.manipulator_set" | ||||
| type = EnumProperty( | type = EnumProperty( | ||||
| name="Type", | name="Type", | ||||
| items=(('TRANSLATE', "Translate", "Use the manipulator for movement transformations"), | items=(('TRANSLATE', "Translate", "Use the manipulator for movement transformations"), | ||||
| ('ROTATE', "Rotate", "Use the manipulator for rotation transformations"), | ('ROTATE', "Rotate", "Use the manipulator for rotation transformations"), | ||||
| ('SCALE', "Scale", "Use the manipulator for scale transformations"), | ('SCALE', "Scale", "Use the manipulator for scale transformations"), | ||||
| ), | ), | ||||
| ) | ) | ||||
| def execute(self, context): | def execute(self, context): | ||||
| #show manipulator if user selects an option | # show manipulator if user selects an option | ||||
| context.space_data.show_manipulator = True | context.space_data.show_manipulator = True | ||||
| context.space_data.transform_manipulators = {self.type} | context.space_data.transform_manipulators = {self.type} | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| class VIEW3D_PIE_manipulator(Menu): | class VIEW3D_PIE_manipulator(Menu): | ||||
| Show All 30 Lines | def draw(self, context): | ||||
| toolsettings = context.tool_settings | toolsettings = context.tool_settings | ||||
| pie = layout.menu_pie() | pie = layout.menu_pie() | ||||
| pie.prop(toolsettings, "snap_element", expand=True) | pie.prop(toolsettings, "snap_element", expand=True) | ||||
| pie.prop(toolsettings, "use_snap") | pie.prop(toolsettings, "use_snap") | ||||
| addon_keymaps = [] | addon_keymaps = [] | ||||
| classes = ( | |||||
| VIEW3D_manipulator_set, | |||||
| def register(): | VIEW3D_PIE_object_mode, | ||||
| bpy.utils.register_class(VIEW3D_manipulator_set) | VIEW3D_PIE_view, | ||||
| VIEW3D_PIE_view_more, | |||||
| VIEW3D_PIE_shade, | |||||
| VIEW3D_PIE_manipulator, | |||||
| VIEW3D_PIE_pivot, | |||||
| VIEW3D_PIE_snap, | |||||
| ) | |||||
| #register menus | |||||
| bpy.utils.register_class(VIEW3D_PIE_object_mode) | def register(): | ||||
| bpy.utils.register_class(VIEW3D_PIE_view) | for cls in classes: | ||||
| bpy.utils.register_class(VIEW3D_PIE_view_more) | bpy.utils.register_class(cls) | ||||
| bpy.utils.register_class(VIEW3D_PIE_shade) | |||||
| bpy.utils.register_class(VIEW3D_PIE_manipulator) | |||||
| bpy.utils.register_class(VIEW3D_PIE_pivot) | |||||
| bpy.utils.register_class(VIEW3D_PIE_snap) | |||||
| wm = bpy.context.window_manager | wm = bpy.context.window_manager | ||||
| if wm.keyconfigs.addon: | if wm.keyconfigs.addon: | ||||
| km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') | km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS') | kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS') | ||||
| kmi.properties.name = 'VIEW3D_PIE_object_mode' | kmi.properties.name = 'VIEW3D_PIE_object_mode' | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS') | kmi = km.keymap_items.new('wm.call_menu_pie', 'Z', 'PRESS') | ||||
| kmi.properties.name = 'VIEW3D_PIE_shade' | kmi.properties.name = 'VIEW3D_PIE_shade' | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS') | kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS') | ||||
| kmi.properties.name = 'VIEW3D_PIE_view' | kmi.properties.name = 'VIEW3D_PIE_view' | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', ctrl=True) | kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', ctrl=True) | ||||
| kmi.properties.name = 'VIEW3D_PIE_manipulator' | kmi.properties.name = 'VIEW3D_PIE_manipulator' | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'PERIOD', 'PRESS') | kmi = km.keymap_items.new('wm.call_menu_pie', 'PERIOD', 'PRESS') | ||||
| kmi.properties.name = 'VIEW3D_PIE_pivot' | kmi.properties.name = 'VIEW3D_PIE_pivot' | ||||
| kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS', ctrl=True, shift=True) | kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS', ctrl=True, shift=True) | ||||
| kmi.properties.name = 'VIEW3D_PIE_snap' | kmi.properties.name = 'VIEW3D_PIE_snap' | ||||
| addon_keymaps.append(km) | addon_keymaps.append(km) | ||||
| def unregister(): | def unregister(): | ||||
| bpy.utils.unregister_class(VIEW3D_manipulator_set) | for cls in classes: | ||||
| bpy.utils.unregister_class(cls) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_object_mode) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_view) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_view_more) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_shade) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_manipulator) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_pivot) | |||||
| bpy.utils.unregister_class(VIEW3D_PIE_snap) | |||||
| wm = bpy.context.window_manager | wm = bpy.context.window_manager | ||||
| if wm.keyconfigs.addon: | if wm.keyconfigs.addon: | ||||
| for km in addon_keymaps: | for km in addon_keymaps: | ||||
| for kmi in km.keymap_items: | for kmi in km.keymap_items: | ||||
| km.keymap_items.remove(kmi) | km.keymap_items.remove(kmi) | ||||
| wm.keyconfigs.addon.keymaps.remove(km) | wm.keyconfigs.addon.keymaps.remove(km) | ||||
| # clear the list | addon_keymaps.clear() | ||||
| del addon_keymaps[:] | |||||