From d9fcbe2f59d164a783f2ef798c2c412014aa7b70 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 21 Jul 2012 01:09:11 +0000 Subject: remove BMO_OP_FLAG_RATIONALIZE_NORMALS option which wasnt used anywhere. --- source/blender/bmesh/bmesh_class.h | 2 - source/blender/bmesh/intern/bmesh_mesh.c | 62 ++---------------------- source/blender/bmesh/intern/bmesh_mesh.h | 4 +- source/blender/bmesh/intern/bmesh_operator_api.h | 12 ++--- source/blender/bmesh/intern/bmesh_operators.c | 4 +- 5 files changed, 11 insertions(+), 73 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index 737efde8391..3bd99b748f6 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -198,8 +198,6 @@ typedef struct BMesh { ListBase errorstack; void *py_handle; - - int opflag; /* current operator flag */ } BMesh; /* BMHeader->htype (char) */ 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); diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h index 0441f38b429..8b6ef9aa3e0 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.h +++ b/source/blender/bmesh/intern/bmesh_mesh.h @@ -37,8 +37,8 @@ void BM_mesh_clear(BMesh *bm); void BM_mesh_normals_update(BMesh *bm, const short skip_hidden); -void bmesh_edit_begin(BMesh *bm, int flag); -void bmesh_edit_end(BMesh *bm, int flag); +void bmesh_edit_begin(BMesh *bm, int type_flag); +void bmesh_edit_end(BMesh *bm, int type_flag); void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag); void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func, diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 23062937e03..a2f14ef8388 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -162,14 +162,10 @@ typedef struct BMOpDefine { int type_flag; } BMOpDefine; -/* BMOpDefine->flag */ -#define BMO_OP_FLAG_UNTAN_MULTIRES 1 /*switch from multires tangent space to absolute coordinates*/ - -/* ensures consistent normals before operator execution, - * restoring the original ones windings/normals afterwards. - * keep in mind, this won't work if the input mesh isn't - * manifold.*/ -#define BMO_OP_FLAG_RATIONALIZE_NORMALS 2 +/* BMOpDefine->type_flag */ +enum { + BMO_OP_FLAG_UNTAN_MULTIRES = 1 /*switch from multires tangent space to absolute coordinates*/ +}; /*------------- Operator API --------------*/ diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 8b8824f29e3..0f2dc7041fa 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -174,11 +174,11 @@ void BMO_op_exec(BMesh *bm, BMOperator *op) BMO_push(bm, op); if (bm->stackdepth == 2) - bmesh_edit_begin(bm, op->flag); + bmesh_edit_begin(bm, op->type_flag); op->exec(bm, op); if (bm->stackdepth == 2) - bmesh_edit_end(bm, op->flag); + bmesh_edit_end(bm, op->type_flag); BMO_pop(bm); } -- cgit v1.2.3