diff options
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mesh.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 62 |
1 files changed, 3 insertions, 59 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 99d713d3231..cf593627e8d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -290,47 +290,6 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden) MEM_freeN(edgevec); } -/* - * This function ensures correct normals for the mesh, but - * sets the flag BM_ELEM_TAG in flipped faces, to allow restoration - * of original normals. - * - * if undo is 0: calculate right normals - * if undo is 1: restore original normals - */ - -//keep in sycn with utils.c! -#define FACE_FLIP 8 -static void bm_rationalize_normals(BMesh *bm, int undo) -{ - BMOperator bmop; - BMFace *f; - BMIter iter; - - if (undo) { - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (BM_elem_flag_test(f, BM_ELEM_TAG)) { - BM_face_normal_flip(bm, f); - } - BM_elem_flag_disable(f, BM_ELEM_TAG); - } - - return; - } - - BMO_op_initf(bm, &bmop, BMO_FLAG_DEFAULTS, "recalc_face_normals faces=%af do_flip=%b", FALSE); - - BMO_push(bm, &bmop); - bmo_recalc_face_normals_exec(bm, &bmop); - - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP)); - } - - BMO_pop(bm); - BMO_op_finish(bm, &bmop); -} - static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from, int to) { /* switch multires data out of tangent space */ @@ -390,10 +349,8 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from * the editing operations are done. These are called by the tools/operator * API for each time a tool is executed. */ -void bmesh_edit_begin(BMesh *bm, int flag) +void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag)) { - bm->opflag = flag; - /* Most operators seem to be using BMO_OP_FLAG_UNTAN_MULTIRES to change the MDisps to * absolute space during mesh edits. With this enabled, changes to the topology * (loop cuts, edge subdivides, etc) are not reflected in the higher levels of @@ -401,27 +358,20 @@ void bmesh_edit_begin(BMesh *bm, int flag) * until this is shown to be better for certain types of mesh edits. */ #if BMOP_UNTAN_MULTIRES_ENABLED /* switch multires data out of tangent space */ - if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) { + if ((type_flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) { bmesh_mdisps_space_set(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE); /* ensure correct normals, if possible */ bmesh_rationalize_normals(bm, 0); BM_mesh_normals_update(bm); } - else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) { - bmesh_rationalize_normals(bm, 0); - } -#else - if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) { - bm_rationalize_normals(bm, 0); - } #endif } /** * \brief BMesh End Edit */ -void bmesh_edit_end(BMesh *bm, int flag) +void bmesh_edit_end(BMesh *bm, int UNUSED(flag)) { /* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */ #if BMOP_UNTAN_MULTIRES_ENABLED @@ -434,14 +384,8 @@ void bmesh_edit_end(BMesh *bm, int flag) else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) { bmesh_rationalize_normals(bm, 1); } -#else - if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) { - bm_rationalize_normals(bm, 1); - } #endif - bm->opflag = 0; - /* compute normals, clear temp flags and flush selections */ BM_mesh_normals_update(bm, TRUE); BM_mesh_select_mode_flush(bm); |