Fix #136596: Keying slotless NLA strip does not update the strip's slot

It is possible to un-assign the action slot from an NLA strip. If then
you enter tweak mode on it and insert keys, a new slot is created on the
Action (so far so good). However, exiting tweak mode did not assign that
slot to the NLA strip, deactivating the animation. This is now solved.

The slot assignment is done when exiting tweak mode because that's
when the whole "sync from assigned Action back to the NLA strip"
happens. Also things like syncing the strip length is done at
tweak-exit, so that seemed like the right place to me to do this too.

Pull Request: https://projects.blender.org/blender/blender/pulls/136601
This commit is contained in:
Sybren A. Stüvel
2025-03-27 12:30:09 +01:00
parent 307147c99c
commit 6d3c621958

View File

@@ -2500,6 +2500,18 @@ void BKE_nla_tweakmode_exit(const OwnedAnimData owned_adt)
}
if (owned_adt.adt.action) {
/* When a strip has no slot assigned, it can still enter tweak mode. Inserting a key will then
* create a slot. When exiting tweak mode, this slot has to be assigned to the strip.
* At this moment in time, the adt->action is still the one being tweaked. */
NlaStrip *active_strip = owned_adt.adt.actstrip;
if (active_strip && active_strip->action_slot_handle != owned_adt.adt.slot_handle) {
const animrig::ActionSlotAssignmentResult result = animrig::nla::assign_action_slot_handle(
*active_strip, owned_adt.adt.slot_handle, owned_adt.owner_id);
BLI_assert_msg(result == animrig::ActionSlotAssignmentResult::OK,
"When exiting tweak mode, syncing the tweaked Action slot should work");
UNUSED_VARS_NDEBUG(result);
}
/* The Action will be replaced with adt->tmpact, and thus needs to be unassigned first. */
/* The high-level function animrig::unassign_action() will check whether NLA tweak mode is