From ea4309925f1d2d2a224bd1dce12269a58ade9b62 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 18 Jun 2021 15:31:14 +0200 Subject: Performance: Limit recounting during selection mode flushing. This patch ensures that selection mode flushing updates total selection counts internally. This reduces recounting when we are sure that the input total selection counts were up to date. For example for circle selection the total selection counts were correct. But during flushing the selection could have been changed and therefore the selection was always recounted. This increased the performance on selected system from 6.90 FPS to 8.25 FPS during circle selection operations. Before: {F10179981} After: {F10179982} Reviewed By: mano-wii Differential Revision: https://developer.blender.org/D11647 --- source/blender/editors/mesh/editmesh_utils.c | 2 +- source/blender/editors/space_view3d/view3d_select.c | 6 +++++- source/blender/editors/uvedit/uvedit_path.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 071ca818120..f70d9b044ac 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -438,7 +438,7 @@ void EDBM_selectmode_to_scene(bContext *C) void EDBM_selectmode_flush_ex(BMEditMesh *em, const short selectmode) { - BM_mesh_select_mode_flush_ex(em->bm, selectmode); + BM_mesh_select_mode_flush_ex(em->bm, selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL); } void EDBM_selectmode_flush(BMEditMesh *em) diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 757ed13ac28..6a7ee46f719 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -3725,6 +3725,9 @@ static bool mesh_circle_select(ViewContext *vc, if (SEL_OP_USE_PRE_DESELECT(sel_op)) { if (vc->em->bm->totvertsel) { EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT); + vc->em->bm->totvertsel = 0; + vc->em->bm->totedgesel = 0; + vc->em->bm->totfacesel = 0; changed = true; } } @@ -3790,7 +3793,8 @@ static bool mesh_circle_select(ViewContext *vc, changed |= data.is_changed; if (changed) { - EDBM_selectmode_flush(vc->em); + BM_mesh_select_mode_flush_ex( + vc->em->bm, vc->em->selectmode, BM_SELECT_LEN_FLUSH_RECALC_NOTHING); } return changed; } diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c index 016a054cf21..2613c5b23a0 100644 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@ -552,7 +552,7 @@ static bool uv_shortest_path_pick_ex(const SpaceImage *sima, if (uv_selectmode & UV_SELECT_EDGE) { /* Special case as we don't use true edge selection, * flush the selection from the vertices. */ - BM_mesh_select_mode_flush_ex(em->bm, SCE_SELECT_VERTEX); + BM_mesh_select_mode_flush_ex(em->bm, SCE_SELECT_VERTEX, BM_SELECT_LEN_FLUSH_RECALC_ALL); } } ED_uvedit_select_sync_flush(scene->toolsettings, em, select); -- cgit v1.2.3