[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49097] trunk/blender/source/blender/bmesh : remove BMO_OP_FLAG_RATIONALIZE_NORMALS option which wasnt used anywhere.

Campbell Barton ideasman42 at gmail.com
Sat Jul 21 03:09:13 CEST 2012


Revision: 49097
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49097
Author:   campbellbarton
Date:     2012-07-21 01:09:11 +0000 (Sat, 21 Jul 2012)
Log Message:
-----------
remove BMO_OP_FLAG_RATIONALIZE_NORMALS option which wasnt used anywhere.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/bmesh_class.h
    trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c
    trunk/blender/source/blender/bmesh/intern/bmesh_mesh.h
    trunk/blender/source/blender/bmesh/intern/bmesh_operator_api.h
    trunk/blender/source/blender/bmesh/intern/bmesh_operators.c

Modified: trunk/blender/source/blender/bmesh/bmesh_class.h
===================================================================
--- trunk/blender/source/blender/bmesh/bmesh_class.h	2012-07-21 00:58:02 UTC (rev 49096)
+++ trunk/blender/source/blender/bmesh/bmesh_class.h	2012-07-21 01:09:11 UTC (rev 49097)
@@ -198,8 +198,6 @@
 	ListBase errorstack;
 
 	void *py_handle;
-
-	int opflag; /* current operator flag */
 } BMesh;
 
 /* BMHeader->htype (char) */

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c	2012-07-21 00:58:02 UTC (rev 49096)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c	2012-07-21 01:09:11 UTC (rev 49097)
@@ -290,47 +290,6 @@
 	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 @@
  * 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 @@
 	 * 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 @@
 	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);

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_mesh.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_mesh.h	2012-07-21 00:58:02 UTC (rev 49096)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_mesh.h	2012-07-21 01:09:11 UTC (rev 49097)
@@ -37,8 +37,8 @@
 
 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,

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_operator_api.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_operator_api.h	2012-07-21 00:58:02 UTC (rev 49096)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_operator_api.h	2012-07-21 01:09:11 UTC (rev 49097)
@@ -162,15 +162,11 @@
 	int type_flag;
 } BMOpDefine;
 
-/* BMOpDefine->flag */
-#define BMO_OP_FLAG_UNTAN_MULTIRES		1 /*switch from multires tangent space to absolute coordinates*/
+/* BMOpDefine->type_flag */
+enum {
+	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
-
 /*------------- Operator API --------------*/
 
 /* data types that use pointers (arrays, etc) should never

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_operators.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_operators.c	2012-07-21 00:58:02 UTC (rev 49096)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_operators.c	2012-07-21 01:09:11 UTC (rev 49097)
@@ -174,11 +174,11 @@
 	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);
 }




More information about the Bf-blender-cvs mailing list