[Bf-blender-cvs] [20a24a9] temp_custom_loop_normals: Fix for unfreed effector weights in hair dynamics.

Lukas Tönne noreply at git.blender.org
Mon Feb 2 20:22:42 CET 2015


Commit: 20a24a9d9d3f2fbd127adf3adf66f71a27fe147c
Author: Lukas Tönne
Date:   Mon Feb 2 14:09:02 2015 +0100
Branches: temp_custom_loop_normals
https://developer.blender.org/rB20a24a9d9d3f2fbd127adf3adf66f71a27fe147c

Fix for unfreed effector weights in hair dynamics.

The internal cloth modifier effector weights get replaced temporarily
to make the cloth sim use the particle weight settings instead. But
the particle sim was not putting back the original weights, which can be
non-NULL in case the cloth sim allocated these already. Messy design ...

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

M	source/blender/blenkernel/intern/particle_system.c

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

diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 9c28672..0418160 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3116,6 +3116,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 {
 	ParticleSystem *psys = sim->psys;
 	PARTICLE_P;
+	EffectorWeights *clmd_effweights;
 	int totpoint;
 	int totedge;
 	float (*deformedVerts)[3];
@@ -3162,6 +3163,10 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 		psys->hair_out_dm->release(psys->hair_out_dm);
 	
 	psys->clmd->point_cache = psys->pointcache;
+	/* for hair sim we replace the internal cloth effector weights temporarily
+	 * to use the particle settings
+	 */
+	clmd_effweights = psys->clmd->sim_parms->effector_weights;
 	psys->clmd->sim_parms->effector_weights = psys->part->effector_weights;
 	
 	deformedVerts = MEM_mallocN(sizeof(*deformedVerts) * psys->hair_in_dm->getNumVerts(psys->hair_in_dm), "do_hair_dynamics vertexCos");
@@ -3174,7 +3179,8 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 	
 	MEM_freeN(deformedVerts);
 	
-	psys->clmd->sim_parms->effector_weights = NULL;
+	/* restore cloth effector weights */
+	psys->clmd->sim_parms->effector_weights = clmd_effweights;
 }
 static void hair_step(ParticleSimulationData *sim, float cfra)
 {




More information about the Bf-blender-cvs mailing list