[Bf-blender-cvs] [ff381505fa9] hair_guides: Some tentative iterator macros for groom data.

Lukas Tönne noreply at git.blender.org
Tue Jan 2 10:57:32 CET 2018


Commit: ff381505fa9179135d7a2586555459f8e2b51b9c
Author: Lukas Tönne
Date:   Mon Jan 1 11:26:58 2018 +0000
Branches: hair_guides
https://developer.blender.org/rBff381505fa9179135d7a2586555459f8e2b51b9c

Some tentative iterator macros for groom data.

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

M	source/blender/blenkernel/BKE_groom.h

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

diff --git a/source/blender/blenkernel/BKE_groom.h b/source/blender/blenkernel/BKE_groom.h
index d119c5a2292..8aeebe8ed1f 100644
--- a/source/blender/blenkernel/BKE_groom.h
+++ b/source/blender/blenkernel/BKE_groom.h
@@ -69,4 +69,30 @@ enum {
 void BKE_groom_batch_cache_dirty(struct Groom *groom, int mode);
 void BKE_groom_batch_cache_free(struct Groom *groom);
 
+/* === Iterators === */
+
+/* Utility class for iterating over groom elements */
+typedef struct GroomIterator
+{
+	int isection;                       /* section index */
+	struct GroomSection *section;       /* section data pointer */
+	
+	int ivertex;                        /* vertex index */
+	int isectionvertex;                 /* vertex index for the inner loop */
+	struct GroomSectionVertex *vertex;  /* vertex data pointer */
+} GroomIterator;
+
+#define GROOM_ITER_SECTIONS(iter, bundle) \
+	for (iter.isection = 0, iter.section = (bundle)->sections; \
+	     iter.isection < (bundle)->totsections; \
+	     ++iter.isection, ++iter.section)
+
+#define GROOM_ITER_SECTION_LOOPS(iter, sectionvar, vertexvar, bundle) \
+	for (iter.isection = 0, iter.section = (bundle)->sections, iter.ivertex = 0, iter.vertex = (bundle)->verts; \
+	     iter.isection < (bundle)->totsections; \
+	     ++iter.isection, ++iter.section) \
+		for (iter.isectionvertex = 0; \
+		     iter.isectionvertex < (bundle)->numloopverts; \
+		     ++iter.isectionvertex, ++iter.vertex)
+
 #endif /*  __BKE_GROOM_H__ */



More information about the Bf-blender-cvs mailing list