Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-09-06 10:27:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-09-06 10:27:22 +0400
commit6fdb2ed861b8edf022e51bbc783acabbd2a0e581 (patch)
tree3b2872aca31f1494a9e8a5d9c1dfb2cfdb69c0d1 /source
parent6439ae9d51dfe3a77ff778e35cf83909bbc93acc (diff)
bmesh utility functions BM_face_as_array_loop_tri, BM_face_as_array_loop_quad
also set attributes for the header and remove debug print in mask.c
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mask.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c34
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h41
3 files changed, 57 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index a7bfb15c99d..afd725f55fe 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1402,7 +1402,7 @@ void BKE_mask_update_deform(Mask *mask)
int j;
for (j = 0; j <= 2; j += 2) { /* (0, 2) */
- printf("--- %d %d, %d, %d\n", i, j, i_prev, i_next);
+ // printf("--- %d %d, %d, %d\n", i, j, i_prev, i_next);
barycentric_weights_v2(bezt_prev->vec[1], bezt->vec[1], bezt_next->vec[1],
bezt->vec[j], w_src);
interp_v3_v3v3v3(bezt_def->vec[j],
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 8765bc7d579..a82d3d07712 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -1203,3 +1203,37 @@ void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4])
r_verts[2] = l->v; l = l->next;
r_verts[3] = l->v;
}
+
+
+/**
+ * Small utility functions for fast access
+ *
+ * faster alternative to:
+ * BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 3);
+ */
+void BM_face_as_array_loop_tri(BMFace *f, BMLoop *r_loops[3])
+{
+ BMLoop *l = BM_FACE_FIRST_LOOP(f);
+
+ BLI_assert(f->len == 3);
+
+ r_loops[0] = l; l = l->next;
+ r_loops[1] = l; l = l->next;
+ r_loops[2] = l;
+}
+
+/**
+ * faster alternative to:
+ * BM_iter_as_array(bm, BM_LOOPS_OF_FACE, f, (void **)l, 4);
+ */
+void BM_face_as_array_loop_quad(BMFace *f, BMLoop *r_loops[4])
+{
+ BMLoop *l = BM_FACE_FIRST_LOOP(f);
+
+ BLI_assert(f->len == 4);
+
+ r_loops[0] = l; l = l->next;
+ r_loops[1] = l; l = l->next;
+ r_loops[2] = l; l = l->next;
+ r_loops[3] = l;
+}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index 90f0075da26..14fe1e76360 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -30,34 +30,37 @@
#include "BLI_compiler_attrs.h"
int BM_face_calc_tessellation(const BMFace *f, BMLoop **r_loops, int (*r_index)[3]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-void BM_face_calc_normal(const BMFace *f, float r_no[3]);
+void BM_face_calc_normal(const BMFace *f, float r_no[3]) ATTR_NONNULL();
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);
-float BM_face_calc_perimeter(BMFace *f);
-void BM_face_calc_plane(BMFace *f, float r_plane[3]);
-void BM_face_calc_center_bounds(BMFace *f, float center[3]);
-void BM_face_calc_center_mean(BMFace *f, float center[3]);
+ float const (*vertexCos)[3]) ATTR_NONNULL();
+float BM_face_calc_area(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+float BM_face_calc_perimeter(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
+void BM_face_calc_plane(BMFace *f, float r_plane[3]) ATTR_NONNULL();
+void BM_face_calc_center_bounds(BMFace *f, float center[3]) ATTR_NONNULL();
+void BM_face_calc_center_mean(BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_vcos(BMesh *bm, BMFace *f, float r_cent[3],
- float const (*vertexCos)[3]);
-void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]);
+ float const (*vertexCos)[3]) ATTR_NONNULL();
+void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]) ATTR_NONNULL();
-void BM_face_normal_update(BMFace *f);
+void BM_face_normal_update(BMFace *f) ATTR_NONNULL();
-void BM_edge_normals_update(BMEdge *e);
+void BM_edge_normals_update(BMEdge *e) ATTR_NONNULL();
-void BM_vert_normal_update(BMVert *v);
-void BM_vert_normal_update_all(BMVert *v);
+void BM_vert_normal_update(BMVert *v) ATTR_NONNULL();
+void BM_vert_normal_update_all(BMVert *v) ATTR_NONNULL();
-void BM_face_normal_flip(BMesh *bm, BMFace *f);
-bool BM_face_point_inside_test(BMFace *f, const float co[3]);
+void BM_face_normal_flip(BMesh *bm, BMFace *f) ATTR_NONNULL();
+bool BM_face_point_inside_test(BMFace *f, const float co[3]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BM_face_triangulate(BMesh *bm, BMFace *f, BMFace **newfaces,
- const bool use_beauty, const bool use_tag);
+ const bool use_beauty, const bool use_tag) ATTR_NONNULL(1, 2);
-void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len);
+void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) ATTR_NONNULL();
-void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3]);
-void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]);
+void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[3]) ATTR_NONNULL();
+void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]) ATTR_NONNULL();
+
+void BM_face_as_array_loop_tri(BMFace *f, BMLoop *r_loops[3]) ATTR_NONNULL();
+void BM_face_as_array_loop_quad(BMFace *f, BMLoop *r_loops[4]) ATTR_NONNULL();
#endif /* __BMESH_POLYGON_H__ */