Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2010-10-29 14:31:45 +0400
committerJanne Karhu <jhkarh@gmail.com>2010-10-29 14:31:45 +0400
commitce74b14850c06b77c069a2633a731a60a8d9ab03 (patch)
tree2e0aff9e14af8994b59bb4d765554d91e67ebffc /source/blender/editors
parent6a9a49f8afe1e5825dc182eedff57a1c4d4290fe (diff)
Fix for [#24430] Hair Dynamics Problem
* Hair added in particle mode didn't have any weights assigned.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/physics/particle_edit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 57867fdc441..10313868500 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3200,6 +3200,7 @@ static int brush_add(PEData *data, short number)
framestep= pa->lifetime/(float)(pset->totaddkey-1);
if(tree) {
+ ParticleData *ppa;
HairKey *hkey;
ParticleKey key[3];
KDTreeNearest ptn[3];
@@ -3224,6 +3225,8 @@ static int brush_add(PEData *data, short number)
for(w=0; w<maxw; w++)
weight[w] /= totw;
+ ppa= psys->particles+ptn[0].index;
+
for(k=0; k<pset->totaddkey; k++) {
hkey= (HairKey*)pa->hair + k;
hkey->time= pa->time + k * framestep;
@@ -3232,6 +3235,9 @@ static int brush_add(PEData *data, short number)
psys_get_particle_on_path(&sim, ptn[0].index, key, 0);
mul_v3_fl(key[0].co, weight[0]);
+ /* TODO: interpolatint the weight would be nicer */
+ hkey->weight= (ppa->hair+MIN2(k, ppa->totkey-1))->weight;
+
if(maxw>1) {
key[1].time= key[0].time;
psys_get_particle_on_path(&sim, ptn[1].index, key + 1, 0);
@@ -3258,6 +3264,7 @@ static int brush_add(PEData *data, short number)
for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
VECADDFAC(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
hkey->time += k * framestep;
+ hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1);
}
}
for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {