diff options
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index c0849e6bff4..ba75760c07a 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2827,7 +2827,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf if (pset->brushtype == PE_BRUSH_WEIGHT) { pind.hkey[0] = NULL; /* pa != NULL since the weight brush is only available for hair */ - pind.hkey[1] = pa->hair; + pind.hkey[0] = pa->hair; + pind.hkey[1] = pa->hair + 1; } @@ -2885,12 +2886,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) { - float t2; - if (k == 0) { weight_to_rgb(ca->col, pind.hkey[1]->weight); } else { + /* warning: copied from 'do_particle_interpolation' (without 'mvert' array stepping) */ + float real_t; + if (result.time < 0.0f) { + real_t = -result.time; + } + else { + real_t = pind.hkey[0]->time + t * (pind.hkey[0][pa->totkey - 1].time - pind.hkey[0]->time); + } + + while (pind.hkey[1]->time < real_t) { + pind.hkey[1]++; + } + pind.hkey[0] = pind.hkey[1] - 1; + /* end copy */ + + float w1[3], w2[3]; keytime = (t - (*pind.ekey[0]->time)) / ((*pind.ekey[1]->time) - (*pind.ekey[0]->time)); @@ -2899,13 +2914,6 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf 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. */ - t2 = birthtime + ((float)k / (float)segments) * (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) { |