[Bf-blender-cvs] [c98fb76] alembic: Fix for previous commit: the "goal deflect" feature wasn't actually filtering effectors by type.

Lukas Tönne noreply at git.blender.org
Thu May 14 11:30:43 CEST 2015


Commit: c98fb76b4e5251c82bbcf2d5a17ac2ba883b211e
Author: Lukas Tönne
Date:   Wed May 13 18:13:50 2015 +0200
Branches: alembic
https://developer.blender.org/rBc98fb76b4e5251c82bbcf2d5a17ac2ba883b211e

Fix for previous commit: the "goal deflect" feature wasn't actually
filtering effectors by type.

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

M	source/blender/physics/intern/BPH_mass_spring.cpp

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

diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index f8d4fa6..2bf6345 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -1413,15 +1413,19 @@ static float strands_goal_stiffness(Strands *UNUSED(strands), HairSimParams *par
 	return params->goal_stiffness * weight;
 }
 
-static bool strands_test_deflector(StrandsVertex *UNUSED(vertex), int index, CacheEffector *cache_effectors, int tot_cache_effectors,
-                                   Implicit_Data *data, StrandIterator *it_strand)
+static bool strands_deflector_filter(void *UNUSED(data), CacheEffector *eff)
+{
+	return eff->type == eCacheEffector_Type_Deflect;
+}
+
+static bool strands_test_deflector(StrandsVertex *UNUSED(vertex), int index, CacheEffector *cache_effectors, int tot_cache_effectors, Implicit_Data *data)
 {
 	CacheEffectorPoint point;
 	point.index = index;
 	BPH_mass_spring_get_motion_state(data, index, point.x, point.v);
 	
 	CacheEffectorResult result;
-	if (BKE_cache_effectors_eval(cache_effectors, tot_cache_effectors, &point, &result) > 0) {
+	if (BKE_cache_effectors_eval_ex(cache_effectors, tot_cache_effectors, &point, &result, strands_deflector_filter, NULL) > 0) {
 		return true;
 	}
 	
@@ -1429,7 +1433,7 @@ static bool strands_test_deflector(StrandsVertex *UNUSED(vertex), int index, Cac
 }
 
 /* goal forces pull vertices toward their rest position */
-static void strands_calc_vertex_goal_forces(Strands *strands, float space[4][4], HairSimParams *params, CacheEffector *cache_effectors, int tot_cache_effectors,
+static void strands_calc_vertex_goal_forces(Strands *strands, float UNUSED(space[4][4]), HairSimParams *params, CacheEffector *cache_effectors, int tot_cache_effectors,
                                             Implicit_Data *data, StrandIterator *it_strand)
 {
 	const int goalstart = strands->totverts;
@@ -1447,7 +1451,7 @@ static void strands_calc_vertex_goal_forces(Strands *strands, float space[4][4],
 		int goalj = goalstart + vj - numroots;
 		
 		if (params->flag & eHairSimParams_Flag_UseGoalDeflect) {
-			if (strands_test_deflector(it_edge.vertex1, vj, cache_effectors, tot_cache_effectors, data, it_strand))
+			if (strands_test_deflector(it_edge.vertex1, vj, cache_effectors, tot_cache_effectors, data))
 				continue;
 		}




More information about the Bf-blender-cvs mailing list