[Bf-blender-cvs] [30dab51] master: Cleanup: use bool and const args

Campbell Barton noreply at git.blender.org
Thu Oct 9 22:43:02 CEST 2014


Commit: 30dab51c29e863d3f605343f6308c71d0a6d3ce1
Author: Campbell Barton
Date:   Thu Oct 9 22:39:59 2014 +0200
Branches: master
https://developer.blender.org/rB30dab51c29e863d3f605343f6308c71d0a6d3ce1

Cleanup: use bool and const args

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

M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenlib/BLI_math_geom.h
M	source/blender/blenlib/intern/math_geom.c
M	source/blender/bmesh/tools/bmesh_bisect_plane.c
M	source/blender/bmesh/tools/bmesh_bisect_plane.h
M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/space_view3d/space_view3d.c

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

diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 53e41c1..c8c693f 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -89,9 +89,10 @@ void BKE_pbvh_search_gather(PBVH *bvh,
  * it's up to the callback to find the primitive within the leaves that is
  * hit first */
 
-void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
-                      const float ray_start[3], const float ray_normal[3],
-                      int original);
+void BKE_pbvh_raycast(
+        PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
+        const float ray_start[3], const float ray_normal[3],
+        bool original);
 
 bool BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
                           const float ray_start[3], const float ray_normal[3],
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 3e76301..ff6fae0 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1433,7 +1433,7 @@ void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro
 
 typedef struct {
 	IsectRayAABBData ray;
-	int original;
+	bool original;
 } RaycastData;
 
 static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
@@ -1449,9 +1449,10 @@ static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
 	return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin);
 }
 
-void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
-                      const float ray_start[3], const float ray_normal[3],
-                      int original)
+void BKE_pbvh_raycast(
+        PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
+        const float ray_start[3], const float ray_normal[3],
+        bool original)
 {
 	RaycastData rcd;
 
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 81ca290..ba32b29 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -275,17 +275,22 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
 
 /********************************** Normals **********************************/
 
-void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
-                               float n4[3], const float f_no[3], const float co1[3], const float co2[3],
-                               const float co3[3], const float co4[3]);
+void accumulate_vertex_normals(
+        float n1[3], float n2[3], float n3[3], float n4[3],
+        const float f_no[3],
+        const float co1[3], const float co2[3], const float co3[3], const float co4[3]);
 
-void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
-                                    const float **vertcos, float vdiffs[][3], const int nverts);
+void accumulate_vertex_normals_poly(
+        float **vertnos, const float polyno[3],
+        const float **vertcos, float vdiffs[][3], const int nverts);
 
 /********************************* Tangents **********************************/
 
-void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2],
-                     float co1[3], float co2[3], float co3[3], float n[3], float tang[3]);
+void tangent_from_uv(
+        const float uv1[2], const float uv2[2], const float uv3[2],
+        const float co1[3], const float co2[3], const float co3[3],
+        const float n[3],
+        float r_tang[3]);
 
 /******************************** Vector Clouds ******************************/
 
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 496e536..da0855a 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -3231,9 +3231,10 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
 
 /********************************* Normals **********************************/
 
