From 229b9f1299c6739db5c08ce84127e6390c3041ed Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Mon, 12 Oct 2020 20:32:26 +0200 Subject: Fix brush tip delta orientation with anchored strokes When using anchored stroke, the stroke operator was modifying the coordinates on the "mouse" rna property by setting them to the original position. Because of this, all the sculpt delta calculation was failing and the delta for these brushes was set randomly (with a 0 vector) at the beginning of the stroke. There is now an extra property that uses the unmodified coordinates of the mouse to calculate the delta. Now delta orientation works as expected in all brushes and features that require brush tip orientation. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9183 --- source/blender/editors/sculpt_paint/paint_stroke.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c') diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index da0a8dbd4b8..0da0b191537 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -621,7 +621,10 @@ static void paint_brush_stroke_add_step(bContext *C, RNA_collection_add(op->ptr, "stroke", &itemptr); RNA_float_set(&itemptr, "size", ups->pixel_radius); RNA_float_set_array(&itemptr, "location", location); + /* Mouse coordinates modified by the stroke type options. */ RNA_float_set_array(&itemptr, "mouse", mouse_out); + /* Original mouse coordinates. */ + RNA_float_set_array(&itemptr, "mouse_event", mouse_in); RNA_boolean_set(&itemptr, "pen_flip", stroke->pen_flip); RNA_float_set(&itemptr, "pressure", pressure); RNA_float_set(&itemptr, "x_tilt", stroke->x_tilt); -- cgit v1.2.3