[Bf-blender-cvs] [bd02741] alembic: Fix for incorrect cutoff points with the haircut cache modifier.

Lukas Tönne noreply at git.blender.org
Fri May 22 17:53:35 CEST 2015


Commit: bd027416c4ccfa8aee2054381de0b3fbff116b27
Author: Lukas Tönne
Date:   Fri May 22 16:59:01 2015 +0200
Branches: alembic
https://developer.blender.org/rBbd027416c4ccfa8aee2054381de0b3fbff116b27

Fix for incorrect cutoff points with the haircut cache modifier.

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

M	source/blender/blenkernel/intern/cache_library.c
M	source/blender/blenkernel/intern/strands.c
M	source/blender/editors/space_view3d/drawstrands.c
M	source/blender/makesrna/intern/rna_strands.c

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

diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 4009a48..411ed78 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -1849,13 +1849,7 @@ static bool haircut_find_segment_cut(HaircutCacheModifier *hmd, HaircutCacheData
 	if ((hmd->cut_mode & eHaircutCacheModifier_CutMode_Enter && is_entering) ||
 	    (hmd->cut_mode & eHaircutCacheModifier_CutMode_Exit && !is_entering))
 	{
-		
-		/* convert back to world space */
-		mul_m4_v3(inst->mat, hit.co);
-		mul_mat3_m4_v3(inst->mat, hit.no);
-		
-		if (r_lambda) *r_lambda = len_v3v3(hit.co, v1) / length;
-		
+		if (r_lambda) *r_lambda = len_v3v3(hit.co, start) / length;
 		return true;
 	}
 	
diff --git a/source/blender/blenkernel/intern/strands.c b/source/blender/blenkernel/intern/strands.c
index bcb12d6..40e31c5 100644
--- a/source/blender/blenkernel/intern/strands.c
+++ b/source/blender/blenkernel/intern/strands.c
@@ -396,9 +396,9 @@ void BKE_strands_children_deform(StrandsChildren *strands, Strands *parents, boo
 			mul_m4_v3(it_strand.curve->root_matrix, it_vert.vertex->co);
 		}
 		
-		strands_children_apply_cutoff(&it_strand);
-		
 		strands_children_strand_deform_intern(&it_strand, parents, vertstart, use_motion, NULL);
+		
+		strands_children_apply_cutoff(&it_strand);
 	}
 	
 	if (vertstart)
diff --git a/source/blender/editors/space_view3d/drawstrands.c b/source/blender/editors/space_view3d/drawstrands.c
index 6239d97..af2e04e 100644
--- a/source/blender/editors/space_view3d/drawstrands.c
+++ b/source/blender/editors/space_view3d/drawstrands.c
@@ -148,7 +148,7 @@ static void draw_strand_child_lines(StrandsChildren *children, short dflag)
 	
 	for (BKE_strand_child_iter_init(&it_strand, children); BKE_strand_child_iter_valid(&it_strand); BKE_strand_child_iter_next(&it_strand)) {
 		StrandsChildCurve *curve = it_strand.curve;
-		const int numverts = curve->cutoff < 0.0f ? curve->numverts : min_ii(curve->numverts, (int)curve->cutoff);
+		const int numverts = curve->cutoff < 0.0f ? curve->numverts : min_ii(curve->numverts, (int)ceilf(curve->cutoff) + 1);
 		
 		if (it_strand.tot <= 0)
 			continue;
diff --git a/source/blender/makesrna/intern/rna_strands.c b/source/blender/makesrna/intern/rna_strands.c
index e467967..f6154fd 100644
--- a/source/blender/makesrna/intern/rna_strands.c
+++ b/source/blender/makesrna/intern/rna_strands.c
@@ -47,7 +47,7 @@ static int rna_Strands_has_motion_state_get(PointerRNA *ptr)
 static int rna_StrandsChildCurve_render_size_get(PointerRNA *ptr)
 {
 	StrandsChildCurve *curve = ptr->data;
-	return curve->cutoff < 0.0f ? curve->numverts : min_ii(curve->numverts, (int)curve->cutoff);
+	return curve->cutoff < 0.0f ? curve->numverts : min_ii(curve->numverts, (int)ceilf(curve->cutoff) + 1);
 }
 
 static void rna_StrandsChildren_curve_uvs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)




More information about the Bf-blender-cvs mailing list