fix for airbrush not using tablet pressure (any brush with BRUSH_SPACE disabled).
This commit is contained in:
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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 */
|
||||
|
||||
|
@@ -2655,7 +2655,7 @@ static void update_tablet_data(wmWindow *win, wmEvent *event)
|
||||
event->custom = EVT_DATA_TABLET;
|
||||
event->customdata = wmtab;
|
||||
event->customdatafree = 1;
|
||||
// printf("%s: using tablet %.5f\n", wmtab->Pressure, __func__);
|
||||
// printf("%s: using tablet %.5f\n", __func__, wmtab->Pressure);
|
||||
}
|
||||
else {
|
||||
// printf("%s: not using tablet\n", __func__);
|
||||
|
Reference in New Issue
Block a user