diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 17:00:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 17:00:43 +0400 |
commit | d6b9fb36d85eac730ce9a3deb6211fb0c3c0a5ec (patch) | |
tree | 3b3af5257b60bb3e984f4ccc8898dc6f82f67b2a /source/blender | |
parent | f560d25666b6aa7b1451a5626525505183f8fffa (diff) |
fix leak in BM_face_split() with multires if the split failed.
also remove redundant normal copy.
only triangulate the mesh if its needed when enabling dyntopo.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 1 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 9 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 8 |
3 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 3df5cab0340..bee5a7c7d39 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -794,6 +794,7 @@ void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, BMHeader *ele_dst = ele_dst_v; BLI_assert(ele_src->htype == ele_dst->htype); + BLI_assert(ele_src != ele_dst); if ((hflag_mask & BM_ELEM_SELECT) == 0) { /* First we copy select */ diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 3131b389b64..3ffdd0f86a6 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -356,10 +356,9 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l if (f_new) { BM_elem_attrs_copy(bm, bm, f, f_new); - copy_v3_v3(f_new->no, f->no); /* handle multires update */ - if (has_mdisp && (f_new != f)) { + if (has_mdisp) { BMLoop *l_iter; BMLoop *l_first; @@ -373,8 +372,6 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l BM_loop_interp_multires(bm, l_iter, f_tmp); } while ((l_iter = l_iter->next) != l_first); - BM_face_kill(bm, f_tmp); - #if 0 /* BM_face_multires_bounds_smooth doesn't flip displacement correct */ BM_face_multires_bounds_smooth(bm, f); @@ -383,6 +380,10 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l } } + if (has_mdisp) { + BM_face_kill(bm, f_tmp); + } + return f_new; } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index d4a10781368..e7b79adc6c7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4568,7 +4568,9 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) static void sculpt_dynamic_topology_triangulate(BMesh *bm) { - BM_mesh_triangulate(bm, false, false, NULL, NULL); + if (bm->totloop != bm->totface * 3) { + BM_mesh_triangulate(bm, false, false, NULL, NULL); + } } void sculpt_pbvh_clear(Object *ob) @@ -4807,8 +4809,8 @@ static int sculpt_symmetrize_exec(bContext *C, wmOperator *UNUSED(op)) /* Symmetrize and re-triangulate */ BMO_op_callf(ss->bm, BMO_FLAG_DEFAULTS, - "symmetrize input=%avef direction=%i", - sd->symmetrize_direction); + "symmetrize input=%avef direction=%i dist=%f", + sd->symmetrize_direction, 0.00001f); sculpt_dynamic_topology_triangulate(ss->bm); /* Finish undo */ |