From af28dcfb7d380350185c014e070bb7aa045126cb Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 6 Aug 2024 13:25:22 +0200 Subject: [PATCH] Revert "Fix #124125: Depsgraph and scene time out of sync" This reverts commit 780dc67f6d827213d84514398504f0e3ad705c77. The patch caused a performance regression when inserting many keys via python, as is done with the "Whole Character" keying set. Regression report: #125888 --- source/blender/editors/animation/keyframing.cc | 11 ++--------- source/blender/editors/animation/keyingsets.cc | 9 +++------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/source/blender/editors/animation/keyframing.cc b/source/blender/editors/animation/keyframing.cc index f7eecf0a322..1109c2784f5 100644 --- a/source/blender/editors/animation/keyframing.cc +++ b/source/blender/editors/animation/keyframing.cc @@ -38,7 +38,6 @@ #include "BKE_scene.hh" #include "DEG_depsgraph.hh" -#include "DEG_depsgraph_query.hh" #include "ED_anim_api.hh" #include "ED_keyframing.hh" @@ -377,9 +376,6 @@ static int insert_key(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* The depsgraph needs to be in an evaluated state to ensure the values we get from the - * properties are actually the values of the current frame. */ - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); const float scene_frame = BKE_scene_frame_get(scene); @@ -387,6 +383,7 @@ static int insert_key(bContext *C, wmOperator *op) const eInsertKeyFlags insert_key_flags = animrig::get_keyframing_flags(scene); const eBezTriple_KeyframeType key_type = eBezTriple_KeyframeType( scene->toolsettings->keyframe_type); + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( depsgraph, BKE_scene_frame_get(scene)); @@ -994,12 +991,8 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) PointerRNA ptr = {nullptr}; PropertyRNA *prop = nullptr; uiBut *but; - - /* The depsgraph needs to be in an evaluated state to ensure the values we get from the - * properties are actually the values of the current frame. */ - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( - depsgraph, BKE_scene_frame_get(scene)); + CTX_data_depsgraph_pointer(C), BKE_scene_frame_get(scene)); bool changed = false; int index; const bool all = RNA_boolean_get(op->ptr, "all"); diff --git a/source/blender/editors/animation/keyingsets.cc b/source/blender/editors/animation/keyingsets.cc index ea74e0a937a..bda6db93af0 100644 --- a/source/blender/editors/animation/keyingsets.cc +++ b/source/blender/editors/animation/keyingsets.cc @@ -1072,16 +1072,13 @@ static int insert_key_to_keying_set_path(bContext *C, Scene *scene = CTX_data_scene(C); const eBezTriple_KeyframeType keytype = eBezTriple_KeyframeType( scene->toolsettings->keyframe_type); - /* The depsgraph needs to be in an evaluated state to ensure the values we get from the - * properties are actually the values of the current frame. */ - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - + /* For each possible index, perform operation + * - Assume that array-length is greater than index. */ + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(depsgraph, frame); int keyed_channels = 0; - /* For each possible index, perform operation - * - Assume that array-length is greater than index. */ CombinedKeyingResult combined_result; for (; array_index < array_length; array_index++) { if (mode == ModifyKeyMode::INSERT) {