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:
authorAntony Riakiotakis <kalast@gmail.com>2014-09-01 23:10:17 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-09-01 23:11:48 +0400
commit4f7caabe9dd89a527f2b153274f0d323b49cd85b (patch)
treec235274ca9305ea505fb7c0403be04e3aae691a8 /source/blender/editors/sculpt_paint/paint_stroke.c
parent1979ae3a420b98663c37ab3f377b5d7dc265e33d (diff)
Fix T41665, stroke jittering used when setting the clone cursor
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 1e806e8341a..59a85b299ef 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -112,7 +112,7 @@ typedef struct PaintStroke {
float cached_size_pressure;
/* last pressure will store last pressure value for use in interpolation for space strokes */
float last_pressure;
-
+ int stroke_mode;
float zoom_2d;
int pen_flip;
@@ -347,6 +347,20 @@ static bool paint_brush_update(bContext *C,
return location_success;
}
+static bool paint_stroke_use_jitter(PaintMode mode, Brush *brush, bool invert)
+{
+ bool use_jitter = (brush->flag & BRUSH_ABSOLUTE_JITTER) ?
+ (brush->jitter_absolute != 0) : (brush->jitter != 0);
+
+ /* jitter-ed brush gives weird and unpredictable result for this
+ * kinds of stroke, so manually disable jitter usage (sergey) */
+ use_jitter &= (brush->flag & (BRUSH_DRAG_DOT | BRUSH_ANCHORED)) == 0;
+ use_jitter &= (!ELEM(mode, PAINT_TEXTURE_2D, PAINT_TEXTURE_PROJECTIVE) ||
+ !(invert && brush->imagepaint_tool == PAINT_TOOL_CLONE));
+
+
+ return use_jitter;
+}
/* Put the location of the next stroke dot into the stroke RNA and apply it to the mesh */
static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float mouse_in[2], float pressure)
@@ -382,6 +396,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
copy_v2_v2(stroke->last_mouse_position, mouse_in);
stroke->last_pressure = pressure;
+ if (paint_stroke_use_jitter(mode, brush, stroke->stroke_mode == BRUSH_STROKE_INVERT))
{
float delta[2];
float factor = stroke->zoom_2d;
@@ -400,6 +415,9 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
add_v2_v2v2(mouse_out, mouse_in, delta);
}
}
+ else {
+ copy_v2_v2(mouse_out, mouse_in);
+ }
if (!paint_brush_update(C, brush, mode, stroke, mouse_in, mouse_out, pressure, location)) {
return;
@@ -615,6 +633,7 @@ PaintStroke *paint_stroke_new(bContext *C,
stroke->done = done;
stroke->event_type = event_type; /* for modal, return event */
stroke->ups = ups;
+ stroke->stroke_mode = RNA_enum_get(op->ptr, "mode");
get_imapaint_zoom(C, &zoomx, &zoomy);
stroke->zoom_2d = max_ff(zoomx, zoomy);