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.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user