forked from bartvdbraak/blender
Fix #32398: Mirror modifier with "Merge" enabled producing pairs of faces
sharing the same set of vertices. Modified the CDDM_merge_verts function (currently only used by the Mirror modifier) to skip faces using all merged vertices.
This commit is contained in:
parent
83de5cb308
commit
a9eb610473
@ -2254,6 +2254,11 @@ void CDDM_calc_normals_tessface(DerivedMesh *dm)
|
||||
* this is a really horribly written function. ger. - joeedh
|
||||
*
|
||||
* note, CDDM_recalc_tessellation has to run on the returned DM if you want to access tessfaces.
|
||||
*
|
||||
* Note: This function is currently only used by the Mirror modifier, so it
|
||||
* skips any faces that have all vertices merged (to avoid creating pairs
|
||||
* of faces sharing the same set of vertices). If used elsewhere, it may
|
||||
* be necessary to make this functionality optional.
|
||||
*/
|
||||
DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
|
||||
{
|
||||
@ -2297,14 +2302,11 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
|
||||
newv[i] = newv[vtargetmap[i]];
|
||||
}
|
||||
}
|
||||
|
||||
/* find-replace merged vertices with target vertices */
|
||||
ml = cddm->mloop;
|
||||
for (i = 0; i < totloop; i++, ml++) {
|
||||
if (vtargetmap[ml->v] != -1) {
|
||||
ml->v = vtargetmap[ml->v];
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't remap vertices in cddm->mloop, because we need to know the original
|
||||
indices in order to skip faces with all vertices merged.
|
||||
The "update loop indices..." section further down remaps vertices in mloop.
|
||||
*/
|
||||
|
||||
/* now go through and fix edges and faces */
|
||||
med = cddm->medge;
|
||||
@ -2338,6 +2340,25 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
|
||||
|
||||
ml = cddm->mloop + mp->loopstart;
|
||||
|
||||
/* skip faces with all vertices merged */
|
||||
{
|
||||
int all_vertices_merged = TRUE;
|
||||
|
||||
for (j = 0; j < mp->totloop; j++, ml++) {
|
||||
if (vtargetmap[ml->v] == -1) {
|
||||
all_vertices_merged = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (UNLIKELY(all_vertices_merged))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ml = cddm->mloop + mp->loopstart;
|
||||
|
||||
c = 0;
|
||||
for (j = 0; j < mp->totloop; j++, ml++) {
|
||||
med = cddm->medge + ml->e;
|
||||
|
Loading…
Reference in New Issue
Block a user