[Bf-blender-cvs] [1d4ea9d881a] soc-2018-npr: Fix smooth contour modifier for API changes

Yiming Wu noreply at git.blender.org
Fri Dec 14 07:58:56 CET 2018


Commit: 1d4ea9d881a9efd1d92a9fbf5ffee74b14ff7825
Author: Yiming Wu
Date:   Fri Dec 14 14:57:51 2018 +0800
Branches: soc-2018-npr
https://developer.blender.org/rB1d4ea9d881a9efd1d92a9fbf5ffee74b14ff7825

Fix smooth contour modifier for API changes

===================================================================

M	source/blender/modifiers/intern/MOD_mybmesh.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_mybmesh.c b/source/blender/modifiers/intern/MOD_mybmesh.c
index c1723f744d7..efbb5346ade 100644
--- a/source/blender/modifiers/intern/MOD_mybmesh.c
+++ b/source/blender/modifiers/intern/MOD_mybmesh.c
@@ -2772,7 +2772,7 @@ static int radial_extention( MeshData *m_d ){
 		bool flipped_edge = false;
 		float cent_f[3], no[3];
 		BM_ITER_ELEM (face, &iter, r_vert.vert, BM_FACES_OF_VERT) {
-			BM_face_calc_center_mean(face, cent_f);
+			BM_face_calc_center_median(face, cent_f); /* yiming:    suppose should be this fix */
 			BM_face_calc_normal(face, no);
 
 			float face_dir = get_facing_dir_nor(m_d->cam_loc, cent_f, no);
@@ -2912,7 +2912,7 @@ static int radial_extention( MeshData *m_d ){
 					float new_diff_facing = 0;
 
 					BM_ITER_ELEM (face, &iter, r_vert.vert, BM_FACES_OF_VERT) {
-						BM_face_calc_center_mean(face, cent_f);
+						BM_face_calc_center_median(face, cent_f);
 						BM_face_calc_normal(face, no);
 
 						float face_dir = get_facing_dir_nor(m_d->cam_loc, cent_f, no);
@@ -2963,7 +2963,7 @@ static void null_opti_edge(MeshData *m_d, BMEdge *e, bool back_f, BLI_Buffer *in
 	BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
 		float no[3], P[3];
 		BM_face_calc_normal(f, no);
-		BM_face_calc_center_mean(f, P);
+		BM_face_calc_center_median(f, P);
 		bool found_face = false;
         bool face_good = (back_f == calc_if_B_nor(m_d->cam_loc, P, no));
 
@@ -2992,7 +2992,7 @@ static void null_opti_vert(MeshData *m_d, BMVert *v, bool back_f, BLI_Buffer *in
 	BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
 		float no[3], P[3];
 		BM_face_calc_normal(f, no);
-		BM_face_calc_center_mean(f, P);
+		BM_face_calc_center_median(f, P);
 		bool found_face = false;
         bool face_good = (back_f == calc_if_B_nor(m_d->cam_loc, P, no));
 
@@ -3128,7 +3128,7 @@ static int opti_vertex_wiggle( MeshData *m_d, BLI_Buffer *inco_faces ){
 					float no[3];
 					float P[3];
 					BM_face_calc_normal(f, no);
-					BM_face_calc_center_mean(f, P);
+					BM_face_calc_center_median(f, P);
 
 					float face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
 					if( inface->back_f != (face_dir < 0) ){
@@ -3221,7 +3221,7 @@ static int opti_vertex_wiggle( MeshData *m_d, BLI_Buffer *inco_faces ){
 								float no[3];
 								float P[3];
 								BM_face_calc_normal(f, no);
-								BM_face_calc_center_mean(f, P);
+								BM_face_calc_center_median(f, P);
 
 								if( dot_v3v3(no, vert->no) < 0.0f ){
 									//Punish flipped faces
@@ -3347,7 +3347,7 @@ static void optimization( MeshData *m_d ){
 						}
 
 					}
-					BM_face_calc_center_mean(face, P);
+					BM_face_calc_center_median(face, P);
 					BM_face_calc_normal(face, no);
 
 					if( b_f != calc_if_B_nor(m_d->cam_loc, P, no) ){
@@ -3417,7 +3417,7 @@ static void optimization( MeshData *m_d ){
 					BMIter iter_f;
 					BM_ITER_ELEM (face, &iter_f, edge, BM_FACES_OF_EDGE) {
 						BM_face_calc_normal(face, no);
-						BM_face_calc_center_mean(face, P);
+						BM_face_calc_center_median(face, P);
 
 						//Calc facing of face
 						face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
@@ -3663,7 +3663,7 @@ static void optimization( MeshData *m_d ){
 				float no[3];
 				float P[3];
 				BM_face_calc_normal(f, no);
-				BM_face_calc_center_mean(f, P);
+				BM_face_calc_center_median(f, P);
 
 				float face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
 				if( inface->back_f != (face_dir < 0) ){
@@ -3705,7 +3705,7 @@ static void optimization( MeshData *m_d ){
 							float no[3];
 							float P[3];
 							BM_face_calc_normal(f, no);
-							BM_face_calc_center_mean(f, P);
+							BM_face_calc_center_median(f, P);
 
 							float face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
 							if( inface->back_f != (face_dir < 0) ){
@@ -3922,7 +3922,7 @@ static void optimization( MeshData *m_d ){
 							float no[3];
 							float P[3];
 							BM_face_calc_normal(face, no);
-							BM_face_calc_center_mean(face, P);
+							BM_face_calc_center_median(face, P);
 
 							if( inface->back_f != calc_if_B_nor(m_d->cam_loc, P, no) ){
 								//Bad vertex move
@@ -3978,7 +3978,7 @@ static void optimization( MeshData *m_d ){
 					float no[3];
 					float P[3];
 					BM_face_calc_normal(f, no);
-					BM_face_calc_center_mean(f, P);
+					BM_face_calc_center_median(f, P);
 
 					float face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
 					if( inface->back_f != (face_dir < 0) ){
@@ -4028,7 +4028,7 @@ static void optimization( MeshData *m_d ){
 						float no[3];
 						float P[3];
 						BM_face_calc_normal(f, no);
-						BM_face_calc_center_mean(f, P);
+						BM_face_calc_center_median(f, P);
 
 						float face_dir = get_facing_dir_nor(m_d->cam_loc, P, no);
 						if( inface->back_f != (face_dir < 0) ){
@@ -4152,7 +4152,7 @@ static void debug_colorize(BMesh *bm, const float cam_loc[3]){
 		if( f->mat_nr == 4 ){
 			continue;
 		}
-		BM_face_calc_center_mean(f, P);
+		BM_face_calc_center_median(f, P);
 		if( calc_if_B_nor(cam_loc, P, f->no) ){
 			f->mat_nr = 1;
 		} else {
@@ -4186,7 +4186,7 @@ static void debug_colorize_radi( MeshData *m_d ){
 					if( f->mat_nr == 4 ){
 						continue;
 					}
-					BM_face_calc_center_mean(f, P);
+					BM_face_calc_center_median(f, P);
 					if( calc_if_B_nor(m_d->cam_loc, P, f->no) ){
 						f->mat_nr = 3;
 					} else {



More information about the Bf-blender-cvs mailing list