Fix: key insertion sometimes treats layered actions as legacy actions
When the Baklava experimental flag was disabled, attempting to insert a key on a layered action would erroneously use the legacy action key insertion code path. This was simply due to the condition for which code path to use being incorrect. This commit fixes that condition. Pull Request: https://projects.blender.org/blender/blender/pulls/125055
This commit is contained in:
committed by
Nathan Vegdahl
parent
3e12a6d622
commit
9f944fe53c
@@ -992,14 +992,17 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
return combined_result;
|
||||
}
|
||||
|
||||
bAction *action = id_action_ensure(bmain, id);
|
||||
BLI_assert(action != nullptr);
|
||||
bAction *dna_action = id_action_ensure(bmain, id);
|
||||
BLI_assert(dna_action != nullptr);
|
||||
|
||||
if (USER_EXPERIMENTAL_TEST(&U, use_animation_baklava) && action->wrap().is_action_layered()) {
|
||||
Action &action = dna_action->wrap();
|
||||
if (!action.is_action_legacy() ||
|
||||
(action.is_empty() && USER_EXPERIMENTAL_TEST(&U, use_animation_baklava)))
|
||||
{
|
||||
KeyframeSettings key_settings = get_keyframe_settings(
|
||||
(insert_key_flags & INSERTKEY_NO_USERPREF) == 0);
|
||||
key_settings.keyframe_type = key_type;
|
||||
return insert_key_layered_action(action->wrap(),
|
||||
return insert_key_layered_action(action,
|
||||
struct_pointer,
|
||||
rna_paths,
|
||||
scene_frame.value_or(anim_eval_context.eval_time),
|
||||
@@ -1014,7 +1017,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
&anim_eval_context,
|
||||
&id_pointer,
|
||||
adt,
|
||||
action,
|
||||
dna_action,
|
||||
&nla_cache,
|
||||
&nla_context);
|
||||
const bool visual_keyframing = insert_key_flags & INSERTKEY_MATRIX;
|
||||
@@ -1065,7 +1068,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
/* Determine if at least one element would succeed getting keyed. */
|
||||
bool at_least_one_would_succeed = false;
|
||||
for (int i = 0; i < rna_values.size(); i++) {
|
||||
const FCurve *fcu = action_fcurve_find(action, {*rna_path_id_to_prop, i});
|
||||
const FCurve *fcu = action_fcurve_find(dna_action, {*rna_path_id_to_prop, i});
|
||||
if (!fcu) {
|
||||
continue;
|
||||
}
|
||||
@@ -1095,7 +1098,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
}
|
||||
|
||||
const CombinedKeyingResult result = insert_key_legacy_action(bmain,
|
||||
action,
|
||||
dna_action,
|
||||
struct_pointer,
|
||||
prop,
|
||||
channel_group,
|
||||
@@ -1111,14 +1114,14 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
|
||||
BKE_animsys_free_nla_keyframing_context_cache(&nla_cache);
|
||||
|
||||
if (combined_result.get_count(SingleKeyingResult::SUCCESS) > 0) {
|
||||
DEG_id_tag_update(&action->id, ID_RECALC_ANIMATION_NO_FLUSH);
|
||||
DEG_id_tag_update(&dna_action->id, ID_RECALC_ANIMATION_NO_FLUSH);
|
||||
|
||||
/* TODO: it's not entirely clear why the action we got wouldn't be the same
|
||||
* as the action in AnimData. Further, it's not clear why it would need to
|
||||
* be tagged for a depsgraph update regardless. This code is here because it
|
||||
* was part of the function this one was refactored from, but at some point
|
||||
* this should be investigated and either documented or removed. */
|
||||
if (!ELEM(adt->action, nullptr, action)) {
|
||||
if (!ELEM(adt->action, nullptr, dna_action)) {
|
||||
DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION_NO_FLUSH);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user