Merge branch 'blender-v3.0-release'

This commit is contained in:
Germano Cavalcante 2021-11-02 00:46:32 -03:00
commit 5363437555
4 changed files with 14 additions and 2 deletions

View File

@ -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;
}

View File

@ -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. */

View File

@ -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;
}

View File

@ -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;