diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-05-04 10:22:17 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-05-04 10:22:17 +0300 |
commit | 0375720e28892f2a6a34b849940b41ed2b407faa (patch) | |
tree | 48b77fba03d798761b71cb0d66e0f5dc9b3708a2 /source | |
parent | 0383047257d39dac534c59ab59bc619e6a1da1b2 (diff) |
Fix T95165: Custom Normals tools dont update immediately.
Recalc selection count at the end of the circle selection.
This was removed from circle selection as it became a performance
bottleneck, helas some operators rely on it.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 03862c6bdff..ffd33006cc2 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -4602,6 +4602,48 @@ static bool object_circle_select(ViewContext *vc, } /* not a real operator, only for circle test */ +static void view3d_circle_select_recalc(void *user_data) +{ + bContext *C = user_data; + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + ViewContext vc; + ED_view3d_viewcontext_init(C, &vc, depsgraph); + em_setup_viewcontext(C, &vc); + + if (vc.obedit) { + switch (vc.obedit->type) { + case OB_MESH: { + FOREACH_OBJECT_IN_MODE_BEGIN ( + vc.view_layer, vc.v3d, vc.obact->type, vc.obact->mode, ob_iter) { + ED_view3d_viewcontext_init_object(&vc, ob_iter); + BM_mesh_select_mode_flush_ex( + vc.em->bm, vc.em->selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL); + } + FOREACH_OBJECT_IN_MODE_END; + break; + } + + default: + break; + } + } +} + +static int view3d_circle_select_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + int result = WM_gesture_circle_modal(C, op, event); + if (result & OPERATOR_FINISHED) { + view3d_circle_select_recalc(C); + } + return result; +} + +static void view3d_circle_select_cancel(bContext *C, wmOperator *op) +{ + WM_gesture_circle_cancel(C, op); + view3d_circle_select_recalc(C); +} + static int view3d_circle_select_exec(bContext *C, wmOperator *op) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -4693,10 +4735,10 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot) ot->idname = "VIEW3D_OT_select_circle"; ot->invoke = WM_gesture_circle_invoke; - ot->modal = WM_gesture_circle_modal; + ot->modal = view3d_circle_select_modal; ot->exec = view3d_circle_select_exec; ot->poll = view3d_selectable_data; - ot->cancel = WM_gesture_circle_cancel; + ot->cancel = view3d_circle_select_cancel; /* flags */ ot->flag = OPTYPE_UNDO; |