[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58863] trunk/blender/source/blender: code cleanup: bmesh use 'const' for query functions.

Campbell Barton ideasman42 at gmail.com
Sat Aug 3 18:37:23 CEST 2013


Revision: 58863
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58863
Author:   campbellbarton
Date:     2013-08-03 16:37:23 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
code cleanup: bmesh use 'const' for query functions.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c
    trunk/blender/source/blender/bmesh/intern/bmesh_polygon.h
    trunk/blender/source/blender/bmesh/intern/bmesh_private.h
    trunk/blender/source/blender/bmesh/intern/bmesh_queries.c
    trunk/blender/source/blender/bmesh/intern/bmesh_queries.h
    trunk/blender/source/blender/bmesh/intern/bmesh_structure.c
    trunk/blender/source/blender/bmesh/intern/bmesh_structure.h
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c	2013-08-03 15:30:57 UTC (rev 58862)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_polygon.c	2013-08-03 16:37:23 UTC (rev 58863)
@@ -95,7 +95,7 @@
  *
  * Same as #calc_poly_normal but operates directly on a bmesh face.
  */
-static void bm_face_calc_poly_normal(BMFace *f, float n[3])
+static void bm_face_calc_poly_normal(const BMFace *f, float n[3])
 {
 	BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
 	BMLoop *l_iter  = l_first;
@@ -173,7 +173,7 @@
  * \param r_loops  Store face loop pointers, (f->len)
  * \param r_index  Store triangle triples, indicies into \a r_loops,  ((f->len - 2) * 3)
  */
-int BM_face_calc_tessellation(BMFace *f, BMLoop **r_loops, int (*_r_index)[3])
+int BM_face_calc_tessellation(const BMFace *f, BMLoop **r_loops, int (*_r_index)[3])
 {
 	int *r_index = (int *)_r_index;
 	BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
@@ -579,7 +579,7 @@
  * is passed in as well.
  */
 
-void BM_face_calc_normal(BMFace *f, float r_no[3])
+void BM_face_calc_normal(const BMFace *f, float r_no[3])
 {
 	BMLoop *l;
 

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_polygon.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_polygon.h	2013-08-03 15:30:57 UTC (rev 58862)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_polygon.h	2013-08-03 16:37:23 UTC (rev 58863)
@@ -27,13 +27,13 @@
  *  \ingroup bmesh
  */
 
-int   BM_face_calc_tessellation(BMFace *f, BMLoop **r_loops, int (*r_index)[3])
+int   BM_face_calc_tessellation(const BMFace *f, BMLoop **r_loops, int (*r_index)[3])
 #ifdef __GNUC__
 	__attribute__((warn_unused_result))
 	__attribute__((nonnull))
 #endif
 ;
-void  BM_face_calc_normal(BMFace *f, float r_no[3]);
+void  BM_face_calc_normal(const BMFace *f, float r_no[3]);
 void  BM_face_calc_normal_vcos(BMesh *bm, BMFace *f, float r_no[3],
                                float const (*vertexCos)[3]);
 float BM_face_calc_area(BMFace *f);

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_private.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_private.h	2013-08-03 15:30:57 UTC (rev 58862)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_private.h	2013-08-03 16:37:23 UTC (rev 58863)
@@ -53,8 +53,8 @@
 	} (void)0
 #endif
 
-int bmesh_radial_length(BMLoop *l);
-int bmesh_disk_count(BMVert *v);
+int bmesh_radial_length(const BMLoop *l);
+int bmesh_disk_count(const BMVert *v);
 
 /**
  * Internal BMHeader.api_flag

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_queries.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_queries.c	2013-08-03 15:30:57 UTC (rev 58862)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_queries.c	2013-08-03 16:37:23 UTC (rev 58863)
@@ -644,7 +644,7 @@
  * Tests whether or not the vertex is part of a wire edge.
  * (ie: has no faces attached to it)
  */
-bool BM_vert_is_wire(BMVert *v)
+bool BM_vert_is_wire(const BMVert *v)
 {
 	if (v->e) {
 		BMEdge *e_first, *e_iter;
@@ -667,7 +667,7 @@
  * Tests whether or not the edge is part of a wire.
  * (ie: has no faces attached to it)
  */
-bool BM_edge_is_wire(BMEdge *e)
+bool BM_edge_is_wire(const BMEdge *e)
 {
 	return (e->l == NULL);
 }
@@ -679,7 +679,7 @@
  * 3: Is part of a an edge with more than 2 faces.
  * 4: Is part of a wire edge.
  */
-bool BM_vert_is_manifold(BMVert *v)
+bool BM_vert_is_manifold(const BMVert *v)
 {
 	BMEdge *e, *e_old;
 	BMLoop *l;
@@ -744,7 +744,7 @@
  */
 
 #if 1 /* fast path for checking manifold */
-bool BM_edge_is_manifold(BMEdge *e)
+bool BM_edge_is_manifold(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
 	return (l && (l->radial_next != l) &&             /* not 0 or 1 face users */
@@ -767,7 +767,7 @@
  * Tests that the edge is manifold and
  * that both its faces point the same way.
  */
-bool BM_edge_is_contiguous(BMEdge *e)
+bool BM_edge_is_contiguous(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
 	const BMLoop *l_other;
@@ -780,7 +780,7 @@
  * Check if the edge is convex or concave
  * (depends on face winding)
  */
-bool BM_edge_is_convex(BMEdge *e)
+bool BM_edge_is_convex(const BMEdge *e)
 {
 	if (BM_edge_is_manifold(e)) {
 		BMLoop *l1 = e->l;
@@ -803,7 +803,7 @@
  */
 
 #if 1 /* fast path for checking boundary */
-bool BM_edge_is_boundary(BMEdge *e)
+bool BM_edge_is_boundary(const BMEdge *e)
 {
 	const BMLoop *l = e->l;
 	return (l && (l->radial_next == l));
@@ -821,7 +821,7 @@
 }
 #endif
 
-bool BM_vert_is_boundary(BMVert *v)
+bool BM_vert_is_boundary(const BMVert *v)
 {
 	if (v->e) {
 		BMEdge *e_first, *e_iter;
@@ -1047,8 +1047,8 @@
  * \note This is in fact quite a simple check, mainly include this function so the intent is more obvious.
  * We know these 2 verts will _always_ make up the loops edge
  */
-void BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
-                              BMLoop *edge_loop)
+void BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
+                              const BMLoop *edge_loop)
 {
 	BLI_assert(edge_loop->e == edge);
 	(void)edge; /* quiet warning in release build */
@@ -1056,7 +1056,7 @@
 	*r_v2 = edge_loop->next->v;
 }
 
-void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
+void BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
 {
 	BM_edge_ordered_verts_ex(edge, r_v1, r_v2, edge->l);
 }
@@ -1065,7 +1065,7 @@
  * Check if the loop is convex or concave
  * (depends on face normal)
  */
-bool BM_loop_is_convex(BMLoop *l)
+bool BM_loop_is_convex(const BMLoop *l)
 {
 	float e_dir_prev[3];
 	float e_dir_next[3];
@@ -1182,11 +1182,11 @@
  *
  * \return angle in radians
  */
-float BM_edge_calc_face_angle(BMEdge *e)
+float BM_edge_calc_face_angle(const BMEdge *e)
 {
 	if (BM_edge_is_manifold(e)) {
-		BMLoop *l1 = e->l;
-		BMLoop *l2 = e->l->radial_next;
+		const BMLoop *l1 = e->l;
+		const BMLoop *l2 = e->l->radial_next;
 		return angle_normalized_v3v3(l1->f->no, l2->f->no);
 	}
 	else {
@@ -1202,7 +1202,7 @@
  *
  * \return angle in radians
  */
-float BM_edge_calc_face_angle_signed(BMEdge *e)
+float BM_edge_calc_face_angle_signed(const BMEdge *e)
 {
 	if (BM_edge_is_manifold(e)) {
 		BMLoop *l1 = e->l;
@@ -1228,7 +1228,7 @@
  * \param r_tangent The loop corner tangent to set
  */
 
-void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
+void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
 {
 	float tvec[3];
 	BMVert *v1, *v2;
@@ -1685,13 +1685,13 @@
 }
 
 /* convenience functions for checking flags */
-bool BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag)
+bool BM_edge_is_any_vert_flag_test(const BMEdge *e, const char hflag)
 {
 	return (BM_elem_flag_test(e->v1, hflag) ||
 	        BM_elem_flag_test(e->v2, hflag));
 }
 
-bool BM_face_is_any_vert_flag_test(BMFace *f, const char hflag)
+bool BM_face_is_any_vert_flag_test(const BMFace *f, const char hflag)
 {
 	BMLoop *l_iter;
 	BMLoop *l_first;
@@ -1705,7 +1705,7 @@
 	return false;
 }
 
-bool BM_face_is_any_edge_flag_test(BMFace *f, const char hflag)
+bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag)
 {
 	BMLoop *l_iter;
 	BMLoop *l_first;
@@ -1722,7 +1722,7 @@
 /**
  * Use within assert's to check normals are valid.
  */
-bool BM_face_is_normal_valid(BMFace *f)
+bool BM_face_is_normal_valid(const BMFace *f)
 {
 	const float eps = 0.0001f;
 	float no[3];
@@ -1731,7 +1731,7 @@
 	return len_squared_v3v3(no, f->no) < (eps * eps);
 }
 
-static void bm_mesh_calc_volume_face(BMFace *f, float *r_vol)
+static void bm_mesh_calc_volume_face(const BMFace *f, float *r_vol)
 {
 	int tottri = f->len - 2;
 	BMLoop **loops     = BLI_array_alloca(loops, f->len);

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_queries.h
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_queries.h	2013-08-03 15:30:57 UTC (rev 58862)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_queries.h	2013-08-03 16:37:23 UTC (rev 58863)
@@ -58,26 +58,26 @@
 int     BM_vert_face_count(BMVert *v);
 BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e);
 
-bool    BM_vert_is_wire(BMVert *v);
-bool    BM_edge_is_wire(BMEdge *e);
+bool    BM_vert_is_wire(const BMVert *v);
+bool    BM_edge_is_wire(const BMEdge *e);
 
-bool    BM_vert_is_manifold(BMVert *v);
-bool    BM_edge_is_manifold(BMEdge *e);
-bool    BM_vert_is_boundary(BMVert *v);
-bool    BM_edge_is_boundary(BMEdge *e);
-bool    BM_edge_is_contiguous(BMEdge *e);
-bool    BM_edge_is_convex(BMEdge *e);
+bool    BM_vert_is_manifold(const BMVert *v);
+bool    BM_edge_is_manifold(const BMEdge *e);
+bool    BM_vert_is_boundary(const BMVert *v);
+bool    BM_edge_is_boundary(const BMEdge *e);
+bool    BM_edge_is_contiguous(const BMEdge *e);
+bool    BM_edge_is_convex(const BMEdge *e);
 
-bool    BM_loop_is_convex(BMLoop *l);
+bool    BM_loop_is_convex(const BMLoop *l);
 
 float   BM_loop_calc_face_angle(BMLoop *l);
 void    BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
 void    BM_loop_calc_face_direction(BMLoop *l, float r_normal[3]);
 void    BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]);
 
-float   BM_edge_calc_face_angle(BMEdge *e);
-float   BM_edge_calc_face_angle_signed(BMEdge *e);
-void    BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]);
+float   BM_edge_calc_face_angle(const BMEdge *e);
+float   BM_edge_calc_face_angle_signed(const BMEdge *e);
+void    BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3]);
 
 float   BM_vert_calc_edge_angle(BMVert *v);
 float   BM_vert_calc_shell_factor(BMVert *v);
@@ -108,15 +108,15 @@
 BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v);
 BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e);
 
-void    BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
-void    BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
-                                 BMLoop *edge_loop);
+void    BM_edge_ordered_verts(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2);
+void    BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
+                                 const BMLoop *edge_loop);
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list