Revert "Fix #124125: Depsgraph and scene time out of sync"

This reverts commit 780dc67f6d.
The patch caused a performance regression when inserting many
keys via python, as is done with the "Whole Character"
keying set.
Regression report: #125888
This commit is contained in:
Christoph Lendenfeld
2024-08-06 13:25:22 +02:00
parent ca199ba13f
commit af28dcfb7d
2 changed files with 5 additions and 15 deletions

View File

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

View File

@@ -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) {