[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44964] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Style cleanup in sculpt.c, no functional changes.

Nicholas Bishop nicholasbishop at gmail.com
Sun Mar 18 10:35:11 CET 2012


Revision: 44964
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44964
Author:   nicholasbishop
Date:     2012-03-18 09:35:09 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
Style cleanup in sculpt.c, no functional changes.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-03-18 09:27:36 UTC (rev 44963)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2012-03-18 09:35:09 UTC (rev 44964)
@@ -194,7 +194,6 @@
 	/* Variants */
 	float radius;
 	float radius_squared;
-	//float traced_location[3];
 	float true_location[3];
 	float location[3];
 
@@ -348,8 +347,7 @@
 
 static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
 {
-	static const float side = 0.70710678118654752440084436210485; // sqrt(.5);
-
+	float side = M_SQRT1_2;
 	float local_co[3];
 
 	mul_v3_m4v3(local_co, local, co);
@@ -481,7 +479,7 @@
 	float mirror[3];
 	float distsq;
 	
-	//flip_coord(mirror, cache->traced_location, symm);
+	/* flip_coord(mirror, cache->traced_location, symm); */
 	flip_coord(mirror, cache->true_location, symm);
 
 	if(axis != 0) {
@@ -490,7 +488,7 @@
 		mul_m4_v3(mat, mirror);
 	}
 
-	//distsq = len_squared_v3v3(mirror, cache->traced_location);
+	/* distsq = len_squared_v3v3(mirror, cache->traced_location); */
 	distsq = len_squared_v3v3(mirror, cache->true_location);
 
 	if (distsq <= 4.0f*(cache->radius_squared))
@@ -672,7 +670,8 @@
 			point_2d[0] -= ss->cache->tex_mouse[0];
 			point_2d[1] -= ss->cache->tex_mouse[1];
 
-			radius = ss->cache->pixel_radius; // use pressure adjusted size for fixed mode
+			/* use pressure adjusted size for fixed mode */
+			radius = ss->cache->pixel_radius;
 
 			x = point_2d[0] + ss->cache->vc->ar->winrct.xmin;
 			y = point_2d[1] + ss->cache->vc->ar->winrct.ymin;
@@ -680,7 +679,8 @@
 		else /* else (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) */
 			 /* leave the coordinates relative to the screen */
 		{
-			radius = brush_size(ss->cache->vc->scene, br); // use unadjusted size for tiled mode
+			/* use unadjusted size for tiled mode */
+			radius = brush_size(ss->cache->vc->scene, br);
 		
 			x = point_2d[0];
 			y = point_2d[1];
@@ -1208,7 +1208,6 @@
 
 				/* first we pinch */
 				sub_v3_v3v3(val1, test.location, vd.co);
-				//mul_v3_v3(val1, ss->cache->scale);
 				mul_v3_fl(val1, fade*flippedbstrength);
 
 				/* then we draw */
@@ -1536,9 +1535,8 @@
 		SculptBrushTest test;
 		SculptUndoNode *unode;
 		float (*origco)[3], *layer_disp;
-		//float (*proxy)[3]; // XXX layer brush needs conversion to proxy but its more complicated
-
-		//proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		/* XXX: layer brush needs conversion to proxy but its more complicated */
+		/* proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
 		
 		unode= sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
 		origco=unode->co;
@@ -1683,18 +1681,18 @@
 	SculptSession *ss = ob->sculpt;
 	int n;
 
-	// an
+	/* for area normal */
 	float out_flip[3] = {0.0f, 0.0f, 0.0f};
 
-	// fc
+	/* for flatten center */
 	float count = 0;
 
 	(void)sd; /* unused w/o openmp */
 	
-	// an
+	/* for area normal */
 	zero_v3(an);
 
-	// fc
+	/* for flatten center */
 	zero_v3(fc);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
@@ -1713,13 +1711,13 @@
 		if(ss->cache->original) {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 				if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
-					// an
+					/* for area normal */
 					float fno[3];
 
 					normal_short_to_float_v3(fno, unode->no[vd.i]);
 					add_norm_if(ss->cache->view_normal, private_an, private_out_flip, fno);
 
-					// fc
+					/* for flatten center */
 					add_v3_v3(private_fc, unode->co[vd.i]);
 					private_count++;
 				}
@@ -1729,7 +1727,7 @@
 		else {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 				if(sculpt_brush_test_fast(&test, vd.co)) {
-					// an
+					/* for area normal */
 					if(vd.no) {
 						float fno[3];
 
@@ -1740,7 +1738,7 @@
 						add_norm_if(ss->cache->view_normal, private_an, private_out_flip, vd.fno);
 					}
 
-					// fc
+					/* for flatten center */
 					add_v3_v3(private_fc, vd.co);
 					private_count++;
 				}
@@ -1750,23 +1748,23 @@
 
 		#pragma omp critical
 		{
-			// an
+			/* for area normal */
 			add_v3_v3(an, private_an);
 			add_v3_v3(out_flip, private_out_flip);
 
-			// fc
+			/* for flatten center */
 			add_v3_v3(fc, private_fc);
 			count += private_count;
 		}
 	}
 
-	// an
+	/* for area normal */
 	if (is_zero_v3(an))
 		copy_v3_v3(an, out_flip);
 
 	normalize_v3(an);
 
-	// fc
+	/* for flatten center */
 	if (count != 0) {
 		mul_v3_fl(fc, 1.0f / count);
 	}
@@ -1814,34 +1812,34 @@
 				break;
 		}
 
-		// fc
+		/* for flatten center */
 		/* flatten center has not been calculated yet if we are not using the area normal */
 		if (brush->sculpt_plane != SCULPT_DISP_DIR_AREA)
 			calc_flatten_center(sd, ob, nodes, totnode, fc);
 
-		// an
+		/* for area normal */
 		copy_v3_v3(ss->cache->last_area_normal, an);
 
-		// fc
+		/* for flatten center */
 		copy_v3_v3(ss->cache->last_center, fc);
 	}
 	else {
-		// an
+		/* for area normal */
 		copy_v3_v3(an, ss->cache->last_area_normal);
 
-		// fc
+		/* for flatten center */
 		copy_v3_v3(fc, ss->cache->last_center);
 
-		// an
+		/* for area normal */
 		flip_coord(an, an, ss->cache->mirror_symmetry_pass);
 
-		// fc
+		/* for flatten center */
 		flip_coord(fc, fc, ss->cache->mirror_symmetry_pass);
 
-		// an
+		/* for area normal */
 		mul_m4_v3(ss->cache->symm_rot_mat, an);
 
-		// fc
+		/* for flatten center */
 		mul_m4_v3(ss->cache->symm_rot_mat, fc);
 	}
 }
