diff options
author | Daniel Grosse <Spikebaby> | 2019-09-23 18:09:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-23 18:18:15 +0300 |
commit | 14acac0bb7f371da915188809b96de6ecaa3e507 (patch) | |
tree | 3341fdd209f9e6d1e9e4f415883db14b30cbc5e4 /source | |
parent | 2713921e8ac97144c6456b1bd5efe60f7e2463e3 (diff) |
Fix T70013: slow OpenGL calls for every vertex and weight painting step
Stroke update use now the location from Strokecache instead of the mouse
position.
Differential Revision: https://developer.blender.org/D5861
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 632b2472242..a171caeca6a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -193,17 +193,12 @@ static bool vertex_paint_use_fast_update_check(Object *ob) return false; } -static void paint_last_stroke_update(Scene *scene, ARegion *ar, const float mval[2]) +static void paint_last_stroke_update(Scene *scene, const float location[3]) { - const int mval_i[2] = {mval[0], mval[1]}; - float world[3]; - - if (ED_view3d_autodist_simple(ar, mval_i, world, 0, NULL)) { - UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; - ups->average_stroke_counter++; - add_v3_v3(ups->average_stroke_accum, world); - ups->last_stroke_valid = true; - } + UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; + ups->average_stroke_counter++; + add_v3_v3(ups->average_stroke_accum, location); + ups->last_stroke_valid = true; } /* polling - retrieve whether cursor should be set or operator should be done */ @@ -2349,7 +2344,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ - paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); + paint_last_stroke_update(scene, ss->cache->location); BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); @@ -3329,7 +3324,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* calculate pivot for rotation around seletion if needed */ /* also needed for "View Selected" on last stroke */ - paint_last_stroke_update(scene, vc->ar, ss->cache->mouse); + paint_last_stroke_update(scene, ss->cache->location); ED_region_tag_redraw(vc->ar); |