diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-06-12 22:30:46 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-06-22 12:01:28 +0300 |
commit | 7682e0a697fd1274f78c352038315ea28e9d9e13 (patch) | |
tree | a5a059bd5dc755aec47099e2295577efc9602d1f /source/blender/editors | |
parent | 2755a469ed43dfa989488e51796f9c9e43b2f92b (diff) |
Fix T98745: Anchored mode not working for sculpt smear brush
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_paint_color.c | 21 |
2 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 34647cd9bf6..e61fef50e2f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4317,7 +4317,8 @@ static bool sculpt_needs_delta_from_anchored_origin(Brush *brush) SCULPT_TOOL_POSE, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_THUMB, - SCULPT_TOOL_ELASTIC_DEFORM)) { + SCULPT_TOOL_ELASTIC_DEFORM, + SCULPT_TOOL_SMEAR)) { return true; } if (brush->sculpt_tool == SCULPT_TOOL_CLOTH && @@ -4366,6 +4367,7 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_POSE, SCULPT_TOOL_BOUNDARY, + SCULPT_TOOL_SMEAR, SCULPT_TOOL_THUMB) && !sculpt_brush_use_topology_rake(ss, brush)) { return; diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c index ac05652b058..fa9f24377da 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c @@ -380,6 +380,15 @@ static void do_smear_brush_task_cb_exec(void *__restrict userdata, ss, &test, data->brush->falloff_shape); const int thread_id = BLI_task_parallel_thread_id(tls); + float brush_delta[3]; + + if (brush->flag & BRUSH_ANCHORED) { + copy_v3_v3(brush_delta, ss->cache->grab_delta_symmetry); + } + else { + sub_v3_v3v3(brush_delta, ss->cache->location, ss->cache->last_location); + } + BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { if (!sculpt_brush_test_sq_fn(&test, vd.co)) { continue; @@ -404,7 +413,7 @@ static void do_smear_brush_task_cb_exec(void *__restrict userdata, switch (brush->smear_deform_type) { case BRUSH_SMEAR_DEFORM_DRAG: - sub_v3_v3v3(current_disp, ss->cache->location, ss->cache->last_location); + copy_v3_v3(current_disp, brush_delta); break; case BRUSH_SMEAR_DEFORM_PINCH: sub_v3_v3v3(current_disp, ss->cache->location, vd.co); @@ -529,12 +538,10 @@ void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode const int totvert = SCULPT_vertex_count_get(ss); - if (SCULPT_stroke_is_first_brush_step(ss->cache)) { - if (!ss->cache->prev_colors) { - ss->cache->prev_colors = MEM_callocN(sizeof(float[4]) * totvert, "prev colors"); - for (int i = 0; i < totvert; i++) { - SCULPT_vertex_color_get(ss, i, ss->cache->prev_colors[i]); - } + if (!ss->cache->prev_colors) { + ss->cache->prev_colors = MEM_callocN(sizeof(float[4]) * totvert, "prev colors"); + for (int i = 0; i < totvert; i++) { + SCULPT_vertex_color_get(ss, i, ss->cache->prev_colors[i]); } } |