[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32761] trunk/blender/source/blender/ editors/physics/particle_edit.c: Fix for [#24430] Hair Dynamics Problem
Janne Karhu
jhkarh at gmail.com
Fri Oct 29 12:31:46 CEST 2010
Revision: 32761
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32761
Author: jhk
Date: 2010-10-29 12:31:45 +0200 (Fri, 29 Oct 2010)
Log Message:
-----------
Fix for [#24430] Hair Dynamics Problem
* Hair added in particle mode didn't have any weights assigned.
Modified Paths:
--------------
trunk/blender/source/blender/editors/physics/particle_edit.c
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2010-10-29 07:11:45 UTC (rev 32760)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2010-10-29 10:31:45 UTC (rev 32761)
@@ -3200,6 +3200,7 @@
framestep= pa->lifetime/(float)(pset->totaddkey-1);
if(tree) {
+ ParticleData *ppa;
HairKey *hkey;
ParticleKey key[3];
KDTreeNearest ptn[3];
@@ -3224,6 +3225,8 @@
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 @@
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 @@
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++) {
More information about the Bf-blender-cvs
mailing list