diff options
author | meta-androcto <meta.androcto1@gmail.com> | 2019-08-24 07:05:31 +0300 |
---|---|---|
committer | meta-androcto <meta.androcto1@gmail.com> | 2019-08-24 07:05:31 +0300 |
commit | 4e7b694ee44060373ae20dd2e71644a1230dd569 (patch) | |
tree | 1a1e25ffb664fa33830352a87acc9a99b61af3cb | |
parent | f4e1bf3eb7039c6813e6ee80e57c5f13b19d47fb (diff) |
viewport pies: remove snap, orientation, clean up: T67995
-rw-r--r-- | space_view3d_pie_menus/__init__.py | 21 | ||||
-rw-r--r-- | space_view3d_pie_menus/pie_modes_menu.py | 67 | ||||
-rw-r--r-- | space_view3d_pie_menus/pie_orientation_menu.py | 87 | ||||
-rw-r--r-- | space_view3d_pie_menus/pie_save_open_menu.py | 43 | ||||
-rw-r--r-- | space_view3d_pie_menus/pie_snap_menu.py | 268 |
5 files changed, 30 insertions, 456 deletions
diff --git a/space_view3d_pie_menus/__init__.py b/space_view3d_pie_menus/__init__.py index cdb9a9e5..a8eb7d00 100644 --- a/space_view3d_pie_menus/__init__.py +++ b/space_view3d_pie_menus/__init__.py @@ -45,20 +45,19 @@ bl_info = { } sub_modules_names = ( - "pie_modes_menu", - "pie_views_numpad_menu", - "pie_sculpt_menu", - "pie_origin", - "pie_manipulator_menu", - "pie_snap_menu", - "pie_shading_menu", "pie_align_menu", - "pie_delete_menu", - "pie_apply_transform_menu", - "pie_select_menu", "pie_animation_menu", - "pie_save_open_menu", + "pie_apply_transform_menu", + "pie_delete_menu", "pie_editor_switch_menu", + "pie_manipulator_menu", + "pie_modes_menu", + "pie_origin", + "pie_save_open_menu", + "pie_sculpt_menu", + "pie_select_menu", + "pie_shading_menu", + "pie_views_numpad_menu", ) diff --git a/space_view3d_pie_menus/pie_modes_menu.py b/space_view3d_pie_menus/pie_modes_menu.py index 0b68c79e..bcaf4af6 100644 --- a/space_view3d_pie_menus/pie_modes_menu.py +++ b/space_view3d_pie_menus/pie_modes_menu.py @@ -178,57 +178,6 @@ class PIE_OT_ClassFace(Operator): return {'FINISHED'} -class PIE_OT_VertsEdges(Operator): - bl_idname = "verts.edges" - bl_label = "Verts Edges" - bl_description = "Vert/Edge Select Mode" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - if 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 != "VERT, EDGE, FACE": - bpy.ops.object.mode_set(mode="EDIT") - bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') - bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='EDGE') - return {'FINISHED'} - - -class PIE_OT_EdgesFaces(Operator): - bl_idname = "edges.faces" - bl_label = "EdgesFaces" - bl_description = "Edge/Face Select Mode" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - if 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, EDGE, FACE": - bpy.ops.object.mode_set(mode="EDIT") - bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE') - bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE') - return {'FINISHED'} - - -class PIE_OT_VertsFaces(Operator): - bl_idname = "verts.faces" - bl_label = "Verts Faces" - bl_description = "Vert/Face Select Mode" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - if 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 != "VERT, EDGE, FACE": - bpy.ops.object.mode_set(mode="EDIT") - bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='VERT') - bpy.ops.mesh.select_mode(use_extend=True, use_expand=False, type='FACE') - return {'FINISHED'} - - class PIE_OT_VertsEdgesFaces(Operator): bl_idname = "verts.edgesfaces" bl_label = "Verts Edges Faces" @@ -280,9 +229,6 @@ class PIE_MT_ObjectEditotherModes(Menu): box.operator("class.vertex", text="Vertex", icon='VERTEXSEL') box.operator("class.edge", text="Edge", icon='EDGESEL') box.operator("class.face", text="Face", icon='FACESEL') - box.operator("verts.faces", text="Vertex/Faces", icon='VERTEXSEL') - box.operator("verts.edges", text="Vertex/Edges", icon='EDGESEL') - box.operator("edges.faces", text="Edges/Faces", icon='FACESEL') box.operator("verts.edgesfaces", text="Vertex/Edges/Faces", icon='OBJECT_DATAMODE') @@ -309,17 +255,17 @@ class PIE_MT_ObjectEditMode(Menu): 'PARTICLE_EDIT', 'GPENCIL_EDIT'}: pie = layout.menu_pie() # 4 - LEFT - pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT') + pie.operator("class.pieweightpaint", text="Weight Paint", icon='WPAINT_HLT') # 6 - RIGHT pie.operator("class.pietexturepaint", text="Texture Paint", icon='TPAINT_HLT') # 2 - BOTTOM - pie.menu("MENU_MT_objecteditmodeothermodes", text="Vert,Edge,Face Modes", icon='EDITMODE_HLT') + pie.menu("MENU_MT_objecteditmodeothermodes", text="Edit Modes", icon='EDITMODE_HLT') # 8 - TOP pie.operator("class.object", text="Object/Edit Toggle", icon='OBJECT_DATAMODE') # 7 - TOP - LEFT pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT') # 9 - TOP - RIGHT - pie.operator("class.pieweightpaint", text="Weight Paint", icon='WPAINT_HLT') + pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT') # 1 - BOTTOM - LEFT if context.object.particle_systems: pie.operator("class.pieparticleedit", text="Particle Edit", icon='PARTICLEMODE') @@ -332,7 +278,7 @@ class PIE_MT_ObjectEditMode(Menu): elif ob and ob.type == 'MESH' and ob.mode in {'EDIT'}: pie = layout.menu_pie() # 4 - LEFT - pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT') + pie.operator("class.pieweightpaint", text="Weight Paint", icon='WPAINT_HLT') # 6 - RIGHT pie.operator("class.pietexturepaint", text="Texture Paint", icon='TPAINT_HLT') # 2 - BOTTOM @@ -342,7 +288,7 @@ class PIE_MT_ObjectEditMode(Menu): # 7 - TOP - LEFT pie.operator("sculpt.sculptmode_toggle", text="Sculpt", icon='SCULPTMODE_HLT') # 9 - TOP - RIGHT - pie.operator("class.pieweightpaint", text="Weight Paint", icon='WPAINT_HLT') + pie.operator("class.pievertexpaint", text="Vertex Paint", icon='VPAINT_HLT') # 1 - BOTTOM - LEFT if context.object.particle_systems: pie.operator("class.pieparticleedit", text="Particle Edit", icon='PARTICLEMODE') @@ -484,9 +430,6 @@ classes = ( PIE_OT_ClassVertexPaint, PIE_OT_ClassParticleEdit, PIE_OT_InteractiveModeGreasePencil, - PIE_OT_VertsEdges, - PIE_OT_EdgesFaces, - PIE_OT_VertsFaces, PIE_OT_VertsEdgesFaces, PIE_OT_SetObjectModePie, ) diff --git a/space_view3d_pie_menus/pie_orientation_menu.py b/space_view3d_pie_menus/pie_orientation_menu.py deleted file mode 100644 index 2b8dd844..00000000 --- a/space_view3d_pie_menus/pie_orientation_menu.py +++ /dev/null @@ -1,87 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -"""Replace default list-style menu for transform orientations with a pie.""" - -bl_info = { - "name": "Hotkey: 'Alt + Spacebar'", - "author": "Italic_", - "version": (1, 1, 0), - "blender": (2, 80, 0), - "description": "Set Transform Orientations", - "location": "3D View", - "category": "Orientation Pie"} - -import bpy -from bpy.types import ( - Menu, - Operator, - ) -from bpy.props import ( - StringProperty, - ) - - -class PIE_MT_OrientPie(Menu): - bl_label = "Transform Orientation" - bl_idname = "PIE_MT_orient" - - def draw(self, context): - layout = self.layout - pie = layout.menu_pie() - scene = context.scene - - pie.prop(scene.transform_orientation_slots[0], "type", expand=True) - - -addon_keymaps = [] - -classes = ( - PIE_MT_OrientPie, - ) - - -def register(): - for cls in classes: - bpy.utils.register_class(cls) - - wm = bpy.context.window_manager - if wm.keyconfigs.addon: - # Manipulators - km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D') - kmi = km.keymap_items.new('wm.call_menu_pie', 'SPACE', 'PRESS', alt=True) - kmi.properties.name = "PIE_MT_orient" - addon_keymaps.append((km, kmi)) - - -def unregister(): - for cls in classes: - bpy.utils.unregister_class(cls) - - 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() - - -if __name__ == "__main__": - register() diff --git a/space_view3d_pie_menus/pie_save_open_menu.py b/space_view3d_pie_menus/pie_save_open_menu.py index 29fe67a2..9e02b321 100644 --- a/space_view3d_pie_menus/pie_save_open_menu.py +++ b/space_view3d_pie_menus/pie_save_open_menu.py @@ -35,9 +35,8 @@ from bpy.types import ( ) import os -# Pie Save/Open - +# Pie Save/Open class PIE_MT_SaveOpen(Menu): bl_idname = "PIE_MT_saveopen" bl_label = "Pie Save/Open" @@ -48,17 +47,17 @@ class PIE_MT_SaveOpen(Menu): # 4 - LEFT pie.operator("wm.read_homefile", text="New", icon='FILE_NEW') # 6 - RIGHT - pie.menu("PIE_MT_link", text="Link", icon='LINK_BLEND') + pie.menu("PIE_MT_link", text="Link Menu", icon='LINK_BLEND') # 2 - BOTTOM pie.menu("PIE_MT_fileio", text="Import/Export Menu", icon='IMPORT') # 8 - TOP - pie.operator("file.save_incremental", text="Incremental Save", icon='NONE') + pie.operator("wm.open_mainfile", text="Open File", icon='FILE_FOLDER') # 7 - TOP - LEFT pie.operator("wm.save_mainfile", text="Save", icon='FILE_TICK') # 9 - TOP - RIGHT pie.operator("wm.save_as_mainfile", text="Save As...", icon='NONE') # 1 - BOTTOM - LEFT - pie.operator("wm.open_mainfile", text="Open file", icon='FILE_FOLDER') + pie.operator("file.save_incremental", text="Incremental Save", icon='NONE') # 3 - BOTTOM - RIGHT pie.menu("PIE_MT_recover", text="Recovery Menu", icon='RECOVER_LAST') @@ -73,7 +72,13 @@ class PIE_MT_link(Menu): box = pie.split().column() box.operator("wm.link", text="Link", icon='LINK_BLEND') box.operator("wm.append", text="Append", icon='APPEND_BLEND') - box.menu("EXTERNAL_MT_data", text="External Data") + box.separator() + box.operator("file.autopack_toggle", text="Automatically Pack Into .blend") + box.operator("file.pack_all", text="Pack All Into .blend") + box.operator("file.unpack_all", text="Unpack All Into Files") + box.separator() + box.operator("file.make_paths_relative", text="Make All Paths Relative") + box.operator("file.make_paths_absolute", text="Make All Paths Absolute") class PIE_MT_recover(Menu): @@ -87,7 +92,9 @@ class PIE_MT_recover(Menu): box.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='NONE') box.operator("wm.recover_last_session", text="Recover Last Session", icon='RECOVER_LAST') box.operator("wm.revert_mainfile", text="Revert", icon='FILE_REFRESH') - + box.separator() + box.operator("file.report_missing_files", text="Report Missing Files") + box.operator("file.find_missing_files", text="Find Missing Files") class PIE_MT_fileio(Menu): bl_idname = "PIE_MT_fileio" @@ -102,26 +109,7 @@ class PIE_MT_fileio(Menu): box.menu("TOPBAR_MT_file_export", icon='EXPORT') -class PIE_MT_ExternalData(Menu): - bl_idname = "EXTERNAL_MT_data" - bl_label = "External Data" - - def draw(self, context): - layout = self.layout - - layout.operator("file.autopack_toggle", text="Automatically Pack Into .blend") - layout.separator() - layout.operator("file.pack_all", text="Pack All Into .blend") - layout.operator("file.unpack_all", text="Unpack All Into Files") - layout.separator() - layout.operator("file.make_paths_relative", text="Make All Paths Relative") - layout.operator("file.make_paths_absolute", text="Make All Paths Absolute") - layout.operator("file.report_missing_files", text="Report Missing Files") - layout.operator("file.find_missing_files", text="Find Missing Files") - - # Save Incremental - class PIE_OT_FileIncrementalSave(Operator): bl_idname = "file.save_incremental" bl_label = "Save Incremental" @@ -174,7 +162,6 @@ class PIE_OT_FileIncrementalSave(Operator): classes = ( PIE_MT_SaveOpen, - PIE_MT_ExternalData, PIE_OT_FileIncrementalSave, PIE_MT_fileio, PIE_MT_recover, @@ -191,7 +178,7 @@ def register(): wm = bpy.context.window_manager if wm.keyconfigs.addon: # Save/Open/... - km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') + km = wm.keyconfigs.addon.keymaps.new(name='Window') kmi = km.keymap_items.new('wm.call_menu_pie', 'S', 'PRESS', ctrl=True) kmi.properties.name = "PIE_MT_saveopen" addon_keymaps.append((km, kmi)) diff --git a/space_view3d_pie_menus/pie_snap_menu.py b/space_view3d_pie_menus/pie_snap_menu.py deleted file mode 100644 index 11058861..00000000 --- a/space_view3d_pie_menus/pie_snap_menu.py +++ /dev/null @@ -1,268 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -bl_info = { - "name": "Hotkey: 'Ctrl Shift Tab'", - "description": "Snap Element Menu", - "author": "pitiwazou, meta-androcto", - "version": (0, 1, 1), - "blender": (2, 80, 0), - "location": "3d View", - "warning": "", - "wiki_url": "", - "category": "Snap Element Pie" - } - -import bpy -from bpy.types import ( - Menu, - Operator, - ) - - -# Pie Snap - Shift + Tab -class PIE_MT_Snaping(Menu): - bl_idname = "PIE_MT_snapping" - bl_label = "Pie Snapping" - - def draw(self, context): - layout = self.layout - pie = layout.menu_pie() - # 4 - LEFT - pie.operator("snap.vertex", text="Vertex", icon='SNAP_VERTEX') - # 6 - RIGHT - pie.operator("snap.face", text="Face", icon='SNAP_FACE') - # 2 - BOTTOM - pie.operator("snap.edge", text="Edge", icon='SNAP_EDGE') - # 8 - TOP - pie.prop(context.tool_settings, "use_snap", text="Snap On/Off") - # 7 - TOP - LEFT - pie.operator("snap.volume", text="Volume", icon='SNAP_VOLUME') - # 9 - TOP - RIGHT - pie.operator("snap.increment", text="Increment", icon='SNAP_INCREMENT') - # 1 - BOTTOM - LEFT - pie.operator("snap.alignrotation", text="Align rotation", icon='SNAP_NORMAL') - # 3 - BOTTOM - RIGHT - pie.operator("wm.call_menu_pie", text="Snap Target", icon='NONE').name = "SNAP_MT_targetmenu" - - -class PIE_OT_SnapActive(Operator): - bl_idname = "snap.active" - bl_label = "Snap Active" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap is True: - ts.use_snap = False - - elif ts.use_snap is False: - ts.use_snap = True - - return {'FINISHED'} - - -class PIE_OT_SnapVolume(Operator): - bl_idname = "snap.volume" - bl_label = "Snap Volume" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - if ts.use_snap is False: - ts.use_snap = True - ts.snap_elements = {'VOLUME'} - if ts.snap_elements != {'VOLUME'}: - ts.snap_elements = {'VOLUME'} - return {'FINISHED'} - - -class PIE_OT_SnapFace(Operator): - bl_idname = "snap.face" - bl_label = "Snap Face" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap is False: - ts.use_snap = True - ts.snap_elements = {'FACE'} - - if ts.snap_elements != {'FACE'}: - ts.snap_elements = {'FACE'} - return {'FINISHED'} - - -class PIE_OT_SnapEdge(Operator): - bl_idname = "snap.edge" - bl_label = "Snap Edge" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap is False: - ts.use_snap = True - ts.snap_elements = {'EDGE'} - - if ts.snap_elements != {'EDGE'}: - ts.snap_elements = {'EDGE'} - return {'FINISHED'} - - -class PIE_OT_SnapVertex(Operator): - bl_idname = "snap.vertex" - bl_label = "Snap Vertex" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap is False: - ts.use_snap = True - ts.snap_elements = {'VERTEX'} - - if ts.snap_elements != {'VERTEX'}: - ts.snap_elements = {'VERTEX'} - return {'FINISHED'} - - -class PIE_OT_SnapIncrement(Operator): - bl_idname = "snap.increment" - bl_label = "Snap Increment" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap is False: - ts.use_snap = True - ts.snap_elements = {'INCREMENT'} - - if ts.snap_elements != {'INCREMENT'}: - ts.snap_elements = {'INCREMENT'} - return {'FINISHED'} - - -class PIE_OT_SnapAlignRotation(Operator): - bl_idname = "snap.alignrotation" - bl_label = "Snap Align rotation" - bl_options = {'REGISTER', 'UNDO'} - - def execute(self, context): - ts = context.tool_settings - - if ts.use_snap_align_rotation is True: - ts.use_snap_align_rotation = False - - elif ts.use_snap_align_rotation is False: - ts.use_snap_align_rotation = True - - return {'FINISHED'} - - -class PIE_OT_SnapTargetVariable(Operator): - bl_idname = "object.snaptargetvariable" - bl_label = "Snap Target Variable" - bl_options = {'REGISTER', 'UNDO'} - - variable: bpy.props.StringProperty() - - @classmethod - def poll(cls, context): - return True - - def execute(self, context): - ts = context.tool_settings - - ts.snap_target = self.variable - return {'FINISHED'} - -# Menu Snap Target - Shift + Tab - - -class PIE_MT_SnapTargetMenu(Menu): - bl_idname = "SNAP_MT_targetmenu" - bl_label = "Snap Target Menu" - - def draw(self, context): - layout = self.layout - pie = layout.menu_pie() - # 4 - LEFT - pie.operator("object.snaptargetvariable", text="Active").variable = 'ACTIVE' - # 6 - RIGHT - pie.operator("object.snaptargetvariable", text="Median").variable = 'MEDIAN' - # 2 - BOTTOM - pie.operator("object.snaptargetvariable", text="Center").variable = 'CENTER' - # 8 - TOP - pie.operator("object.snaptargetvariable", text="Closest").variable = 'CLOSEST' - # 7 - TOP - LEFT - # 9 - TOP - RIGHT - # 1 - BOTTOM - LEFT - # 3 - BOTTOM - RIGHT - - -# Pie Snapping - Shift + Tab - -classes = ( - PIE_MT_Snaping, - PIE_MT_SnapTargetMenu, - PIE_OT_SnapActive, - PIE_OT_SnapVolume, - PIE_OT_SnapFace, - PIE_OT_SnapEdge, - PIE_OT_SnapVertex, - PIE_OT_SnapIncrement, - PIE_OT_SnapAlignRotation, - PIE_OT_SnapTargetVariable - ) - -addon_keymaps = [] - - -def register(): - for cls in classes: - bpy.utils.register_class(cls) - - wm = bpy.context.window_manager - if wm.keyconfigs.addon: - # Snapping - km = wm.keyconfigs.addon.keymaps.new(name='3D View Generic', space_type='VIEW_3D') - kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS', ctrl=True, shift=True) - kmi.properties.name = "PIE_MT_snapping" - addon_keymaps.append((km, kmi)) - - -def unregister(): - for cls in classes: - bpy.utils.unregister_class(cls) - - 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() - - -if __name__ == "__main__": - register() |