[Bf-blender-cvs] [3637371] gooseberry: Fix for unfreed effector weights in hair dynamics.

Lukas Tönne noreply at git.blender.org
Mon Feb 2 14:11:04 CET 2015


Commit: 3637371c96625dbe127663edddfca0e1bd7037a3
Author: Lukas Tönne
Date:   Mon Feb 2 14:09:02 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB3637371c96625dbe127663edddfca0e1bd7037a3

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 a8edab4..4a17e20 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3371,6 +3371,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 {
 	ParticleSystem *psys = sim->psys;
 	PARTICLE_P;
+	EffectorWeights *clmd_effweights;
 	int totpoint;
 	int totedge;
 	float (*deformedVerts)[3];
@@ -3422,6 +3423,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");
@@ -3437,7 +3442,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