fix for airbrush not using tablet pressure (any brush with BRUSH_SPACE disabled).

This commit is contained in:
Campbell Barton
2013-01-16 19:59:55 +00:00
parent ea86ac5446
commit 7f513023d4
4 changed files with 13 additions and 6 deletions

View File

@@ -61,7 +61,8 @@ struct PaintStroke *paint_stroke_new(struct bContext *C,
StrokeUpdateStep update_step, StrokeDone done, int event_type); StrokeUpdateStep update_step, StrokeDone done, int event_type);
void paint_stroke_data_free(struct wmOperator *op); 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); struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);

View File

@@ -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 */ /* 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) && return (br->flag & BRUSH_SPACE) && paint_supports_dynamic_size(br);
!(br->flag & BRUSH_ANCHORED) && }
/* 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); !ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
} }

View File

@@ -3882,8 +3882,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
* brush coord/pressure/etc. * brush coord/pressure/etc.
* It's more an events design issue, which doesn't split coordinate/pressure/angle * 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 */ * 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"); cache->pressure = RNA_float_get(ptr, "pressure");
}
/* Truly temporary data that isn't stored in properties */ /* Truly temporary data that isn't stored in properties */

View File

@@ -2655,7 +2655,7 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
event->custom = EVT_DATA_TABLET; event->custom = EVT_DATA_TABLET;
event->customdata = wmtab; event->customdata = wmtab;
event->customdatafree = 1; event->customdatafree = 1;
// printf("%s: using tablet %.5f\n", wmtab->Pressure, __func__); // printf("%s: using tablet %.5f\n", __func__, wmtab->Pressure);
} }
else { else {
// printf("%s: not using tablet\n", __func__); // printf("%s: not using tablet\n", __func__);