Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c59
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_camera.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c242
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c4
12 files changed, 106 insertions, 295 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 57b98ffeda3..d1ea01146bc 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1140,7 +1140,7 @@ static void view3d_header_region_listener(wmWindow *UNUSED(win),
}
/* From topbar, which ones are needed? split per header? */
- /* Disable for now, re-enable if neede, or remove - campbell. */
+ /* Disable for now, re-enable if needed, or remove - campbell. */
#if 0
/* context changes */
switch (wmn->category) {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index eef36dae86a..8844428b1bf 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -803,13 +803,19 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
GPU_depth_test(true);
+ /* Needed in cases the view-port isn't already setup. */
+ WM_draw_region_viewport_ensure(ar, SPACE_VIEW3D);
+ WM_draw_region_viewport_bind(ar);
+
GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
/* When Blender is starting, a click event can trigger a depth test while the viewport is not
* yet available. */
if (viewport != NULL) {
- DRW_draw_depth_loop(depsgraph, ar, v3d, viewport);
+ DRW_draw_depth_loop(depsgraph, ar, v3d, viewport, false);
}
+ WM_draw_region_viewport_unbind(ar);
+
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_disable();
}
@@ -1076,7 +1082,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d)
static void view3d_draw_border(const bContext *C, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
RegionView3D *rv3d = ar->regiondata;
View3D *v3d = CTX_wm_view3d(C);
@@ -1447,7 +1453,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
static void view3d_draw_view(const bContext *C, ARegion *ar)
{
ED_view3d_draw_setup_view(CTX_wm_window(C),
- CTX_data_depsgraph(C),
+ CTX_data_expect_evaluated_depsgraph(C),
CTX_data_scene(C),
ar,
CTX_wm_view3d(C),
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 386c3164843..4c03995307a 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -155,11 +155,13 @@ void ED_view3d_clipping_enable(void)
/**
* \note Only use in object mode.
*/
-static void validate_object_select_id(
- struct Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d, Object *obact)
+static void validate_object_select_id(struct Depsgraph *depsgraph,
+ Scene *scene,
+ ViewLayer *view_layer,
+ ARegion *ar,
+ View3D *v3d,
+ Object *obact)
{
- RegionView3D *rv3d = ar->regiondata;
- Scene *scene_eval = (Scene *)DEG_get_evaluated_id(depsgraph, &scene->id);
Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
@@ -186,19 +188,8 @@ static void validate_object_select_id(
}
if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
- uint dummy_vert_ofs, dummy_edge_ofs, dummy_face_ofs;
- DRW_framebuffer_select_id_setup(ar, true);
- DRW_draw_select_id_object(scene_eval,
- rv3d,
- obact_eval,
- scene->toolsettings->selectmode,
- false,
- 1,
- &dummy_vert_ofs,
- &dummy_edge_ofs,
- &dummy_face_ofs);
-
- DRW_framebuffer_select_id_release(ar);
+ DRW_draw_select_id_object(
+ depsgraph, view_layer, ar, v3d, obact, scene->toolsettings->selectmode);
}
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
@@ -233,7 +224,8 @@ void ED_view3d_select_id_validate(ViewContext *vc)
/* TODO: Create a flag in `DRW_manager` because the drawing is no longer
* made on the backbuffer in this case. */
if (vc->v3d->flag & V3D_INVALID_BACKBUF) {
- validate_object_select_id(vc->depsgraph, vc->scene, vc->ar, vc->v3d, vc->obact);
+ validate_object_select_id(
+ vc->depsgraph, vc->scene, vc->view_layer, vc->ar, vc->v3d, vc->obact);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 7c4b35507b9..826eddc63d1 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -219,7 +219,7 @@ static void viewops_data_alloc(bContext *C, wmOperator *op)
/* store data */
op->customdata = vod;
vod->bmain = CTX_data_main(C);
- vod->depsgraph = CTX_data_depsgraph(C);
+ vod->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
vod->scene = CTX_data_scene(C);
vod->sa = CTX_wm_area(C);
vod->ar = CTX_wm_region(C);
@@ -249,7 +249,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
static float lastofs[3] = {0, 0, 0};
bool is_set = false;
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
View3D *v3d = CTX_wm_view3d(C);
@@ -373,7 +373,7 @@ static void viewops_data_create(bContext *C,
const wmEvent *event,
enum eViewOpsFlag viewops_flag)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewOpsData *vod = op->customdata;
RegionView3D *rv3d = vod->rv3d;
@@ -1317,7 +1317,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewOpsData *vod;
View3D *v3d;
RegionView3D *rv3d;
@@ -1397,7 +1397,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_CANCELLED;
}
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewOpsData *vod;
View3D *v3d;
RegionView3D *rv3d;
@@ -1511,7 +1511,7 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *e
return OPERATOR_CANCELLED;
}
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
const wmNDOFMotionData *ndof = event->customdata;
@@ -2188,7 +2188,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int viewzoom_exec(bContext *C, wmOperator *op)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d;
RegionView3D *rv3d;
@@ -2553,7 +2553,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
ED_view3d_depth_tag_update(rv3d);
- ED_view3d_camera_lock_sync(CTX_data_depsgraph(C), v3d, rv3d);
+ ED_view3d_camera_lock_sync(CTX_data_ensure_evaluated_depsgraph(C), v3d, rv3d);
ED_region_tag_redraw(ar);
@@ -2588,7 +2588,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (vod->rv3d->persp != RV3D_PERSP) {
if (vod->rv3d->persp == RV3D_CAMOB) {
/* ignore rv3d->lpersp because dolly only makes sense in perspective mode */
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ED_view3d_persp_switch_from_camera(depsgraph, vod->v3d, vod->rv3d, RV3D_PERSP);
}
else {
@@ -2749,8 +2749,9 @@ static void view3d_from_minmax(bContext *C,
}
if (ok_dist) {
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
new_dist = ED_view3d_radius_to_dist(
- v3d, ar, CTX_data_depsgraph(C), persp, true, (size / 2) * VIEW3D_MARGIN);
+ v3d, ar, depsgraph, persp, true, (size / 2) * VIEW3D_MARGIN);
if (rv3d->is_persp) {
/* don't zoom closer than the near clipping plane */
new_dist = max_ff(new_dist, v3d->clip_start * 1.5f);
@@ -2817,7 +2818,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Base *base_eval;
const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
@@ -2922,14 +2923,14 @@ static int viewselected_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
- bGPdata *gpd = CTX_data_gpencil_data(C);
- const bool is_gp_edit = GPENCIL_ANY_MODE(gpd);
- const bool is_face_map = ((is_gp_edit == false) && ar->gizmo_map &&
- WM_gizmomap_is_any_selected(ar->gizmo_map));
Object *ob_eval = OBACT(view_layer_eval);
Object *obedit = CTX_data_edit_object(C);
+ const bGPdata *gpd_eval = ob_eval && (ob_eval->type == OB_GPENCIL) ? ob_eval->data : NULL;
+ const bool is_gp_edit = gpd_eval ? GPENCIL_ANY_MODE(gpd_eval) : false;
+ const bool is_face_map = ((is_gp_edit == false) && ar->gizmo_map &&
+ WM_gizmomap_is_any_selected(ar->gizmo_map));
float min[3], max[3];
bool ok = false, ok_dist = true;
const bool use_all_regions = RNA_boolean_get(op->ptr, "use_all_regions");
@@ -3120,7 +3121,8 @@ static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op))
if (obact && obact->type == OB_ARMATURE) {
if (obact->mode & OB_MODE_POSE) {
- Object *obact_eval = DEG_get_evaluated_object(CTX_data_depsgraph(C), obact);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+ Object *obact_eval = DEG_get_evaluated_object(depsgraph, obact);
bPoseChannel *pcham_act = BKE_pose_channel_active(obact_eval);
if (pcham_act) {
BLI_strncpy(v3d->ob_centre_bone, pcham_act->name, sizeof(v3d->ob_centre_bone));
@@ -3216,7 +3218,7 @@ static int viewcenter_pick_invoke(bContext *C, wmOperator *op, const wmEvent *ev
ARegion *ar = CTX_wm_region(C);
if (rv3d) {
- struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
float new_ofs[3];
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
@@ -3262,7 +3264,7 @@ void VIEW3D_OT_view_center_pick(wmOperatorType *ot)
static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op))
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
float xfac, yfac;
float size[2];
@@ -3361,7 +3363,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* calculate range */
if (rv3d->persp == RV3D_CAMOB) {
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ED_view3d_calc_camera_border(scene, depsgraph, ar, v3d, rv3d, &vb, false);
}
else {
@@ -3530,7 +3532,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
ED_view3d_dist_range_get(v3d, dist_range);
/* Get Z Depths, needed for perspective, nice for ortho */
- ED_view3d_draw_depth(CTX_data_depsgraph(C), ar, v3d, true);
+ ED_view3d_draw_depth(CTX_data_ensure_evaluated_depsgraph(C), ar, v3d, true);
{
/* avoid allocating the whole depth buffer */
@@ -3585,7 +3587,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
float mval_f[2];
float zfac;
- /* We cant use the depth, fallback to the old way that dosnt set the center depth */
+ /* We can't use the depth, fallback to the old way that doesn't set the center depth */
copy_v3_v3(new_ofs, rv3d->ofs);
{
@@ -3619,7 +3621,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
/* TODO(campbell): 'is_camera_lock' not currently working well. */
const bool is_camera_lock = ED_view3d_camera_lock_check(v3d, rv3d);
if ((rv3d->persp == RV3D_CAMOB) && (is_camera_lock == false)) {
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ED_view3d_persp_switch_from_camera(depsgraph, v3d, rv3d, RV3D_PERSP);
}
@@ -3686,7 +3688,7 @@ static void view3d_set_1_to_1_viewborder(Scene *scene,
static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d;
@@ -3794,7 +3796,8 @@ static void axis_set_view(bContext *C,
dist = rv3d->dist;
/* so we animate _from_ the camera location */
- Object *camera_eval = DEG_get_evaluated_object(CTX_data_depsgraph(C), v3d->camera);
+ Object *camera_eval = DEG_get_evaluated_object(CTX_data_ensure_evaluated_depsgraph(C),
+ v3d->camera);
ED_view3d_from_object(camera_eval, rv3d->ofs, NULL, &rv3d->dist, NULL);
ED_view3d_smooth_view(C,
@@ -4124,7 +4127,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
float quat_new[4];
if (view_opposite == RV3D_VIEW_USER) {
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ED_view3d_persp_ensure(depsgraph, v3d, ar);
}
@@ -4874,7 +4877,7 @@ void ED_view3d_cursor3d_position(bContext *C,
}
if (use_depth) { /* maybe this should be accessed some other way */
- struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
view3d_operator_needs_opengl(C);
if (ED_view3d_autodist(depsgraph, ar, v3d, mval, cursor_co, true, NULL)) {
@@ -4930,7 +4933,7 @@ void ED_view3d_cursor3d_position_rotation(bContext *C,
float ray_co[3];
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, scene, CTX_data_depsgraph(C), 0, ar, v3d);
+ bmain, scene, CTX_data_ensure_evaluated_depsgraph(C), 0, ar, v3d);
float obmat[4][4];
Object *ob_dummy = NULL;
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 3fa0c2c59b7..961ac4c26fb 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -270,7 +270,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->rv3d = CTX_wm_region_view3d(C);
fly->v3d = CTX_wm_view3d(C);
fly->ar = CTX_wm_region(C);
- fly->depsgraph = CTX_data_depsgraph(C);
+ fly->depsgraph = CTX_data_expect_evaluated_depsgraph(C);
fly->scene = CTX_data_scene(C);
#ifdef NDOF_FLY_DEBUG
@@ -337,12 +337,8 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
fly->zlock = FLY_AXISLOCK_STATE_IDLE;
}
- fly->v3d_camera_control = ED_view3d_cameracontrol_acquire(CTX_data_depsgraph(C),
- fly->scene,
- fly->v3d,
- fly->rv3d,
- (U.uiflag & USER_CAM_LOCK_NO_PARENT) ==
- 0);
+ fly->v3d_camera_control = ED_view3d_cameracontrol_acquire(
+ fly->depsgraph, fly->scene, fly->v3d, fly->rv3d, (U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0);
/* calculate center */
if (ED_view3d_cameracontrol_object_get(fly->v3d_camera_control)) {
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_camera.c b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
index 002a7e12515..1bb10697936 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_camera.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_camera.c
@@ -437,7 +437,8 @@ static void WIDGETGROUP_camera_view_draw_prepare(const bContext *C, wmGizmoGroup
struct CameraViewWidgetGroup *viewgroup = gzgroup->customdata;
ARegion *ar = CTX_wm_region(C);
- struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ /* Drawing code should happen with fully evaluated graph. */
+ struct Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
RegionView3D *rv3d = ar->regiondata;
if (rv3d->persp == RV3D_CAMOB) {
Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
index 64697a59019..a984e339305 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
@@ -176,7 +176,7 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
const float(*coords)[3] = NULL;
{
Object *ob = gz_ele->bases[gz_ele->base_index]->object;
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(depsgraph, ob->data);
if (me_eval->runtime.edit_data) {
coords = me_eval->runtime.edit_data->vertexCos;
@@ -334,7 +334,7 @@ static int gizmo_preselect_edgering_test_select(bContext *C, wmGizmo *gz, const
const float(*coords)[3] = NULL;
{
Object *ob = gz_ring->bases[gz_ring->base_index]->object;
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(depsgraph, ob->data);
if (me_eval->runtime.edit_data) {
coords = me_eval->runtime.edit_data->vertexCos;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index e781e129540..97a12c7100e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -289,7 +289,12 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state)
else if (state == RULER_STATE_DRAG) {
memset(&ruler_info->drag_state_prev, 0x0, sizeof(ruler_info->drag_state_prev));
ruler_info->snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, CTX_data_scene(C), CTX_data_depsgraph(C), 0, ruler_info->ar, CTX_wm_view3d(C));
+ bmain,
+ CTX_data_scene(C),
+ CTX_data_ensure_evaluated_depsgraph(C),
+ 0,
+ ruler_info->ar,
+ CTX_wm_view3d(C));
}
else {
BLI_assert(0);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 61de61c8e31..36eb07e9a2f 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -111,192 +111,6 @@
// #include "PIL_time_utildefines.h"
/* -------------------------------------------------------------------- */
-/** \name Selection Utilities
- * \{ */
-
-struct EDBaseOffset {
- /* For convenience only. */
- union {
- uint offset;
- uint face_start;
- };
- union {
- uint face;
- uint edge_start;
- };
- union {
- uint edge;
- uint vert_start;
- };
- uint vert;
-};
-
-struct EDSelectID_Context {
- struct EDBaseOffset *base_array_index_offsets;
- /** Borrow from caller (not freed). */
- struct Base **bases;
- uint bases_len;
- /** Total number of items `base_array_index_offsets[bases_len - 1].vert`. */
- uint base_array_index_len;
- /** Used to check for changes. (Use depsgraph instead?). */
- float persmat[4][4];
- short select_mode;
-};
-
-static bool check_ob_drawface_dot(short select_mode, const View3D *v3d, char dt)
-{
- if (select_mode & SCE_SELECT_FACE) {
- if ((dt < OB_SOLID) || XRAY_FLAG_ENABLED(v3d)) {
- return true;
- }
- if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) {
- return true;
- }
- if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGES) == 0) {
- /* Since we can't deduce face selection when edges aren't visible - show dots. */
- return true;
- }
- }
- return false;
-}
-
-static void ed_select_id_draw_bases(struct EDSelectID_Context *sel_id_ctx,
- ViewContext *vc,
- short select_mode)
-{
- Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id);
- DRW_framebuffer_select_id_setup(vc->ar, true);
-
- uint offset = 1;
- for (uint base_index = 0; base_index < sel_id_ctx->bases_len; base_index++) {
- Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph,
- sel_id_ctx->bases[base_index]->object);
-
- struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- bool draw_facedot = check_ob_drawface_dot(select_mode, vc->v3d, ob_eval->dt);
-
- DRW_draw_select_id_object(scene_eval,
- vc->rv3d,
- ob_eval,
- select_mode,
- draw_facedot,
- offset,
- &base_ofs->vert,
- &base_ofs->edge,
- &base_ofs->face);
-
- base_ofs->offset = offset;
- offset = base_ofs->vert;
- }
-
- sel_id_ctx->base_array_index_len = offset;
-
- DRW_framebuffer_select_id_release(vc->ar);
-}
-
-void ED_view3d_select_id_validate_view_matrices(struct EDSelectID_Context *sel_id_ctx,
- ViewContext *vc)
-{
- if (!compare_m4m4(sel_id_ctx->persmat, vc->rv3d->persmat, FLT_EPSILON)) {
- ed_select_id_draw_bases(sel_id_ctx, vc, sel_id_ctx->select_mode);
- }
-}
-
-uint ED_view3d_select_id_context_offset_for_object_elem(
- const struct EDSelectID_Context *sel_id_ctx, int base_index, char elem_type)
-{
- struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- if (elem_type == SCE_SELECT_VERTEX) {
- return base_ofs->vert_start - 1;
- }
- if (elem_type == SCE_SELECT_EDGE) {
- return base_ofs->edge_start - 1;
- }
- if (elem_type == SCE_SELECT_FACE) {
- return base_ofs->face_start - 1;
- }
- BLI_assert(0);
- return 0;
-}
-
-uint ED_view3d_select_id_context_elem_len(const struct EDSelectID_Context *sel_id_ctx)
-{
- return sel_id_ctx->base_array_index_len;
-}
-
-struct EDSelectID_Context *ED_view3d_select_id_context_create(ViewContext *vc,
- Base **bases,
- const uint bases_len,
- short select_mode)
-{
- struct EDSelectID_Context *sel_id_ctx = MEM_mallocN(sizeof(*sel_id_ctx), __func__);
- sel_id_ctx->base_array_index_offsets = MEM_mallocN(sizeof(struct EDBaseOffset) * bases_len,
- __func__);
- sel_id_ctx->bases = bases;
- sel_id_ctx->bases_len = bases_len;
- copy_m4_m4(sel_id_ctx->persmat, vc->rv3d->persmat);
- sel_id_ctx->select_mode = select_mode;
- ed_select_id_draw_bases(sel_id_ctx, vc, select_mode);
-
- return sel_id_ctx;
-}
-
-void ED_view3d_select_id_context_destroy(struct EDSelectID_Context *sel_id_ctx)
-{
- MEM_freeN(sel_id_ctx->base_array_index_offsets);
- MEM_freeN(sel_id_ctx);
-}
-
-bool ED_view3d_select_id_elem_get(struct EDSelectID_Context *sel_id_ctx,
- const uint sel_id,
- uint *r_elem,
- uint *r_base_index,
- char *r_elem_type)
-{
- char elem_type = 0;
- uint elem_id;
- uint base_index = 0;
-
- while (true) {
- struct EDBaseOffset *base_ofs = &sel_id_ctx->base_array_index_offsets[base_index];
- if (base_ofs->face > sel_id) {
- elem_id = sel_id - base_ofs->face_start;
- elem_type = SCE_SELECT_FACE;
- break;
- }
- if (base_ofs->edge > sel_id) {
- elem_id = sel_id - base_ofs->edge_start;
- elem_type = SCE_SELECT_EDGE;
- break;
- }
- if (base_ofs->vert > sel_id) {
- elem_id = sel_id - base_ofs->vert_start;
- elem_type = SCE_SELECT_VERTEX;
- break;
- }
-
- base_index++;
- if (base_index >= sel_id_ctx->bases_len) {
- return false;
- }
- }
-
- *r_elem = elem_id;
-
- if (r_base_index) {
- *r_base_index = base_index;
- }
-
- if (r_elem_type) {
- *r_elem_type = elem_type;
- }
-
- return true;
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name Public Utilities
* \{ */
@@ -312,7 +126,7 @@ void ED_view3d_viewcontext_init(bContext *C, ViewContext *vc)
vc->C = C;
vc->ar = CTX_wm_region(C);
vc->bmain = CTX_data_main(C);
- vc->depsgraph = CTX_data_depsgraph(C);
+ vc->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
vc->scene = CTX_data_scene(C);
vc->view_layer = CTX_data_view_layer(C);
vc->v3d = CTX_wm_view3d(C);
@@ -385,7 +199,6 @@ static bool object_deselect_all_except(ViewLayer *view_layer, Base *b)
struct EditSelectBuf_Cache {
Base **bases;
uint bases_len;
- struct EDSelectID_Context *sel_id_ctx;
BLI_bitmap *select_bitmap;
};
@@ -407,8 +220,12 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont
esel->bases_len = 0;
}
}
- esel->sel_id_ctx = ED_view3d_select_id_context_create(
- vc, esel->bases, esel->bases_len, vc->scene->toolsettings->selectmode);
+ DRW_draw_select_id(vc->depsgraph,
+ vc->ar,
+ vc->v3d,
+ esel->bases,
+ esel->bases_len,
+ vc->scene->toolsettings->selectmode);
for (int i = 0; i < esel->bases_len; i++) {
esel->bases[i]->object->runtime.select_id = i;
}
@@ -416,9 +233,6 @@ static void editselect_buf_cache_init(struct EditSelectBuf_Cache *esel, ViewCont
static void editselect_buf_cache_free(struct EditSelectBuf_Cache *esel)
{
- if (esel->sel_id_ctx) {
- ED_view3d_select_id_context_destroy(esel->sel_id_ctx);
- }
MEM_SAFE_FREE(esel->select_bitmap);
MEM_SAFE_FREE(esel->bases);
}
@@ -455,8 +269,7 @@ static bool edbm_backbuf_check_and_select_verts(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = ED_view3d_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_VERTEX);
+ uint index = DRW_select_context_offset_for_object_elem(ob->runtime.select_id, SCE_SELECT_VERTEX);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
@@ -483,8 +296,7 @@ static bool edbm_backbuf_check_and_select_edges(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = ED_view3d_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_EDGE);
+ uint index = DRW_select_context_offset_for_object_elem(ob->runtime.select_id, SCE_SELECT_EDGE);
BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
@@ -511,8 +323,7 @@ static bool edbm_backbuf_check_and_select_faces(struct EditSelectBuf_Cache *esel
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- uint index = ED_view3d_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx, ob->runtime.select_id, SCE_SELECT_FACE);
+ uint index = DRW_select_context_offset_for_object_elem(ob->runtime.select_id, SCE_SELECT_FACE);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
@@ -1017,7 +828,7 @@ static bool do_lasso_select_mesh(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
}
@@ -1036,10 +847,8 @@ static bool do_lasso_select_mesh(ViewContext *vc,
struct LassoSelectUserData_ForMeshEdge data_for_edge = {
.data = &data,
.esel = use_zbuf ? esel : NULL,
- .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx,
- vc->obedit->runtime.select_id,
- SCE_SELECT_EDGE) :
+ .backbuf_offset = use_zbuf ? DRW_select_context_offset_for_object_elem(
+ vc->obedit->runtime.select_id, SCE_SELECT_EDGE) :
0,
};
mesh_foreachScreenEdge(
@@ -1327,7 +1136,7 @@ static bool do_lasso_select_paintvert(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
}
@@ -1386,7 +1195,7 @@ static bool do_lasso_select_paintface(ViewContext *vc,
if (esel == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_poly(buffer_len, mcords, moves, &rect);
}
@@ -2742,7 +2551,7 @@ static bool do_paintvert_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
if (esel->select_bitmap != NULL) {
@@ -2797,7 +2606,7 @@ static bool do_paintface_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
if (esel->select_bitmap != NULL) {
@@ -2995,7 +2804,7 @@ static bool do_mesh_box_select(ViewContext *vc,
if (wm_userdata->data == NULL) {
editselect_buf_cache_init_with_generic_userdata(wm_userdata, vc);
esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_rect(buffer_len, rect);
}
}
@@ -3014,10 +2823,8 @@ static bool do_mesh_box_select(ViewContext *vc,
struct BoxSelectUserData_ForMeshEdge cb_data = {
.data = &data,
.esel = use_zbuf ? esel : NULL,
- .backbuf_offset = use_zbuf ? ED_view3d_select_id_context_offset_for_object_elem(
- esel->sel_id_ctx,
- vc->obedit->runtime.select_id,
- SCE_SELECT_EDGE) :
+ .backbuf_offset = use_zbuf ? DRW_select_context_offset_for_object_elem(
+ vc->obedit->runtime.select_id, SCE_SELECT_EDGE) :
0,
};
mesh_foreachScreenEdge(
@@ -3582,8 +3389,7 @@ static bool mesh_circle_select(ViewContext *vc,
struct EditSelectBuf_Cache *esel = wm_userdata->data;
if (use_zbuf) {
- ED_view3d_select_id_validate_view_matrices(esel->sel_id_ctx, vc);
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
}
@@ -3660,7 +3466,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
{
struct EditSelectBuf_Cache *esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op);
@@ -3715,7 +3521,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
if (use_zbuf) {
struct EditSelectBuf_Cache *esel = wm_userdata->data;
- const uint buffer_len = ED_view3d_select_id_context_elem_len(esel->sel_id_ctx);
+ const uint buffer_len = DRW_select_context_elem_len();
esel->select_bitmap = ED_select_buffer_bitmap_from_circle(buffer_len, mval, (int)(rad + 1.0f));
if (esel->select_bitmap != NULL) {
changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op);
@@ -4150,7 +3956,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
const int radius = RNA_int_get(op->ptr, "radius");
const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")};
- /* Allow each selection type to allocate their own data thats used between executions. */
+ /* Allow each selection type to allocate their own data that's used between executions. */
wmGesture *gesture = op->customdata; /* NULL when non-modal. */
wmGenericUserData wm_userdata_buf = {0};
wmGenericUserData *wm_userdata = gesture ? &gesture->user_data : &wm_userdata_buf;
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 0103fd0df53..9a2f4062631 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -66,7 +66,7 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r
/** Snaps every individual object center to its nearest point on the grid. */
static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
@@ -226,7 +226,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
ot->poll = ED_operator_region_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *************************************************** */
@@ -243,7 +243,6 @@ static int snap_selected_to_location(bContext *C,
const float snap_target_global[3],
const bool use_offset)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
@@ -431,6 +430,7 @@ static int snap_selected_to_location(bContext *C,
float originmat[3][3], parentmat[4][4];
/* Use the evaluated object here because sometimes
* `ob->parent->runtime.curve_cache` is required. */
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
BKE_object_get_parent_matrix(ob_eval, ob_eval->parent, parentmat);
@@ -486,7 +486,7 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* rna */
RNA_def_boolean(ot->srna,
@@ -523,7 +523,7 @@ void VIEW3D_OT_snap_selected_to_active(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* *************************************************** */
@@ -626,7 +626,7 @@ static void bundle_midpoint(Scene *scene, Object *ob, float r_vec[3])
/** Snaps the 3D cursor location to the median point of the selection. */
static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
@@ -757,7 +757,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************************************** */
@@ -804,7 +804,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
ot->poll = ED_operator_view3d_active;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* **************************************************** */
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c0902cd1cd5..2515ee6e482 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -304,7 +304,7 @@ void ED_view3d_smooth_view(bContext *C,
const int smooth_viewtx,
const struct V3D_SmoothParams *sview)
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
@@ -315,7 +315,6 @@ void ED_view3d_smooth_view(bContext *C,
/* only meant for timer usage */
static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool sync_boxview)
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
RegionView3D *rv3d = ar->regiondata;
struct SmoothView3DStore *sms = rv3d->sms;
float step, step_inv;
@@ -336,6 +335,8 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
view3d_smooth_view_state_restore(&sms->org, v3d, rv3d);
}
else {
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+
view3d_smooth_view_state_restore(&sms->dst, v3d, rv3d);
ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
@@ -372,6 +373,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
rv3d->dist = sms->dst.dist * step + sms->src.dist * step_inv;
v3d->lens = sms->dst.lens * step + sms->src.lens * step_inv;
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d);
if (ED_screen_animation_playing(CTX_wm_manager(C))) {
ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true);
@@ -428,7 +430,7 @@ void ED_view3d_smooth_view_force_finish(bContext *C, View3D *v3d, ARegion *ar)
/* force update of view matrix so tools that run immediately after
* can use them without redrawing first */
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL, false);
}
@@ -457,7 +459,7 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
View3D *v3d;
ARegion *ar;
RegionView3D *rv3d;
@@ -527,7 +529,7 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
* meant to take into account vertex/bone selection for eg. */
static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C); /* can be NULL */
Object *camera_ob = v3d ? v3d->camera : scene->camera;
@@ -1413,7 +1415,7 @@ static void view3d_localview_exit(const Depsgraph *depsgraph,
static int localview_exec(bContext *C, wmOperator *op)
{
- const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win = CTX_wm_window(C);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 853955a4078..c5585857b55 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -426,7 +426,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->rv3d = CTX_wm_region_view3d(C);
walk->v3d = CTX_wm_view3d(C);
walk->ar = CTX_wm_region(C);
- walk->depsgraph = CTX_data_depsgraph(C);
+ walk->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
walk->scene = CTX_data_scene(C);
#ifdef NDOF_WALK_DEBUG
@@ -520,7 +520,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
walk->rv3d->rflag |= RV3D_NAVIGATING;
walk->snap_context = ED_transform_snap_object_context_create_view3d(
- bmain, walk->scene, CTX_data_depsgraph(C), 0, walk->ar, walk->v3d);
+ bmain, walk->scene, CTX_data_ensure_evaluated_depsgraph(C), 0, walk->ar, walk->v3d);
walk->v3d_camera_control = ED_view3d_cameracontrol_acquire(
walk->depsgraph,