[Bf-blender-cvs] [9c9ea7c75fa] hair_guides: Function for removing all guide curves in a hair system.
Lukas Tönne
noreply at git.blender.org
Wed May 23 10:04:27 CEST 2018
Commit: 9c9ea7c75fad367149f6174de1ed873d3bce3ba0
Author: Lukas Tönne
Date: Mon May 21 14:47:56 2018 +0100
Branches: hair_guides
https://developer.blender.org/rB9c9ea7c75fad367149f6174de1ed873d3bce3ba0
Function for removing all guide curves in a hair system.
===================================================================
M source/blender/blenkernel/BKE_hair.h
M source/blender/blenkernel/intern/hair.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_hair.h b/source/blender/blenkernel/BKE_hair.h
index 9b2cbebf544..4d3f9e189ef 100644
--- a/source/blender/blenkernel/BKE_hair.h
+++ b/source/blender/blenkernel/BKE_hair.h
@@ -81,6 +81,10 @@ void BKE_hair_set_guide_vertex(struct HairSystem *hsys, int index, int flag, con
*/
void BKE_hair_set_hair_guides(struct HairSystem *hsys, struct HairGuideData *guides);
+/* Remove all guide curves.
+ */
+void BKE_hair_clear_guides(struct HairSystem *hsys);
+
/* === Follicles === */
/* Calculate surface area of a scalp mesh */
diff --git a/source/blender/blenkernel/intern/hair.c b/source/blender/blenkernel/intern/hair.c
index 87fd60cb516..999c305e426 100644
--- a/source/blender/blenkernel/intern/hair.c
+++ b/source/blender/blenkernel/intern/hair.c
@@ -285,13 +285,35 @@ void BKE_hair_set_hair_guides(HairSystem *hsys, HairGuideData *guides)
hsys->guides.verts = MEM_dupallocN(hsys->guides.verts);
hsys->guides.totverts = guides->totverts;
+#ifndef NDEBUG
const int vertcount = hair_guide_calc_vertstart(hsys);
BLI_assert(vertcount <= hsys->guides.totverts);
+#endif
hsys->flag |= HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
}
+void BKE_hair_clear_guides(HairSystem *hsys)
+{
+ if (hsys->guides.curves)
+ {
+ MEM_freeN(hsys->guides.curves);
+ hsys->guides.curves = NULL;
+ }
+ hsys->guides.totcurves = 0;
+
+ if (hsys->guides.verts)
+ {
+ MEM_freeN(hsys->guides.verts);
+ hsys->guides.verts = NULL;
+ }
+ hsys->guides.totverts = 0;
+
+ hsys->flag &= ~HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING;
+ BKE_hair_batch_cache_dirty(hsys, BKE_HAIR_BATCH_DIRTY_ALL);
+}
+
/* ================================= */
BLI_INLINE void hair_fiber_verify_weights(HairFollicle *follicle)
More information about the Bf-blender-cvs
mailing list