From 32700316600aad17ed5ae2620ed42d239e41e443 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Jul 2013 06:05:44 +0000 Subject: correct problem with limited-dissolve not leaving the selection correctly (caused by BM_elem_attrs_copy no longer dealing with selection) --- source/blender/bmesh/intern/bmesh_opdefines.c | 7 ++++--- source/blender/bmesh/operators/bmo_dissolve.c | 5 ++++- source/blender/bmesh/tools/bmesh_decimate.h | 3 ++- source/blender/bmesh/tools/bmesh_decimate_dissolve.c | 9 +++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 497c9e1c153..784732295ed 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -947,7 +947,9 @@ static BMOpDefine bmo_dissolve_limit_def = { {"delimit", BMO_OP_SLOT_INT}, {{'\0'}}, }, - {{{'\0'}}}, /* no output */ + /* slots_out */ + {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}}, bmo_dissolve_limit_exec, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; @@ -1044,7 +1046,7 @@ static BMOpDefine bmo_subdivide_edgering_def = { {{'\0'}}, }, {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}}, /* no output */ + {{'\0'}}}, bmo_subdivide_edgering_exec, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; @@ -1224,7 +1226,6 @@ static BMOpDefine bmo_rotate_uvs_def = { {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */ {{'\0'}}, }, - /* slots_out */ {{{'\0'}}}, /* no output */ bmo_rotate_uvs_exec, BMO_OPTYPE_FLAG_NOP, diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index e4f2423ca17..a3f67450380 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -430,5 +430,8 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries, delimit, (BMVert **)BMO_SLOT_AS_BUFFER(vinput), vinput->len, - (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len); + (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len, + FACE_NEW); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW); } diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h index c77cb18c518..a1b26990587 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.h +++ b/source/blender/bmesh/tools/bmesh_decimate.h @@ -35,7 +35,8 @@ void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations); void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit, BMVert **vinput_arr, const int vinput_len, - BMEdge **einput_arr, const int einput_len); + BMEdge **einput_arr, const int einput_len, + const short oflag_out); void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit); diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c index 9d4e01d19cd..9f97d8f4287 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c @@ -72,7 +72,8 @@ static int dissolve_elem_cmp(const void *a1, const void *a2) void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit, BMVert **vinput_arr, const int vinput_len, - BMEdge **einput_arr, const int einput_len) + BMEdge **einput_arr, const int einput_len, + const short oflag_out) { const float angle_max = (float)M_PI / 2.0f; DissolveElemWeight *weight_elems = MEM_mallocN(max_ii(einput_len, vinput_len) * @@ -155,6 +156,9 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool /* there may be some errors, we don't mind, just move on */ if (f_new) { BM_face_normal_update(f_new); + if (oflag_out) { + BMO_elem_flag_enable(bm, f_new, oflag_out); + } } else { BMO_error_clear(bm); @@ -269,7 +273,8 @@ void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries, delimit, vinput_arr, vinput_len, - einput_arr, einput_len); + einput_arr, einput_len, + 0); MEM_freeN(vinput_arr); MEM_freeN(einput_arr); -- cgit v1.2.3