diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-02-02 16:09:02 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-02-02 16:19:05 +0300 |
commit | 14755dde97333076d1d26e2fe3c83110b55e56cd (patch) | |
tree | 296a9adba823e6655cbed6b466cbe6506c3c4e9c /source/blender/blenkernel/intern/particle_system.c | |
parent | 159124726e8ab9c0143f264aebe2b0b3563d819f (diff) |
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 ...
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9c2867264c2..04181606796 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) { |