diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-05-04 16:31:24 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-05-04 16:31:24 +0400 |
commit | a7cbd5008e830224e73e2e55f89d0783ded422e5 (patch) | |
tree | 63f8d80c1db62e0a8f71db6d89de9d95e4b91fa0 /source/blender/blenkernel/intern | |
parent | cef3e3099a8d808474237e26cf373b3943897cb3 (diff) |
merging revisions 28564-28569 from render branch into trunk
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 31378e3a80a..3ac1ada58cb 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2950,7 +2950,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf float birthtime = 0.0, dietime = 0.0; float t, time = 0.0, keytime = 0.0, frs_sec; float hairmat[4][4], rotmat[3][3], prev_tangent[3]; - int k,i; + int k, i; int steps = (int)pow(2.0, (double)pset->draw_step); int totpart = edit->totpoint, recalc_set=0; float sel_col[3]; @@ -3097,17 +3097,26 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf /* selection coloring in edit mode */ if(pset->brushtype==PE_BRUSH_WEIGHT){ - if(k==0) + float t2; + + if(k==0) { weight_to_rgb(pind.hkey[1]->weight, ca->col, ca->col+1, ca->col+2); - else if(k >= steps - 1) - weight_to_rgb(pind.hkey[0]->weight, ca->col, ca->col+1, ca->col+2); - else - weight_to_rgb((1.0f - keytime) * pind.hkey[0]->weight + keytime * pind.hkey[1]->weight, ca->col, ca->col+1, ca->col+2); + } else { + float w1[3], w2[3]; + keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time)); + + weight_to_rgb(pind.hkey[0]->weight, w1, w1+1, w1+2); + weight_to_rgb(pind.hkey[1]->weight, w2, w2+1, w2+2); + + interp_v3_v3v3(ca->col, w1, w2, keytime); + } /* at the moment this is only used for weight painting. * will need to move out of this check if its used elsewhere. */ - pind.hkey[0] = pind.hkey[1]; - pind.hkey[1]++; + t2 = birthtime + ((float)(k+1)/(float)steps) * (dietime - birthtime); + + while (pind.hkey[1]->time < t2) pind.hkey[1]++; + pind.hkey[0] = pind.hkey[1] - 1; } else { if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT){ |