Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c3
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h7
-rw-r--r--source/blender/makesrna/intern/rna_brush.c5
4 files changed, 18 insertions, 3 deletions
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);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 078baf0dfc6..16b5d770fa2 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -6607,6 +6607,7 @@ static void sculpt_update_cache_invariants(
}
copy_v2_v2(cache->mouse, cache->initial_mouse);
+ copy_v2_v2(cache->mouse_event, cache->initial_mouse);
copy_v2_v2(ups->tex_mouse, cache->initial_mouse);
/* Truly temporary data that isn't stored in properties. */
@@ -6734,8 +6735,8 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
const float mouse[2] = {
- cache->mouse[0],
- cache->mouse[1],
+ cache->mouse_event[0],
+ cache->mouse_event[1],
};
int tool = brush->sculpt_tool;
@@ -6946,6 +6947,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
cache->pen_flip = RNA_boolean_get(ptr, "pen_flip");
RNA_float_get_array(ptr, "mouse", cache->mouse);
+ RNA_float_get_array(ptr, "mouse_event", cache->mouse_event);
/* XXX: Use pressure value from first brush step for brushes which don't support strokes (grab,
* thumb). They depends on initial state and brush coord/pressure/etc.
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index ec4d594293a..916e7336c37 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -868,12 +868,17 @@ typedef struct StrokeCache {
bool pen_flip;
bool invert;
float pressure;
- float mouse[2];
float bstrength;
float normal_weight; /* from brush (with optional override) */
float x_tilt;
float y_tilt;
+ /* Position of the mouse corresponding to the stroke location, modified by the paint_stroke
+ * operator acording to the stroke type. */
+ float mouse[2];
+ /* Position of the mouse event in screen space, not modified by the stroke type. */
+ float mouse_event[2];
+
float (*prev_colors)[4];
/* The rest is temporary storage that isn't saved as a property */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index eed278c3980..ac876eac7db 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -3426,6 +3426,11 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
RNA_def_property_array(prop, 2);
RNA_def_property_ui_text(prop, "Mouse", "");
+ prop = RNA_def_property(srna, "mouse_event", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Mouse Event", "");
+
prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_flag(prop, PROP_IDPROPERTY);
RNA_def_property_range(prop, 0.0f, 1.0f);