Anim: use legacy names for data created via legacy APIs
Previously, when use of the legacy Action APIs (specifically the `fcurves` and `groups` properties) caused a new Slot to be created, it would be named "Slot". This PR changes things so that Slots created that way are named "Legacy Slot", just like Slots from upgraded legacy Actions. The rationale is that Slots created in this way are expected (by the code that created them) to be used as if the Action were still a legacy Action, and it's good to reflect that in the name of the data. This also makes it clearer to users when e.g. scripts and addons they're using may not yet have been updated to fully work with Slotted Actions. For consistency, this PR also names Layers created in the same way "Legacy Layer", the same as Layers from upgraded legacy Actions. Pull Request: https://projects.blender.org/blender/blender/pulls/133888
This commit is contained in:
committed by
Nathan Vegdahl
parent
3929a37786
commit
978011fe43
@@ -388,6 +388,9 @@ class LegacyAPIOnLayeredActionTest(unittest.TestCase):
|
||||
slot = self.action.slots[0]
|
||||
layer = self.action.layers[0]
|
||||
|
||||
self.assertEqual("Legacy Slot", slot.name_display)
|
||||
self.assertEqual("Legacy Layer", layer.name)
|
||||
|
||||
self.assertEqual(1, len(layer.strips))
|
||||
strip = layer.strips[0]
|
||||
self.assertEqual('KEYFRAME', strip.type)
|
||||
@@ -425,6 +428,28 @@ class LegacyAPIOnLayeredActionTest(unittest.TestCase):
|
||||
self.assertNotIn(group, self.action.groups[:], "A group should be removable via the legacy API")
|
||||
self.assertNotIn(group, channelbag.groups[:], "A group should be removable via the legacy API")
|
||||
|
||||
def test_groups_new_on_empty_action(self) -> None:
|
||||
# Create new group via legacy API, this should create a layer+strip+Channelbag.
|
||||
group = self.action.groups.new("foo")
|
||||
|
||||
self.assertEqual(1, len(self.action.slots))
|
||||
self.assertEqual(1, len(self.action.layers))
|
||||
|
||||
slot = self.action.slots[0]
|
||||
layer = self.action.layers[0]
|
||||
|
||||
self.assertEqual("Legacy Slot", slot.name_display)
|
||||
self.assertEqual("Legacy Layer", layer.name)
|
||||
|
||||
self.assertEqual(1, len(layer.strips))
|
||||
strip = layer.strips[0]
|
||||
self.assertEqual('KEYFRAME', strip.type)
|
||||
self.assertEqual(1, len(strip.channelbags))
|
||||
channelbag = strip.channelbags[0]
|
||||
self.assertEqual(channelbag.slot_handle, slot.handle)
|
||||
|
||||
self.assertEqual([group], channelbag.groups[:])
|
||||
|
||||
|
||||
class ChannelbagsTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in New Issue
Block a user