Fix #26408: [texture paint] brush spacing

Implemented non-spacing strokes (which are making paint step at each
mouse-move event).
This commit is contained in:
Sergey Sharybin 2011-03-08 19:52:35 +00:00
parent 3e43b5b72e
commit 1dc1b01c2a

@ -1018,6 +1018,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
len= normalize_v2(dmousepos); len= normalize_v2(dmousepos);
painter->accumdistance += len; painter->accumdistance += len;
if (brush->flag & BRUSH_SPACE) {
/* do paint op over unpainted distance */ /* do paint op over unpainted distance */
while ((len > 0.0f) && (painter->accumdistance >= spacing)) { while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
step= spacing - startdistance; step= spacing - startdistance;
@ -1042,6 +1043,18 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
painter->accumdistance -= spacing; painter->accumdistance -= spacing;
startdistance -= 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, pos, finalpos);
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 /* do airbrush paint ops, based on the number of paint ops left over
from regular painting. this is a temporary solution until we have from regular painting. this is a temporary solution until we have