Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-11-25 12:22:32 +0300
committerSergey Sharybin <sergey@blender.org>2021-11-25 12:22:32 +0300
commit5ffb9b6dc45f58cf2b880230d912496fed0dd9ed (patch)
tree792b650f8466c8df4fbe6a6f30095b0f36414bdc /source/blender/blenkernel
parent610e68590b7f0bc0a4345bfc21bc253ff760e70c (diff)
parenta0acb9bd0cc049b7b8b941b251c42684b4a0f274 (diff)
Merge remote-tracking branch 'origin/blender-v3.0-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_mesh_mirror.h10
-rw-r--r--source/blender/blenkernel/intern/mesh_mirror.c46
2 files changed, 41 insertions, 15 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_mirror.h b/source/blender/blenkernel/BKE_mesh_mirror.h
index 7b230b04410..eaa479be867 100644
--- a/source/blender/blenkernel/BKE_mesh_mirror.h
+++ b/source/blender/blenkernel/BKE_mesh_mirror.h
@@ -43,10 +43,12 @@ void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain,
const int axis,
const float dist);
-struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(struct MirrorModifierData *mmd,
- struct Object *ob,
- const struct Mesh *mesh,
- const int axis);
+struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(
+ struct MirrorModifierData *mmd,
+ struct Object *ob,
+ const struct Mesh *mesh,
+ const int axis,
+ const bool use_correct_order_on_merge);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index 6df13e71e72..2756629b440 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -137,7 +137,8 @@ void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain,
Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
Object *ob,
const Mesh *mesh,
- const int axis)
+ const int axis,
+ const bool use_correct_order_on_merge)
{
const float tolerance_sq = mmd->tolerance * mmd->tolerance;
const bool do_vtargetmap = (mmd->flag & MOD_MIR_NO_MERGE) == 0;
@@ -266,23 +267,46 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
* Always merge from the copied into the original vertices so it's possible to
* generate a 1:1 mapping by scanning vertices from the beginning of the array
* as is done in #BKE_editmesh_vert_coords_when_deformed. Without this,
- * the coordinates returned will sometimes point to the copied vertex locations, see: T91444.
+ * the coordinates returned will sometimes point to the copied vertex locations, see:
+ * T91444.
+ *
+ * However, such a change also affects non-versionable things like some modifiers binding, so
+ * we cannot enforce that behavior on existing modifiers, in which case we keep using the
+ * old, incorrect behavior of merging the source vertex into its copy.
*/
- if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) {
- *vtmap_b = i;
- tot_vtargetmap++;
+ if (use_correct_order_on_merge) {
+ if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) {
+ *vtmap_b = i;
+ tot_vtargetmap++;
+
+ /* average location */
+ mid_v3_v3v3(mv->co, mv_prev->co, mv->co);
+ copy_v3_v3(mv_prev->co, mv->co);
+ }
+ else {
+ *vtmap_b = -1;
+ }
- /* average location */
- mid_v3_v3v3(mv->co, mv_prev->co, mv->co);
- copy_v3_v3(mv_prev->co, mv->co);
+ /* Fill here to avoid 2x loops. */
+ *vtmap_a = -1;
}
else {
+ if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) {
+ *vtmap_a = maxVerts + i;
+ tot_vtargetmap++;
+
+ /* average location */
+ mid_v3_v3v3(mv->co, mv_prev->co, mv->co);
+ copy_v3_v3(mv_prev->co, mv->co);
+ }
+ else {
+ *vtmap_a = -1;
+ }
+
+ /* Fill here to avoid 2x loops. */
*vtmap_b = -1;
}
- /* Fill here to avoid 2x loops. */
- *vtmap_a = -1;
-
vtmap_a++;
vtmap_b++;
}