diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-02 06:41:41 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-02 06:43:48 +0300 |
commit | 24310441ddc85ecc8dc857ccc75b508db59bd844 (patch) | |
tree | 9a87e2ff0750f171d5ffecdbd317af83d452f313 /source/blender/editors/space_view3d | |
parent | 348d7c35a9f9ffb56e716430100a3d167884889c (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_cursor_snap.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_placement.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c index baf61befcba..479acb3cb1a 100644 --- a/source/blender/editors/space_view3d/view3d_cursor_snap.c +++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c @@ -777,6 +777,13 @@ static bool v3d_cursor_snap_pool_fn(bContext *C) return false; }; + V3DSnapCursorState *state = ED_view3d_cursor_snap_state_get(); + if (state->region && (state->region != region)) { + /* Some gizmos are still available even when the region is not available. + * We need to disable the cursor in these cases. */ + return false; + } + return true; } diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index 572fc8e3156..7ad512fd029 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -1515,10 +1515,11 @@ static void preview_plane_free_fn(void *customdata) ED_view3d_cursor_snap_deactive(snap_state); } -static void WIDGETGROUP_placement_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup) +static void WIDGETGROUP_placement_setup(const bContext *C, wmGizmoGroup *gzgroup) { V3DSnapCursorState *snap_state = ED_view3d_cursor_snap_active(); if (snap_state) { + snap_state->region = CTX_wm_region(C); snap_state->draw_plane = true; gzgroup->customdata = snap_state; |