From 56ee96349dce3826999a1ebcfff890d8066dce50 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Sun, 7 Nov 2021 20:44:20 -0300 Subject: Fix snap cursor not active even if gizmo is available Error introduced in rB69d6222481b4 and partially fixed in rB24310441ddc8. When gizmo was turned on but the scene has more than one 3D viewport, one of them the snap cursor did not appear. --- source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (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 60642158820..b618aa41f4c 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -226,6 +226,7 @@ static void snap_gizmo_setup(wmGizmo *gz) SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz; snap_gizmo->snap_state = ED_view3d_cursor_snap_active(); if (snap_gizmo->snap_state) { + snap_gizmo->snap_state->gzgrp_type = gz->parent_gzgroup->type; snap_gizmo->snap_state->draw_point = true; snap_gizmo->snap_state->draw_plane = false; } @@ -241,10 +242,6 @@ 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); @@ -255,6 +252,7 @@ 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