@@ -1965,13 +1963,12 @@
 	
 	float displace;
 
-	float an[3]; // area normal
-	float fc[3]; // flatten center
+	float an[3];
+	float fc[3];
 
 	int n;
 
 	float temp[3];
-	//float p[3];
 
 	int flip;
 
@@ -1990,7 +1987,7 @@
 	mul_v3_fl(temp, displace);
 	add_v3_v3(fc, temp);
 
-	//add_v3_v3v3(p, ss->cache->location, an);
+	/* add_v3_v3v3(p, ss->cache->location, an); */
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
 	for (n = 0; n < totnode; n++) {
@@ -2005,7 +2002,6 @@
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 			if (sculpt_brush_test_sq(&test, vd.co)) {
 				if (plane_point_side_flip(vd.co, an, fc, flip)) {
-				//if (sculpt_brush_test_cyl(&test, vd.co, ss->cache->location, p)) {
 					float intr[3];
 					float val[3];
 
@@ -2041,9 +2037,9 @@
 	
 	float displace;
 
-	float sn[3]; // sculpt normal
-	float an[3]; // area normal
-	float fc[3]; // flatten center
+	float sn[3];
+	float an[3];
+	float fc[3];
 
 	int n;
 
@@ -2061,8 +2057,9 @@
 	else
 		copy_v3_v3(an, sn);
 
+	/* delay the first daub because grab delta is not setup */
 	if (ss->cache->first_time)
-		return; // delay the first daub because grab delta is not setup
+		return;
 
 	flip = bstrength < 0;
 
@@ -2077,11 +2074,18 @@
 	mul_v3_fl(temp, displace);
 	add_v3_v3(fc, temp);
 
-	cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry); mat[0][3] = 0;
-	cross_v3_v3v3(mat[1], an, mat[0]); mat[1][3] = 0;
-	copy_v3_v3(mat[2], an); mat[2][3] = 0;
-	copy_v3_v3(mat[3], ss->cache->location);  mat[3][3] = 1;
+	/* init mat */
+	cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry);
+	mat[0][3] = 0;
+	cross_v3_v3v3(mat[1], an, mat[0]);
+	mat[1][3] = 0;
+	copy_v3_v3(mat[2], an);
+	mat[2][3] = 0;
+	copy_v3_v3(mat[3], ss->cache->location);
+	mat[3][3] = 1;
 	normalize_m4(mat);
+
+	/* scale mat */
 	scale_m4_fl(scale, ss->cache->radius);
 	mult_m4_m4m4(tmat, mat, scale);
 	invert_m4_m4(mat, tmat);
@@ -2531,23 +2535,6 @@
 		sculpt_update_keyblock(ob);
 }
 
