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-01-15 17:48:44 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2011-01-15 17:48:44 +0300
commitc6abe115129651abd80aa361ca9bf717cf81c382 (patch)
treec6d9647d16f38bad13fee13e1e9666cd7edae071 /source/blender/editors/sculpt_paint
parent384025f1a0ceaadfd1d623cc61f25d7426301a5b (diff)
IRC bugreport fix: thumb brush works incorrect when using tablet by Dan McGrath (troubled)
Quite silly fix, not sure if it could be smarter with current events/brushes design. Use pressure_value from first brush step for brushes which don't support strokes -- thumb. brush, brushes with anchored stroke method. Should be fixed in nicer way after events redesigning. P.S. Tried to place pressure saving into invaliants update fuunction, but it seens that this function wouldn't know about pressure yet.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h2
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c16
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c8
3 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 821df3028e1..d0aa0c29c4d 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -56,6 +56,8 @@ struct PaintStroke *paint_stroke_new(struct bContext *C,
StrokeUpdateStep update_step, StrokeDone done);
void paint_stroke_free(struct PaintStroke *stroke);
+int paint_space_stroke_enabled(struct Brush *br);
+
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index f6136bced94..92b5c541ea2 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -738,14 +738,6 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
return 1;
}
-/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
-static int paint_space_stroke_enabled(Brush *br)
-{
- return (br->flag & BRUSH_SPACE) &&
- !(br->flag & BRUSH_ANCHORED) &&
- !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
-}
-
/* For brushes with stroke spacing enabled, moves mouse in steps
towards the final mouse location. */
static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const float final_mouse[2])
@@ -818,6 +810,14 @@ void paint_stroke_free(PaintStroke *stroke)
MEM_freeN(stroke);
}
+/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
+int paint_space_stroke_enabled(Brush *br)
+{
+ return (br->flag & BRUSH_SPACE) &&
+ !(br->flag & BRUSH_ANCHORED) &&
+ !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
+}
+
int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
{
PaintStroke *stroke = op->customdata;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a14811face8..58398bd1f5c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2916,7 +2916,13 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession
cache->pen_flip = RNA_boolean_get(ptr, "pen_flip");
RNA_float_get_array(ptr, "mouse", cache->mouse);
- cache->pressure = RNA_float_get(ptr, "pressure");
+ /* XXX: Use preassure value from first brush step for brushes which don't
+ support strokes (grab, thumb). They depends on initial state and
+ brush coord/pressure/etc.
+ It's more an events design issue, which doesn't split coordinate/pressure/angle
+ changing events. We should avoid this after events system re-design */
+ if(paint_space_stroke_enabled(brush) || cache->first_time)
+ cache->pressure = RNA_float_get(ptr, "pressure");
/* Truly temporary data that isn't stored in properties */