diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-02 05:01:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-02 05:01:07 +0400 |
commit | 15ad39e6848ea54da8a3f36b867f8b09a7b8b163 (patch) | |
tree | 53e4f1c2f37d0e2f3679e284a8f7c0f3f66f6d5c /source/blender/blenkernel/intern/dynamicpaint.c | |
parent | ce6487291349b00a85f265d2b8cfb682e2bb8086 (diff) | |
parent | 1936b31cd0f7741ec39f638cc57286e5b379134c (diff) |
svn merge ^/trunk/blender -r42303:42329
Diffstat (limited to 'source/blender/blenkernel/intern/dynamicpaint.c')
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 5fbb69f32fb..229f2125364 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3566,7 +3566,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, float radius = 0.0f; float strength = 0.0f; float velocity_val = 0.0f; - int part_index; + int part_index= -1; /* * With predefined radius, there is no variation between particles. @@ -3638,10 +3638,12 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, part_index = nearest[n].index; /* If inside solid range and no disp depth required, no need to seek further */ - if (s_range < 0.0f) - if (surface->type != MOD_DPAINT_SURFACE_T_DISPLACE && - surface->type != MOD_DPAINT_SURFACE_T_WAVE) + if ( (s_range < 0.0f) && + (surface->type != MOD_DPAINT_SURFACE_T_DISPLACE) && + (surface->type != MOD_DPAINT_SURFACE_T_WAVE)) + { break; + } } if (nearest) MEM_freeN(nearest); @@ -3669,7 +3671,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, float depth = 0.0f; /* apply velocity */ - if (brush->flags & MOD_DPAINT_USES_VELOCITY) { + if ((brush->flags & MOD_DPAINT_USES_VELOCITY) && (part_index != -1)) { float velocity[3]; ParticleData *pa = psys->particles + part_index; mul_v3_v3fl(velocity, pa->state.vel, particle_timestep); @@ -3681,8 +3683,9 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, velocity_val = len_v3(velocity); /* store brush velocity for smudge */ - if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && - brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) { + if ( (surface->type == MOD_DPAINT_SURFACE_T_PAINT) && + (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity)) + { copy_v3_v3(&bData->brush_velocity[index*4], velocity); mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val); bData->brush_velocity[index*4+3] = velocity_val; @@ -3690,12 +3693,11 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, } if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { - paintColor[0] = brush->r; - paintColor[1] = brush->g; - paintColor[2] = brush->b; + copy_v3_v3(paintColor, &brush->r); } - else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || - surface->type == MOD_DPAINT_SURFACE_T_WAVE) { + else if ( (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) || + (surface->type == MOD_DPAINT_SURFACE_T_WAVE)) + { /* get displace depth */ disp_intersect = (1.0f - sqrtf(disp_intersect / radius)) * radius; depth = (radius - disp_intersect) / bData->bNormal[index].normal_scale; |