-//static int max_overlap_count(Sculpt *sd)
-//{
-//	int count[3];
-//	int i, j;
-//
-//	for (i= 0; i < 3; i++) {
-//		count[i] = sd->radial_symm[i];
-//
-//		for (j= 0; j < 3; j++) {
-//			if (i != j && sd->flags & (SCULPT_SYMM_X<<i))
-//				count[i] *= 2;
-//		}
-//	}
-//
-//	return MAX3(count[0], count[1], count[2]);
-//}
-
 /* Flip all the editdata across the axis/axes specified by symm. Used to
  * calculate multiple modifications to the mesh when symmetry is enabled. */
 static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
@@ -2560,17 +2547,17 @@
 	flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm);
 	flip_coord(cache->view_normal, cache->true_view_normal, symm);
 
-	// XXX This reduces the length of the grab delta if it approaches the line of symmetry
-	// XXX However, a different approach appears to be needed
-	//if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
-	//	float frac = 1.0f/max_overlap_count(sd);
-	//	float reduce = (feather-frac)/(1-frac);
+	/* XXX This reduces the length of the grab delta if it approaches the line of symmetry
+	   XXX However, a different approach appears to be needed
+	   if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
+		float frac = 1.0f/max_overlap_count(sd);
+		float reduce = (feather-frac)/(1-frac);
 
-	//	printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
+		printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
 
-	//	if (frac < 1)
-	//		mul_v3_fl(cache->grab_delta_symmetry, reduce);
-	//}
+		if (frac < 1)
+			mul_v3_fl(cache->grab_delta_symmetry, reduce);
+	} */
 
 	unit_m4(cache->symm_rot_mat);
 	unit_m4(cache->symm_rot_mat_inv);
@@ -2934,8 +2921,6 @@
 			cache->original = 1;
 
 	cache->special_rotation = (brush->flag & BRUSH_RAKE) ? sd->last_angle : 0;
-	//cache->last_rake[0] = sd->last_x;
-	//cache->last_rake[1] = sd->last_y;
 
 	cache->first_time= 1;
 
@@ -3024,7 +3009,7 @@
 
 	int dx, dy;
 
-	//RNA_float_get_array(ptr, "location", cache->traced_location);
+	/* RNA_float_get_array(ptr, "location", cache->traced_location); */
 
 	if (cache->first_time ||
 	    !((brush->flag & BRUSH_ANCHORED)||
@@ -3450,7 +3435,7 @@
 	SculptSession *ss = ob->sculpt;
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 
-	// reset values used to draw brush after completing the stroke
+	/* reset values used to draw brush after completing the stroke */
 	sd->draw_anchored= 0;
 	sd->draw_pressure= 0;
 	sd->special_rotation= 0;




More information about the Bf-blender-cvs mailing list