[Bf-blender-cvs] [5502517c3c1] master: Unify all XYZ symmetry options using Mesh Symmetry
Pablo Dobarro
noreply at git.blender.org
Fri Sep 18 19:59:57 CEST 2020
Commit: 5502517c3c12086c111ae5477fae9c0d2eb8a84c
Author: Pablo Dobarro
Date: Fri Sep 18 19:58:48 2020 +0200
Branches: master
https://developer.blender.org/rB5502517c3c12086c111ae5477fae9c0d2eb8a84c
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
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenloader/intern/versioning_290.c
M source/blender/draw/intern/draw_cache_impl_mesh.c
M source/blender/editors/mesh/editmesh_tools.c
M source/blender/editors/object/object_remesh.c
M source/blender/editors/object/object_vgroup.c
M source/blender/editors/physics/particle_edit.c
M source/blender/editors/sculpt_paint/paint_cursor.c
M source/blender/editors/sculpt_paint/paint_image_proj.c
M source/blender/editors/sculpt_paint/paint_mask.c
M source/blender/editors/sculpt_paint/paint_vertex.c
M source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
M source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_automasking.c
M source/blender/editors/sculpt_paint/sculpt_boundary.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
M source/blender/editors/sculpt_paint/sculpt_mask_expand.c
M source/blender/editors/sculpt_paint/sculpt_pose.c
M source/blender/editors/sculpt_paint/sculpt_transform.c
M source/blender/editors/transform/transform_generics.c
M source/blender/makesdna/DNA_mesh_types.h
M source/blender/makesrna/intern/rna_mesh.c
===================================================================
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
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 1d4912db330..a8452887791 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -750,5 +750,14 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Unify symmetry as a mesh property. */
+ if (!DNA_struct_elem_find(fd->filesdna, "Mesh", "char", "symmetry")) {
+ LISTBASE_FOREACH (Mesh *, mesh, &bmain->meshes) {
+ /* The previous flags used to store mesh symmery in edit mode match the new ones that are
+ * used in mesh->symmery. */
+ mesh->symmetry = mesh->editflag & (ME_SYMMETRY_X | ME_SYMMETRY_Y | ME_SYMMETRY_Z);
+ }
+ }
}
}
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 6df0c7cc5ad..66865fcfde6 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -395,7 +395,7 @@ static void drw_mesh_weight_state_extract(Object *ob,
wstate->flags |= DRW_MESH_WEIGHT_STATE_MULTIPAINT |
(ts->auto_normalize ? DRW_MESH_WEIGHT_STATE_AUTO_NORMALIZE : 0);
- if (me->editflag & ME_EDIT_MIRROR_X) {
+ if (me->symmetry & ME_SYMMETRY_X) {
BKE_object_defgroup_mirror_selection(ob,
wstate->defgroup_len,
wstate->defgroup_sel,
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 4e1a56b3b55..c52381b5e2a 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2512,7 +2512,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
}
/* mirror before smooth */
- if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
+ if (((Mesh *)obedit->data)->symmetry & ME_SYMMETRY_X) {
EDBM_verts_mirror_cache_begin(em, 0, false, true, false, use_topology);
}
@@ -2559,7 +2559,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
}
/* apply
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list