[Bf-blender-cvs] [298fd140f24] hair_guides: Make sure hair follicle binding is updated before using invalid indices in drawing.
Lukas Tönne
noreply at git.blender.org
Sat Apr 21 14:36:37 CEST 2018
Commit: 298fd140f24f019d15c71952f81363f4d3cddff0
Author: Lukas Tönne
Date: Sat Apr 21 13:35:14 2018 +0100
Branches: hair_guides
https://developer.blender.org/rB298fd140f24f019d15c71952f81363f4d3cddff0
Make sure hair follicle binding is updated before using invalid indices in drawing.
===================================================================
M source/blender/draw/intern/draw_cache_impl_hair.c
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/source/blender/draw/intern/draw_cache_impl_hair.c b/source/blender/draw/intern/draw_cache_impl_hair.c
index b25d6986b81..b3835fa21c3 100644
--- a/source/blender/draw/intern/draw_cache_impl_hair.c
+++ b/source/blender/draw/intern/draw_cache_impl_hair.c
@@ -123,6 +123,9 @@ static void hair_batch_cache_init(HairSystem *hsys)
static HairBatchCache *hair_batch_cache_get(HairSystem *hsys)
{
+ // Hair follicle binding needs to be updated after changes
+ BLI_assert(!(hsys->flag & HAIR_SYSTEM_UPDATE_FOLLICLE_BINDING));
+
if (!hair_batch_cache_valid(hsys)) {
hair_batch_cache_clear(hsys);
hair_batch_cache_init(hsys);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index afb16930c68..b2bb5cd3079 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1223,7 +1223,7 @@ static void rna_Fur_guide_curves_new(FurModifierData *fmd, ReportList *UNUSED(re
BLI_addtail(&fmd->guide_curves, curve);
}
-static void rna_Fur_guide_curves_apply(FurModifierData *fmd, ReportList *UNUSED(reports))
+static void rna_Fur_guide_curves_apply(ID *id, FurModifierData *fmd, bContext *C, ReportList *UNUSED(reports))
{
const int totcurves = BLI_listbase_count(&fmd->guide_curves);
int i = 0;
@@ -1247,6 +1247,11 @@ static void rna_Fur_guide_curves_apply(FurModifierData *fmd, ReportList *UNUSED(
BKE_hair_set_guide_vertex(fmd->hair_system, i, curve->verts[j].flag, curve->verts[j].co);
}
}
+
+ {
+ DerivedMesh *scalp = mesh_get_derived_final(CTX_data_depsgraph(C), CTX_data_scene(C), (Object*)id, CD_MASK_BAREMESH);
+ BKE_hair_bind_follicles(fmd->hair_system, scalp);
+ }
}
#else
@@ -4990,7 +4995,7 @@ static void rna_def_modifier_fur_guide_curves_api(BlenderRNA *brna, PropertyRNA
RNA_def_property_flag(parm, PARM_REQUIRED);
func = RNA_def_function(srna, "apply", "rna_Fur_guide_curves_apply");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
}
static void rna_def_modifier_fur(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list