Fix #137779: Assigning Action without slot can crash the Dope Sheet

Normally, the dope sheet will not show the directly-assigned Action,
when that Action has no animation data for the data-block.

However, when that data-block uses the NLA, and one or more NLA strips
have an animated property (like their influence), the Action is shown in
the dope sheet for some reason.

This caused the "draw the summary line for this Action" to fail, because
it assumes there must be a slot (because normally when it's drawn, it
implies there is animation data, and thus a slot).

This assumption has been fixed, and the "no slot" case is now handled
properly.

Pull Request: https://projects.blender.org/blender/blender/pulls/137844
This commit is contained in:
Sybren A. Stüvel
2025-04-22 16:47:14 +02:00
committed by Thomas Dinges
parent 2ca87bcf5b
commit 24b0c43eba
@@ -997,7 +997,15 @@ void action_slot_summary_to_keylist(bAnimContext *ac,
}
animrig::Slot *slot = action.slot_for_handle(slot_handle);
BLI_assert(slot);
if (!slot) {
/* In the Dope Sheet mode of the Dope Sheet, an _Action_ channel actually shows the _Slot_ keys
* in its summary line. When there are animated NLA control curves, that Action channel is also
* shown, even when there is no slot assigned. So this function needs to be able to handle the
* "no slot" case as valid. It just doesn't produce any keys.
*
* Also see `build_channel_keylist()` in `keyframes_draw.cc`. */
return;
}
ListBase anim_data = {nullptr, nullptr};