Fix T43716 regression in mask modifier - edges could access out of

bounds indices of vertices.

Issue here is that if we copy edge customdata the MEdge data that were
previously written get overwritten, solution is to write indices and
flags last (probably writing flags is superfluous here).
This commit is contained in:
Antonis Ryakiotakis 2015-02-18 17:58:57 +01:00
parent c9fa37fbcd
commit 839a6b22d6
Notes: blender-bot 2023-02-14 10:32:59 +01:00
Referenced by issue #43716, Regression: Mask Modifier Creates "Web" of Phantom Lines
1 changed files with 3 additions and 4 deletions

View File

@ -293,7 +293,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
mloop_dst = CDDM_get_loops(result);
medge_dst = CDDM_get_edges(result);
mvert_dst = CDDM_get_verts(result);
/* using ghash-iterators, map data into new mesh */
/* vertices */
GHASH_ITER (gh_iter, vertHash) {
@ -318,12 +318,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
e_src = &medge_src[i_src];
e_dst = &medge_dst[i_dst];
DM_copy_edge_data(dm, result, i_src, i_dst, 1);
*e_dst = *e_src;
e_dst->v1 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v1)));
e_dst->v2 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v2)));
DM_copy_edge_data(dm, result, i_src, i_dst, 1);
}
/* faces */