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:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-07-25 17:36:22 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-07-31 17:55:15 +0300
commit3566b81c8bfa8c69d542a5de29ecb8d5af3ccb3d (patch)
tree8c549ae6f2b1064399a7c0b99ab6ce9b287bdd28 /source/blender/editors/object
parentf5f3003874f26681000618032d88482367348064 (diff)
Refactor access to dependency graph
This change ensures that operators which needs access to evaluated data first makes sure there is a dependency graph. Other accesses to the dependency graph made it more explicit about whether they just need a valid dependency graph pointer or whether they expect the graph to be already evaluated. This replaces OPTYPE_USE_EVAL_DATA which is now removed. Some general rules about usage of accessors: - Drawing is expected to happen from a fully evaluated dependency graph. There is now a function to access it, which will in the future control that dependency graph is actually evaluated. This check is not yet done because there are some things to be taken care about first: for example, post-update hooks might leave scene in a state where something is still tagged for update. - All operators which needs to access evaluated state must use CTX_data_ensure_evaluated_depsgraph(). This function replaces OPTYPE_USE_EVAL_DATA. The call is generally to be done in the very beginning of the operator, prior other logic (unless this is some comprehensive operator which might or might not need access to an evaluated state). This call is never to be used from a loop. If some utility function requires evaluated state of dependency graph the graph is to be passed as an explicit argument. This way it is clear that no evaluation happens in a loop or something like this. - All cases which needs to know dependency graph pointer, but which doesn't want to actually evaluate it can use old-style function CTX_data_depsgraph_pointer(), assuming that underlying code will ensure dependency graph is evaluated prior to accessing it. - The new functions are replacing OPTYPE_USE_EVAL_DATA, so now it is explicit and local about where dependency graph is being ensured. This commit also contains some fixes of wrong usage of evaluation functions on original objects. Ideally should be split out, but in reality with all the APIs being renamed is quite tricky. Fixes T67454: Blender crash on rapid undo and select Speculation here is that sometimes undo and selection operators are sometimes handled in the same event loop iteration, which leaves non-evaluated dependency graph. Fixes T67973: Crash on Fix Deforms operator Fixes T67902: Crash when undo a loop cut Reviewers: brecht Reviewed By: brecht Subscribers: lichtwerk Maniphest Tasks: T67454 Differential Revision: https://developer.blender.org/D5343
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_add.c24
-rw-r--r--source/blender/editors/object/object_constraint.c16
-rw-r--r--source/blender/editors/object/object_data_transfer.c12
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/editors/object/object_gpencil_modifier.c2
-rw-r--r--source/blender/editors/object/object_hook.c13
-rw-r--r--source/blender/editors/object/object_modes.c8
-rw-r--r--source/blender/editors/object/object_modifier.c16
-rw-r--r--source/blender/editors/object/object_relations.c4
-rw-r--r--source/blender/editors/object/object_transform.c6
-rw-r--r--source/blender/editors/object/object_vgroup.c2
11 files changed, 55 insertions, 52 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index f8cf55933aa..137af917f9a 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -236,7 +236,7 @@ void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3],
{
Object *ob = base->object;
Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
if (!scene) {
return;
@@ -250,7 +250,11 @@ void ED_object_base_init_transform(bContext *C, Base *base, const float loc[3],
copy_v3_v3(ob->rot, rot);
}
- BKE_object_where_is_calc(depsgraph, scene, ob);
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ BKE_object_transform_copy(object_eval, ob);
+ BKE_object_where_is_calc(depsgraph, scene_eval, object_eval);
+ BKE_object_transform_copy(ob, object_eval);
}
/* Uses context to figure out transform for primitive.
@@ -1758,12 +1762,15 @@ static bool dupliobject_instancer_cmp(const void *a_, const void *b_)
return false;
}
-static void make_object_duplilist_real(
- bContext *C, Scene *scene, Base *base, const bool use_base_parent, const bool use_hierarchy)
+static void make_object_duplilist_real(bContext *C,
+ Depsgraph *depsgraph,
+ Scene *scene,
+ Base *base,
+ const bool use_base_parent,
+ const bool use_hierarchy)
{
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
ListBase *lb_duplis;
DupliObject *dob;
GHash *dupli_gh, *parent_gh = NULL, *instancer_gh = NULL;
@@ -1955,6 +1962,7 @@ static void make_object_duplilist_real(
static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
const bool use_base_parent = RNA_boolean_get(op->ptr, "use_base_parent");
@@ -1963,7 +1971,7 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
BKE_main_id_clear_newpoins(bmain);
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) {
- make_object_duplilist_real(C, scene, base, use_base_parent, use_hierarchy);
+ make_object_duplilist_real(C, depsgraph, scene, base, use_base_parent, use_hierarchy);
/* dependencies were changed */
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, base->object);
@@ -1990,7 +1998,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
ot->poll = ED_operator_objectmode;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna,
"use_base_parent",
@@ -2131,7 +2139,7 @@ static Base *duplibase_for_convert(
static int convert_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *basen = NULL, *basact = NULL;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 5ef133e87de..7343dba420f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -864,13 +864,12 @@ void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
/* ------------- Child-Of Constraint ------------------ */
static void child_get_inverse_matrix_owner_bone(
- const bContext *C, wmOperator *op, Scene *scene, Object *ob, float invmat[4][4])
+ Depsgraph *depsgraph, wmOperator *op, Scene *scene, Object *ob, float invmat[4][4])
{
/* For bone owner we want to do this in evaluated domain.
* BKE_pose_where_is / BKE_pose_where_is_bone relies on (re)evaluating parts of the scene
* and copying new evaluated stuff back to original.
*/
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
bConstraint *con_eval = edit_constraint_property_get(op, ob_eval, CONSTRAINT_TYPE_CHILDOF);
@@ -947,9 +946,8 @@ static void child_get_inverse_matrix_owner_bone(
}
static void child_get_inverse_matrix_owner_object(
- const bContext *C, Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
+ Depsgraph *depsgraph, Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
/* nullify inverse matrix first */
unit_m4(invmat);
@@ -971,6 +969,7 @@ static void child_get_inverse_matrix_owner_object(
static int childof_set_inverse_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
@@ -985,10 +984,10 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
}
if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
- child_get_inverse_matrix_owner_object(C, scene, ob, con, data->invmat);
+ child_get_inverse_matrix_owner_object(depsgraph, scene, ob, con, data->invmat);
}
else if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
- child_get_inverse_matrix_owner_bone(C, op, scene, ob, data->invmat);
+ child_get_inverse_matrix_owner_bone(depsgraph, op, scene, ob, data->invmat);
}
ED_object_constraint_update(bmain, ob);
@@ -1224,6 +1223,7 @@ void CONSTRAINT_OT_followpath_path_animate(wmOperatorType *ot)
static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
@@ -1238,10 +1238,10 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
}
if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
- child_get_inverse_matrix_owner_object(C, scene, ob, con, data->invmat);
+ child_get_inverse_matrix_owner_object(depsgraph, scene, ob, con, data->invmat);
}
else if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
- child_get_inverse_matrix_owner_bone(C, op, scene, ob, data->invmat);
+ child_get_inverse_matrix_owner_bone(depsgraph, op, scene, ob, data->invmat);
}
ED_object_constraint_update(bmain, ob);
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 465a60ba75c..79aafc6978f 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -111,8 +111,6 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C,
int totitem = 0;
const int data_type = RNA_enum_get(ptr, "data_type");
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
-
PropertyRNA *prop = RNA_struct_find_property(ptr, "use_reverse_transfer");
const bool reverse_transfer = prop != NULL && RNA_property_boolean_get(ptr, prop);
const int layers_select_dst = reverse_transfer ? RNA_enum_get(ptr, "layers_select_src") :
@@ -158,6 +156,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C,
Mesh *me_eval;
int num_data, i;
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
@@ -183,6 +182,7 @@ static const EnumPropertyItem *dt_layers_select_src_itemf(bContext *C,
Mesh *me_eval;
int num_data, i;
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
@@ -397,7 +397,7 @@ static bool data_transfer_exec_is_object_valid(wmOperator *op,
static int data_transfer_exec(bContext *C, wmOperator *op)
{
Object *ob_src = ED_object_active_context(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
ListBase ctx_objects;
@@ -613,7 +613,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot)
ot->check = data_transfer_check;
/* Flags.*/
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* Properties.*/
prop = RNA_def_boolean(ot->srna,
@@ -767,7 +767,7 @@ static bool datalayout_transfer_poll(bContext *C)
static int datalayout_transfer_exec(bContext *C, wmOperator *op)
{
Object *ob_act = ED_object_active_context(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
DataTransferModifierData *dtmd;
@@ -873,7 +873,7 @@ void OBJECT_OT_datalayout_transfer(wmOperatorType *ot)
ot->check = data_transfer_check;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* Properties.*/
edit_modifier_properties(ot);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index a390cf67cf5..36a08d15913 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -906,7 +906,9 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene, bool current_frame_
}
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some
+ * nested pointers, like animation data. */
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ListBase targets = {NULL, NULL};
/* loop over objects in scene */
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c
index 5c4fa5aeee6..075cd5acad6 100644
--- a/source/blender/editors/object/object_gpencil_modifier.c
+++ b/source/blender/editors/object/object_gpencil_modifier.c
@@ -596,7 +596,7 @@ void OBJECT_OT_gpencil_modifier_move_down(wmOperatorType *ot)
static int gpencil_modifier_apply_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *ob = ED_object_active_context(C);
GpencilModifierData *md = gpencil_edit_modifier_property_get(op, ob, 0);
int apply_as = RNA_enum_get(op->ptr, "apply_as");
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 707489d588a..15c5ea40991 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -528,7 +528,7 @@ static int add_hook_object(const bContext *C,
int mode,
ReportList *reports)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ModifierData *md = NULL;
HookModifierData *hmd = NULL;
float cent[3];
@@ -603,13 +603,14 @@ static int add_hook_object(const bContext *C,
/* matrix calculus */
/* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
/* (parentinv ) */
- Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- BKE_object_transform_copy(ob_eval, ob);
- BKE_object_where_is_calc(depsgraph, scene, ob_eval);
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
+ BKE_object_transform_copy(object_eval, ob);
+ BKE_object_where_is_calc(depsgraph, scene_eval, object_eval);
- invert_m4_m4(ob_eval->imat, ob_eval->obmat);
+ invert_m4_m4(object_eval->imat, object_eval->obmat);
/* apparently this call goes from right to left... */
- mul_m4_series(hmd->parentinv, pose_mat, ob_eval->imat, obedit->obmat);
+ mul_m4_series(hmd->parentinv, pose_mat, object_eval->imat, obedit->obmat);
DEG_relations_tag_update(bmain);
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 23d1a293850..271d8effd30 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -171,14 +171,6 @@ void ED_object_mode_toggle(bContext *C, eObjectMode mode)
if (opstring) {
wmOperatorType *ot = WM_operatortype_find(opstring, false);
- if (ot->flag & OPTYPE_USE_EVAL_DATA) {
- /* We need to force refresh of depsgraph after undo step,
- * redoing the operator *may* rely on some valid evaluated data. */
- struct Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer);
- }
WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_REGION_WIN, NULL);
}
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 8bc68ea753c..8818fd71190 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1130,7 +1130,7 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
static int modifier_apply_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
@@ -1194,7 +1194,7 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
static int modifier_convert_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = ED_object_active_context(C);
@@ -1391,7 +1391,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
static int multires_reshape_exec(bContext *C, wmOperator *op)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *ob = ED_object_active_context(C), *secondob = NULL;
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(
op, ob, eModifierType_Multires);
@@ -1934,7 +1934,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph,
static int skin_armature_create_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C), *arm_ob;
Mesh *me = ob->data;
@@ -1999,7 +1999,7 @@ static bool correctivesmooth_poll(bContext *C)
static int correctivesmooth_bind_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);
Object *ob = ED_object_active_context(C);
CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)edit_modifier_property_get(
@@ -2077,7 +2077,7 @@ static bool meshdeform_poll(bContext *C)
static int meshdeform_bind_exec(bContext *C, wmOperator *op)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *ob = ED_object_active_context(C);
MeshDeformModifierData *mmd = (MeshDeformModifierData *)edit_modifier_property_get(
op, ob, eModifierType_MeshDeform);
@@ -2403,7 +2403,7 @@ static bool laplaciandeform_poll(bContext *C)
static int laplaciandeform_bind_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)edit_modifier_property_get(
op, ob, eModifierType_LaplacianDeform);
@@ -2478,7 +2478,7 @@ static bool surfacedeform_bind_poll(bContext *C)
static int surfacedeform_bind_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)edit_modifier_property_get(
op, ob, eModifierType_SurfaceDeform);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index ff31cbc4590..d486321b68a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -124,7 +124,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
BMVert *eve;
@@ -677,7 +677,7 @@ bool ED_object_parent_set(ReportList *reports,
const int vert_par[3])
{
Main *bmain = CTX_data_main(C);
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
bPoseChannel *pchan = NULL;
bPoseChannel *pchan_eval = NULL;
const bool pararm = ELEM(
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 3f7d5dba149..5934eab62bb 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -547,7 +547,7 @@ static int apply_objects_internal(bContext *C,
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
float rsmat[3][3], obmat[3][3], iobmat[3][3], mat[4][4], scale;
bool changed = true;
@@ -881,7 +881,7 @@ static int apply_objects_internal(bContext *C,
static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
- Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
bool changed = false;
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) {
@@ -976,7 +976,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
Object *obedit = CTX_data_edit_object(C);
- Depsgraph *depsgraph = CTX_data_evaluated_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Object *tob;
float cent[3], cent_neg[3], centn[3];
const float *cursor = scene->cursor.location;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 4f61443ac54..a43ac59c9b8 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -1514,7 +1514,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
static void vgroup_fix(
const bContext *C, Scene *UNUSED(scene), Object *ob, float distToBe, float strength, float cp)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
int i;