# Layered Action operators Brainstorming ideas to work with the new layered animation datablock. There is no difficulty rating, but based on the technical considerations it might be possible to see which operators will be tricky. ## Merge actions Merge two or more actions into one, preserving all animation. ### Technical Aspects With the initial implementation of baklava where no layers and strips are supported, those should be merged. If the action contains more than 1 layer and 1 infinite strip, this cannot be done reliably. Instead layers should just be moved without modification. At that stage we will need to support merging strips and layers. Slots need to be checked for name clashes and handle clashes. Which action the data is moved into is determined by the user. Can be via drag and drop or the active object. All data blocks whose action is merged will need to point to the merged action with the correct slot id. Ensure that there is only one active slot. Deleting actions is up to the garbage collector in blender. This is similar to how merging meshes works, where the mesh data is kept with 0 users when joining meshes. ### UI/UX In the viewport the data is merged into the active object. In case that has no action, it is created. Not sure how that would be exposed in the outliner, or if that should even be done. ### Python `action.merge(target_action, ...)` not sure if it's possible to pass 1-n parameters or a list from python to C++. ## Explode action Separate the slots of a single action into multiple action in such a way that each action has one slot. ### Technical Aspects Data is moved out of the original action, leaving it empty and up to the blender garbage collector to delete. All users of that action have to be reassigned to the newly created action. Naming of the new actions should use the ID name just like creating a new action. This way we avoid getting overly long action names. ### UI/UX * In the right click menu of the outliner * In the right click menu of any animation editor that displays actions in the channel list * Unused slots can get lost in that process. This needs to be communicated clearly. ## Move a slot to a different action Move the slot and the animation data using that slot to a different action. ### Technical Aspects The active slot flag needs to be reset to avoid double active slots. The slot needs to be checked for naming clashes. The slot may need a new handle in the new action. All references to the old handle that are moved over need to be updated. All objects referencing that slot need to be reassigned to point to the new action. The layer and strip structure needs to be rebuilt in this other action. This again needs to be checked for name clashes. Again, merging can only be done reliably with 1 layer and 1 infinite strip. Deleting actions is up to the garbage collection system in blender which will kick in if no users reference that action anymore. ### UI/UX * Drag and Drop from the Outliner. For this to work, slots need to be exposed in the outliner. * Drag and Drop from animation editors. This would need slots exposed (Action editor already has that) and requires the user to select both objects that he wants to move the data between. * Right click -> "Move to". Needs a popup of all available actions, best with a search field. Since Blender avoids pop-ups this might not be a good design. ### Python `action.move_slot(slot_id, target_action)` ## Merge Object+Data Quickly merge the object and data level action of the active object if they exist. ### Technical aspects Implement after the "Merge actions" operator since it's basically the same, just presented differently to the user. ### UI/UX * Throw a warning if there is only one action ## Move a slot to a new Action Similar to moving to an existing action, but creates a new action instead. ### UI/UX * Right click -> "Move to new". * Not possible with drag and drop by design to avoid accidental creations of new actions. Would be possible by dragging a slot into an empty area. ### Python `action.move_slot_to_new(slot_id) -> Action` may not be needed as it can easily be achieved by creating a new action and then moving a slot ## Move a Layer to a different position in the stack Move a layer to a different position in the layer stack ### UI/UX * Drag and Drop in the outliner * Drag and Drop in all animation editors that show layers ## Move a Layer to a different Action Move a layer and the animation data it contains to a different action. ### Technical Aspects slots present in the strips of the Layers need to be added or merged with existing slots. Layers need to be checked for name clashes. ### UI/UX * The order of the moved layer in the stack should be indicated by the user i.e. if dragging it into the middle, that's where it should end up at. Best with a visual indicator. * Drag and Drop from the Outliner -> Show layers in the outliner. * Drag and Drop from animation editors -> show layers in all animation editors. ## Move a Strip to a different Layer on the same Action Move a strip and its animation data to a different layer. ### UI/UX * Not supported in the outliner because the user would not see clashes with strips that might already be on that layer. * Drag and Drop in an NLA like editor, overlaps with existing strips are handled as if moving strips on the same layer.