From 24310441ddc85ecc8dc857ccc75b508db59bd844 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 2 Nov 2021 00:41:41 -0300 Subject: Fix snap cursor still active even when gizmo is not available The snap cursor continued to appear even when the workspace is changed for example. So add the region to check in the cursor pool. --- source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/gizmo_library/gizmo_types') diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index 93ee6ec2d81..60642158820 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -241,6 +241,10 @@ static void snap_gizmo_draw(const bContext *UNUSED(C), wmGizmo *UNUSED(gz)) static int snap_gizmo_test_select(bContext *C, wmGizmo *gz, const int mval[2]) { SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz; + ARegion *region = CTX_wm_region(C); + + /* Make sure the cursor is only drawn in the gizmo region. */ + snap_gizmo->snap_state->region = region; /* Snap Elements can change while the gizmo is active. Need to be updated somewhere. */ snap_gizmo_snap_elements_update(snap_gizmo); @@ -251,7 +255,6 @@ static int snap_gizmo_test_select(bContext *C, wmGizmo *gz, const int mval[2]) wmWindowManager *wm = CTX_wm_manager(C); const wmEvent *event = wm->winactive ? wm->winactive->eventstate : NULL; if (event) { - ARegion *region = CTX_wm_region(C); x = event->xy[0] - region->winrct.xmin; y = event->xy[1] - region->winrct.ymin; } -- cgit v1.2.3