forked from bartvdbraak/blender
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:
parent
3e43b5b72e
commit
1dc1b01c2a
@ -1018,29 +1018,42 @@ 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;
|
||||||
|
|
||||||
/* do paint op over unpainted distance */
|
if (brush->flag & BRUSH_SPACE) {
|
||||||
while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
|
/* do paint op over unpainted distance */
|
||||||
step= spacing - startdistance;
|
while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
|
||||||
paintpos[0]= painter->lastmousepos[0] + dmousepos[0]*step;
|
step= spacing - startdistance;
|
||||||
paintpos[1]= painter->lastmousepos[1] + dmousepos[1]*step;
|
paintpos[0]= painter->lastmousepos[0] + dmousepos[0]*step;
|
||||||
|
paintpos[1]= painter->lastmousepos[1] + dmousepos[1]*step;
|
||||||
|
|
||||||
t = step/len;
|
t = step/len;
|
||||||
press= (1.0f-t)*painter->lastpressure + t*pressure;
|
press= (1.0f-t)*painter->lastpressure + t*pressure;
|
||||||
brush_apply_pressure(painter, brush, press);
|
brush_apply_pressure(painter, brush, press);
|
||||||
spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
|
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)
|
if (painter->cache.enabled)
|
||||||
brush_painter_refresh_cache(painter, finalpos);
|
brush_painter_refresh_cache(painter, finalpos);
|
||||||
|
|
||||||
totpaintops +=
|
totpaintops += func(user, painter->cache.ibuf, pos, finalpos);
|
||||||
func(user, painter->cache.ibuf, painter->lastpaintpos, finalpos);
|
|
||||||
|
|
||||||
painter->lastpaintpos[0]= paintpos[0];
|
painter->lastpaintpos[0]= pos[0];
|
||||||
painter->lastpaintpos[1]= paintpos[1];
|
painter->lastpaintpos[1]= pos[1];
|
||||||
painter->accumdistance -= spacing;
|
painter->accumdistance= 0;
|
||||||
startdistance -= spacing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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
|
||||||
|
Loading…
Reference in New Issue
Block a user