From 5502517c3c12086c111ae5477fae9c0d2eb8a84c Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Fri, 18 Sep 2020 19:58:48 +0200 Subject: Unify all XYZ symmetry options using Mesh Symmetry This adds XYZ symmetry as a property of meshes and updates all modes to use the mesh symmetry by default to have a consistent tool behavior between all modes and when switching objects. Reviewed By: brecht, mano-wii, campbellbarton Maniphest Tasks: T79785 Differential Revision: https://developer.blender.org/D8587 --- release/scripts/startup/bl_ui/space_view3d.py | 50 +++++++--------------- .../scripts/startup/bl_ui/space_view3d_toolbar.py | 35 ++++++++------- 2 files changed, 35 insertions(+), 50 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 9cf61dc297a..40f03c88743 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -152,47 +152,27 @@ class VIEW3D_HT_tool_header(Header): sub.scale_x = 0.6 return row, sub - if mode_string == 'EDIT_MESH': - _row, sub = row_for_mirror() - sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True) - sub.prop(context.object.data, "use_mirror_y", text="Y", toggle=True) - sub.prop(context.object.data, "use_mirror_z", text="Z", toggle=True) - tool_settings = context.tool_settings - layout.prop(tool_settings, "use_mesh_automerge", text="") - elif mode_string == 'EDIT_ARMATURE': + if mode_string == 'EDIT_ARMATURE': _row, sub = row_for_mirror() sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True) elif mode_string == 'POSE': _row, sub = row_for_mirror() sub.prop(context.object.pose, "use_mirror_x", text="X", toggle=True) - elif mode_string == 'PAINT_WEIGHT': + elif mode_string in {'EDIT_MESH', 'PAINT_WEIGHT', 'SCULPT', 'PAINT_VERTEX'}: + # Mesh Modes, Use Mesh Symmetry row, sub = row_for_mirror() - wpaint = context.tool_settings.weight_paint - sub.prop(wpaint, "use_symmetry_x", text="X", toggle=True) - sub.prop(wpaint, "use_symmetry_y", text="Y", toggle=True) - sub.prop(wpaint, "use_symmetry_z", text="Z", toggle=True) - row.popover(panel="VIEW3D_PT_tools_weightpaint_symmetry_for_topbar", text="") - elif mode_string == 'SCULPT': - row, sub = row_for_mirror() - sculpt = context.tool_settings.sculpt - sub.prop(sculpt, "use_symmetry_x", text="X", toggle=True) - sub.prop(sculpt, "use_symmetry_y", text="Y", toggle=True) - sub.prop(sculpt, "use_symmetry_z", text="Z", toggle=True) - row.popover(panel="VIEW3D_PT_sculpt_symmetry_for_topbar", text="") - elif mode_string == 'PAINT_TEXTURE': - _row, sub = row_for_mirror() - ipaint = context.tool_settings.image_paint - sub.prop(ipaint, "use_symmetry_x", text="X", toggle=True) - sub.prop(ipaint, "use_symmetry_y", text="Y", toggle=True) - sub.prop(ipaint, "use_symmetry_z", text="Z", toggle=True) - # No need for a popover, the panel only has these options. - elif mode_string == 'PAINT_VERTEX': - row, sub = row_for_mirror() - vpaint = context.tool_settings.vertex_paint - sub.prop(vpaint, "use_symmetry_x", text="X", toggle=True) - sub.prop(vpaint, "use_symmetry_y", text="Y", toggle=True) - sub.prop(vpaint, "use_symmetry_z", text="Z", toggle=True) - row.popover(panel="VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar", text="") + sub.prop(context.object.data, "use_mirror_x", text="X", toggle=True) + sub.prop(context.object.data, "use_mirror_y", text="Y", toggle=True) + sub.prop(context.object.data, "use_mirror_z", text="Z", toggle=True) + if mode_string == 'EDIT_MESH': + tool_settings = context.tool_settings + layout.prop(tool_settings, "use_mesh_automerge", text="") + elif mode_string == 'PAINT_WEIGHT': + row.popover(panel="VIEW3D_PT_tools_weightpaint_symmetry_for_topbar", text="") + elif mode_string == 'SCULPT': + row.popover(panel="VIEW3D_PT_sculpt_symmetry_for_topbar", text="") + elif mode_string == 'PAINT_VERTEX': + row.popover(panel="VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar", text="") # Expand panels from the side-bar as popovers. popover_kw = {"space_type": 'VIEW_3D', "region_type": 'UI', "category": "Tool"} diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 6359426128f..5a7d335ce3a 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -123,16 +123,16 @@ class View3DPanel: # **************** standard tool clusters ****************** # Used by vertex & weight paint -def draw_vpaint_symmetry(layout, vpaint): +def draw_vpaint_symmetry(layout, vpaint, mesh): col = layout.column() col.use_property_split = True col.use_property_decorate = False row = col.row(heading="Mirror", align=True) - row.prop(vpaint, "use_symmetry_x", text="X", toggle=True) - row.prop(vpaint, "use_symmetry_y", text="Y", toggle=True) - row.prop(vpaint, "use_symmetry_z", text="Z", toggle=True) + row.prop(mesh, "use_mirror_x", text="X", toggle=True) + row.prop(mesh, "use_mirror_y", text="Y", toggle=True) + row.prop(mesh, "use_mirror_z", text="Z", toggle=True) col.prop(vpaint, "radial_symmetry", text="Radial") @@ -397,6 +397,7 @@ class VIEW3D_PT_tools_brush_settings_advanced(Panel, View3DPaintBrushPanel): bl_options = {'DEFAULT_CLOSED'} bl_ui_units_x = 14 + def draw(self, context): layout = self.layout @@ -907,9 +908,10 @@ class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel): sculpt = context.tool_settings.sculpt row = layout.row(align=True, heading="Mirror") - row.prop(sculpt, "use_symmetry_x", text="X", toggle=True) - row.prop(sculpt, "use_symmetry_y", text="Y", toggle=True) - row.prop(sculpt, "use_symmetry_z", text="Z", toggle=True) + mesh = context.object.data + row.prop(mesh, "use_mirror_x", text="X", toggle=True) + row.prop(mesh, "use_mirror_y", text="Y", toggle=True) + row.prop(mesh, "use_mirror_z", text="Z", toggle=True) row = layout.row(align=True, heading="Lock") row.prop(sculpt, "lock_x", text="X", toggle=True) @@ -957,7 +959,12 @@ class VIEW3D_PT_tools_weightpaint_symmetry(Panel, View3DPaintPanel): layout = self.layout tool_settings = context.tool_settings wpaint = tool_settings.weight_paint - draw_vpaint_symmetry(layout, wpaint) + draw_vpaint_symmetry(layout, wpaint, context.object.data) + + col = layout.column() + row = col.row(align=True) + row.prop(context.object.data, 'use_mirror_vertex_group_x') + class VIEW3D_PT_tools_weightpaint_symmetry_for_topbar(Panel): @@ -1035,7 +1042,7 @@ class VIEW3D_PT_tools_vertexpaint_symmetry(Panel, View3DPaintPanel): layout = self.layout tool_settings = context.tool_settings vpaint = tool_settings.vertex_paint - draw_vpaint_symmetry(layout, vpaint) + draw_vpaint_symmetry(layout, vpaint, context.object.data) class VIEW3D_PT_tools_vertexpaint_symmetry_for_topbar(Panel): @@ -1091,9 +1098,6 @@ class VIEW3D_PT_tools_imagepaint_symmetry(Panel, View3DPaintPanel): def draw(self, context): layout = self.layout - tool_settings = context.tool_settings - ipaint = tool_settings.image_paint - split = layout.split() col = split.column() @@ -1103,9 +1107,10 @@ class VIEW3D_PT_tools_imagepaint_symmetry(Panel, View3DPaintPanel): col = split.column() row = col.row(align=True) - row.prop(ipaint, "use_symmetry_x", text="X", toggle=True) - row.prop(ipaint, "use_symmetry_y", text="Y", toggle=True) - row.prop(ipaint, "use_symmetry_z", text="Z", toggle=True) + mesh = context.object.data + row.prop(mesh, "use_mirror_x", text="X", toggle=True) + row.prop(mesh, "use_mirror_y", text="Y", toggle=True) + row.prop(mesh, "use_mirror_z", text="Z", toggle=True) # TODO, move to space_view3d.py -- cgit v1.2.3