Anim: fix versioning of empty legacy Actions

Empty legacy Actions were skipped from versioning, because they are
technically valid layered Actions as well. However, this created an
issue where there was no "Legacy Slot" created for those. Furthermore,
their `idroot` could still be set to a non-zero value, which is not
allowed on layered Actions.

`bAction::idroot` is not a very reliable field. It can be zero on legacy
Actions as well, and it can in certain cases be downright wrong (can
happen in certain linking scenarios). Because of this, the field is not
included in any "is this a layered or a legacy Action?" checks.

Pull Request: https://projects.blender.org/blender/blender/pulls/132757
This commit is contained in:
Sybren A. Stüvel
2025-01-07 17:05:36 +01:00
parent 63d3573c2b
commit ed58b945dd

View File

@@ -49,9 +49,12 @@ void convert_legacy_animato_actions(Main &bmain)
LISTBASE_FOREACH (bAction *, dna_action, &bmain.actions) {
blender::animrig::Action &action = dna_action->wrap();
if (action_is_layered(action)) {
if (action_is_layered(action) && !action.is_empty()) {
/* This is just a safety net. Blender files that trigger this versioning code are not
* expected to have any layered/slotted Actions. */
* expected to have any layered/slotted Actions.
*
* Empty Actions, even though they are valid "layered" Actions, should still get through
* versioning, though, to ensure they have the default "Legacy Slot" and a zero idroot. */
continue;
}