diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-15 18:18:27 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-15 18:20:07 +0400 |
commit | e4c2a3c31cf262fcf5d3577552e66b1c5e63218f (patch) | |
tree | cae7af23fb84a9ea564a67ecfb93341b1a906ff2 /source/blender/blenkernel | |
parent | a15ae564217f2b47848c337e477068be0e150973 (diff) |
Various fixes/improvements regarding BMesh's elem_index_dirty and BM_LOOP handling.
Most notably, BM_LOOP and BM_FACE index recompute should now be fully decoupled.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifiers_bmesh.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 176ef505a9a..b1bf1b4889f 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -2162,6 +2162,8 @@ static DerivedMesh *cddm_from_bmesh_ex(struct BMesh *bm, const bool use_mdisps, mloop->e = BM_elem_index_get(l_iter->e); CustomData_from_bmesh_block(&bm->ldata, &dm->loopData, l_iter->head.data, j); + BM_elem_index_set(l_iter, j); /* set_inline */ + j++; mloop++; } while ((l_iter = l_iter->next) != l_first); @@ -2170,7 +2172,7 @@ static DerivedMesh *cddm_from_bmesh_ex(struct BMesh *bm, const bool use_mdisps, if (add_orig) *index++ = i; } - bm->elem_index_dirty &= ~BM_FACE; + bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP); dm->cd_flag = BM_mesh_cd_flag_from_bmesh(bm); diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index 13368be1acb..3cb607730d4 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -176,7 +176,8 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm, const bool calc_face_normal) l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { /* Save index of correspsonding MLoop */ - CustomData_to_bmesh_block(&dm->loopData, &bm->ldata, j++, &l_iter->head.data, true); + CustomData_to_bmesh_block(&dm->loopData, &bm->ldata, j, &l_iter->head.data, true); + BM_elem_index_set(l_iter, j++); /* set_inline */ } while ((l_iter = l_iter->next) != l_first); CustomData_to_bmesh_block(&dm->polyData, &bm->pdata, i, &f->head.data, true); @@ -195,7 +196,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm, const bool calc_face_normal) *orig_index = ORIGINDEX_NONE; } } - if (is_init) bm->elem_index_dirty &= ~BM_FACE; + if (is_init) bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP); MEM_freeN(vtable); MEM_freeN(etable); |