diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-02 06:46:32 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-11-02 06:46:32 +0300 |
commit | 5363437555cd46eca6bbfd80d3e42f8e625ccf17 (patch) | |
tree | f07d2fe4cce824d5b334d5b95a583b18c724b34c /source/blender/editors | |
parent | 75f5edcaf3380471ea038a7e182909ca97d081d2 (diff) | |
parent | 24310441ddc85ecc8dc857ccc75b508db59bd844 (diff) |
Merge branch 'blender-v3.0-release'
Diffstat (limited to 'source/blender/editors')
4 files changed, 14 insertions, 2 deletions
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; } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 6d20044d8cf..ebf3316a509 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -277,6 +277,7 @@ typedef struct V3DSnapCursorState { uchar color_line[4]; uchar color_point[4]; uchar color_box[4]; + struct ARegion *region; /* Forces the cursor to be drawn only in this specific region. */ float *prevpoint; float box_dimensions[3]; short snap_elem_force; /* If zero, use scene settings. */ 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; |