Refactor: convert Rigify from legacy Action API to the current API
Minimal changes to make Rigify use the current Action API (introduced in Blender 4.4) instead of the legacy API (removed in 5.0). Most of the refactoring consists of: - Find the right `Channelbag` - Replace operations on `Action` with operations on that `Channelbag`. I didn't manage to test all code, because some code paths are very hard to follow, and others seem to only be available for legacy rigs. This is part of #146586 Pull Request: https://projects.blender.org/blender/blender/pulls/147060
This commit is contained in:
@@ -96,6 +96,23 @@ def action_get_channelbag_for_slot(action: Action | None, slot: ActionSlot | Non
|
||||
return None
|
||||
|
||||
|
||||
def action_get_first_suitable_slot(action: Action | None, target_id_type: str) -> ActionSlot | None:
|
||||
"""Return the first Slot of the given Action that's suitable for the given ID type.
|
||||
|
||||
Typically you should not need this function; when an Action is assigned to a
|
||||
data-block, just use the slot that was assigned along with it.
|
||||
"""
|
||||
|
||||
if not action:
|
||||
return None
|
||||
|
||||
slot_types = ('UNSPECIFIED', target_id_type)
|
||||
for slot in action.slots:
|
||||
if slot.target_id_type in slot_types:
|
||||
return slot
|
||||
return None
|
||||
|
||||
|
||||
def action_ensure_channelbag_for_slot(action: Action, slot: ActionSlot) -> ActionChannelbag:
|
||||
"""Ensure a layer and a keyframe strip exists, then ensure that strip has a channelbag for the slot."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user