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:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-03-08 22:52:35 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2011-03-08 22:52:35 +0300
commit1dc1b01c2a8e7394c5bb43da9ca6ba574758786c (patch)
tree0561c0c4ad61f4d70c4dfe75e087d14fb6818022 /source/blender/blenkernel/intern/brush.c
parent3e43b5b72ec7739fb073ff3f4dbd9f7079b0b792 (diff)
Fix #26408: [texture paint] brush spacing
Implemented non-spacing strokes (which are making paint step at each mouse-move event).
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r--source/blender/blenkernel/intern/brush.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index f4d117d8a07..6e9c383f2a6 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -1018,29 +1018,42 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
len= normalize_v2(dmousepos);
painter->accumdistance += len;
- /* do paint op over unpainted distance */
- while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
- step= spacing - startdistance;
- paintpos[0]= painter->lastmousepos[0] + dmousepos[0]*step;
- paintpos[1]= painter->lastmousepos[1] + dmousepos[1]*step;
+ if (brush->flag & BRUSH_SPACE) {
+ /* do paint op over unpainted distance */
+ while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
+ step= spacing - startdistance;
+ paintpos[0]= painter->lastmousepos[0] + dmousepos[0]*step;
+ paintpos[1]= painter->lastmousepos[1] + dmousepos[1]*step;
+
+ t = step/len;
+ press= (1.0f-t)*painter->lastpressure + t*pressure;
+ brush_apply_pressure(painter, brush, press);
+ spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
- t = step/len;
- press= (1.0f-t)*painter->lastpressure + t*pressure;
- brush_apply_pressure(painter, brush, press);
- spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
+ brush_jitter_pos(brush, paintpos, finalpos);
- brush_jitter_pos(brush, paintpos, finalpos);
+ if (painter->cache.enabled)
+ brush_painter_refresh_cache(painter, finalpos);
+
+ totpaintops +=
+ func(user, painter->cache.ibuf, painter->lastpaintpos, finalpos);
+
+ painter->lastpaintpos[0]= paintpos[0];
+ painter->lastpaintpos[1]= paintpos[1];
+ painter->accumdistance -= spacing;
+ startdistance -= spacing;
+ }
+ } else {
+ brush_jitter_pos(brush, pos, finalpos);
if (painter->cache.enabled)
brush_painter_refresh_cache(painter, finalpos);
- totpaintops +=
- func(user, painter->cache.ibuf, painter->lastpaintpos, finalpos);
+ totpaintops += func(user, painter->cache.ibuf, pos, finalpos);
- painter->lastpaintpos[0]= paintpos[0];
- painter->lastpaintpos[1]= paintpos[1];
- painter->accumdistance -= spacing;
- startdistance -= spacing;
+ painter->lastpaintpos[0]= pos[0];
+ painter->lastpaintpos[1]= pos[1];
+ painter->accumdistance= 0;
}
/* do airbrush paint ops, based on the number of paint ops left over