diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 23:59:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-01-16 23:59:55 +0400 |
commit | 7f513023d4fc730c63a26a445b5523498f554710 (patch) | |
tree | 36c47583d08fcadc6537749823f27ef062e81fb7 /source/blender/editors/sculpt_paint | |
parent | ea86ac54468cc36f1db74aec6cb64e44e9956e42 (diff) |
fix for airbrush not using tablet pressure (any brush with BRUSH_SPACE disabled).
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_intern.h | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 11 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 3 |
3 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index cf55c93efe4..75a95d4d6fd 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -61,7 +61,8 @@ struct PaintStroke *paint_stroke_new(struct bContext *C, StrokeUpdateStep update_step, StrokeDone done, int event_type); void paint_stroke_data_free(struct wmOperator *op); -int paint_space_stroke_enabled(struct Brush *br); +bool paint_space_stroke_enabled(struct Brush *br); +bool paint_supports_dynamic_size(struct Brush *br); struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 2f4115dcd94..3b52dc3410f 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -324,10 +324,15 @@ static void stroke_done(struct bContext *C, struct wmOperator *op) } /* Returns zero if the stroke dots should not be spaced, non-zero otherwise */ -int paint_space_stroke_enabled(Brush *br) +bool paint_space_stroke_enabled(Brush *br) { - return (br->flag & BRUSH_SPACE) && - !(br->flag & BRUSH_ANCHORED) && + return (br->flag & BRUSH_SPACE) && paint_supports_dynamic_size(br); +} + +/* return true if the brush size can change during paint (normally used for pressure) */ +bool paint_supports_dynamic_size(Brush *br) +{ + return !(br->flag & BRUSH_ANCHORED) && !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 4ddae3f82d3..2758cc29a3e 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3882,8 +3882,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, * 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) + if (paint_supports_dynamic_size(brush) || cache->first_time) { cache->pressure = RNA_float_get(ptr, "pressure"); + } /* Truly temporary data that isn't stored in properties */ |