-void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
-                               float n4[3], const float f_no[3], const float co1[3], const float co2[3],
-                               const float co3[3], const float co4[3])
+void accumulate_vertex_normals(
+        float n1[3], float n2[3], float n3[3], float n4[3],
+        const float f_no[3],
+        const float co1[3], const float co2[3], const float co3[3], const float co4[3])
 {
 	float vdiffs[4][3];
 	const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3;
@@ -3305,7 +3306,11 @@ void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
 
 /********************************* Tangents **********************************/
 
-void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3])
+void tangent_from_uv(
+        const float uv1[2], const float uv2[2], const float uv3[3],
+        const float co1[3], const float co2[3], const float co3[3],
+        const float n[3],
+        float r_tang[3])
 {
 	const float s1 = uv2[0] - uv1[0];
 	const float s2 = uv3[0] - uv1[0];
@@ -3313,7 +3318,8 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
 	const float t2 = uv3[1] - uv1[1];
 	float det = (s1 * t2 - s2 * t1);
 
-	if (det != 0.0f) { /* otherwise 'tang' becomes nan */
+	/* otherwise 'r_tang' becomes nan */
+	if (det != 0.0f) {
 		float tangv[3], ct[3], e1[3], e2[3];
 
 		det = 1.0f / det;
@@ -3321,21 +3327,21 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
 		/* normals in render are inversed... */
 		sub_v3_v3v3(e1, co1, co2);
 		sub_v3_v3v3(e2, co1, co3);
-		tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
-		tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
-		tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
+		r_tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
+		r_tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
+		r_tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
 		tangv[0] = (s1 * e2[0] - s2 * e1[0]) * det;
 		tangv[1] = (s1 * e2[1] - s2 * e1[1]) * det;
 		tangv[2] = (s1 * e2[2] - s2 * e1[2]) * det;
-		cross_v3_v3v3(ct, tang, tangv);
+		cross_v3_v3v3(ct, r_tang, tangv);
 
 		/* check flip */
 		if (dot_v3v3(ct, n) < 0.0f) {
-			negate_v3(tang);
+			negate_v3(r_tang);
 		}
 	}
 	else {
-		tang[0] = tang[1] = tang[2] = 0.0f;
+		zero_v3(r_tang);
 	}
 }
 
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c
index ed9e878..463304f 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.c
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c
@@ -294,9 +294,10 @@ finally:
  * \param use_tag  Only bisect tagged edges and faces.
  * \param oflag_center  Operator flag, enabled for geometry on the axis (existing and created)
  */
-void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
-                          const bool use_snap_center, const bool use_tag,
-                          const short oflag_center, const float eps)
+void BM_mesh_bisect_plane(
+        BMesh *bm, const float plane[4],
+        const bool use_snap_center, const bool use_tag,
+        const short oflag_center, const float eps)
 {
 	unsigned int einput_len;
 	unsigned int i;
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h
index 15f9026..7f3a97c 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.h
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h
@@ -27,8 +27,9 @@
  *  \ingroup bmesh
  */
 
-void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
-                          const bool use_snap_center, const bool use_tag,
-                          const short oflag_center, const float eps);
+void BM_mesh_bisect_plane(
+        BMesh *bm, const float plane[4],
+        const bool use_snap_center, const bool use_tag,
+        const short oflag_center, const float eps);
 
 #endif /* __BMESH_BISECT_PLANE_H__ */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2f9734f..4b692cf 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8747,8 +8747,9 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
 
 		switch (event->type) {
 			case MOUSEMOVE:
-				if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ &&
-				    !is_click_style) {
+				if (!is_click_style &&
+				    (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ))
+				{
 					block->pie_data.flags |= UI_PIE_DRAG_STYLE;
 				}
 				ui_handle_menu_button(C, event, menu);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 766048d..0e0012c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -268,8 +268,8 @@ typedef struct {
 
 	/* Original coordinate, normal, and mask */
 	const float *co;
-	float mask;
 	const short *no;
+	float mask;
 } SculptOrigVertData;
 
 
@@ -4008,7 +4008,7 @@ typedef struct {
 	const float *ray_start, *ray_normal;
 	bool hit;
 	float dist;
-	int original;
+	bool original;
 } SculptRaycastData;
 
 typedef struct {
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 0e3621a..b3accb4 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -434,9 +434,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
 	BGpic *bgpic;
 	
 	/* clear or remove stuff from old */
-	
-// XXX	BIF_view3d_previewrender_free(v3do);
-	
+
 	if (v3dn->localvd) {
 		v3dn->localvd = NULL;
 		v3dn->properties_storage = NULL;




More information about the Bf-blender-cvs mailing list