Merge branch 'blender-v3.0-release'

This commit is contained in:
Germano Cavalcante 2021-11-07 20:45:19 -03:00
commit 4f387e66ac
Notes: blender-bot 2023-02-14 05:25:44 +01:00
Referenced by issue #92645, OSL: Blender crashes when activating object with OSL material (still)
Referenced by issue #91835, Adding animation data on instanced objects crashes the blender
4 changed files with 11 additions and 10 deletions

View File

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

View File

@ -277,7 +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. */
struct wmGizmoGroupType *gzgrp_type; /* Force cursor to be drawn only when gizmo is available. */
float *prevpoint;
float box_dimensions[3];
short snap_elem_force; /* If zero, use scene settings. */

View File

@ -778,10 +778,13 @@ static bool v3d_cursor_snap_pool_fn(bContext *C)
};
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;
if (state->gzgrp_type) {
/* Check the respective gizmo group is in the region. */
wmGizmoMap *gzmap = region->gizmo_map;
if (WM_gizmomap_group_find_ptr(gzmap, state->gzgrp_type) == NULL) {
/* Wrong viewport. */
return false;
}
}
return true;

View File

@ -1519,7 +1519,7 @@ 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->gzgrp_type = gzgroup->type;
snap_state->draw_plane = true;
gzgroup->customdata = snap_state;