Anim: Always name the slot "Legacy Slot" when versioning legacy Actions

When creating Action Slots for legacy Actions, always name those slots
"Legacy Slot". Before this commit, the slot was named after the ID that
is animated by the Action; this matches what Blender will do when
animating that ID from scratch.

The old versioning behaviour caused issues when dealing with legacy
Actions: if there are multiple Actions in a file (for example multiple
run cycle animations) and only one of those was assigned to the
character (the rest has a fake user), Blender would only name that one
action slot after the character. The "fake user" Actions would just be
get a slot named "Slot".

This causes issues when toggling between the different Actions, as
Blender will not automatically assign a slot when switching from the
character- named one to the "Slot" one.

Ref: #129563, #130261

Pull Request: https://projects.blender.org/blender/blender/pulls/131425
This commit is contained in:
Sybren A. Stüvel
2024-12-05 12:18:48 +01:00
parent 8541296e9d
commit 63adbb19fb
2 changed files with 7 additions and 10 deletions

View File

@@ -513,8 +513,8 @@ class VersioningTest(unittest.TestCase):
self.assertEqual(len(strip.channelbags[0].groups), 1)
self.assertEqual(len(strip.channelbags[0].groups[0].channels), 9)
# Multi user slots do not get named after their users.
self.assertEqual(action.slots[0].identifier, "OBSlot")
# Slots created from legacy Actions are always called "Legacy SLot".
self.assertEqual(action.slots[0].identifier, "OBLegacy Slot")
def test_action_constraint(self):
constrained_object = bpy.data.objects["action_constraint_constrained"]
@@ -546,8 +546,8 @@ class VersioningTest(unittest.TestCase):
self.assertEqual(len(strip.channelbags[0].groups[0].channels), 10)
self.assertEqual(len(strip.channelbags[0].groups[1].channels), 10)
# Slots with a single user are named after their user.
self.assertEqual(action.slots[0].identifier, "OBarmature_object")
# Slots on converted Actions are always called "Legacy Slot"
self.assertEqual(action.slots[0].identifier, "OBLegacy Slot")
for fcurve in strip.channelbags[0].groups[0].channels:
self.assertEqual(fcurve.group.name, "Bone")