blender/scripts/startup/bl_ui/anim.py
Christoph Lendenfeld 12e628ea43 Refactor: remove remaining legacy action code
This removes the remaining legacy action code, that includes any unit tests for
legacy actions.
The only place that still deals with legacy actions is the versioning code.

I left the RNA functions `is_action_legacy` and `is_action_layered` in
place to not cause a breaking change for addons. However the functions
are now just hardcoded to return false and true respectively.

Part of #150644

Pull Request: https://projects.blender.org/blender/blender/pulls/152526
2026-01-12 11:35:10 +01:00

60 lines
1.6 KiB
Python

# SPDX-FileCopyrightText: 2024 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
from bpy.types import Menu
def draw_action_and_slot_selector_for_id(layout, animated_id):
"""
Draw the action and slot selector for an ID, using the given layout.
The ID must be an animatable ID.
Note that the slot selector is only drawn when the ID has an assigned
Action.
"""
layout.template_action(animated_id, new="action.new", unlink="action.unlink")
adt = animated_id.animation_data
if not adt or not adt.action:
return
layout.context_pointer_set("animated_id", animated_id)
layout.template_search(
adt, "action_slot",
adt, "action_suitable_slots",
new="anim.slot_new_for_id",
unlink="anim.slot_unassign_from_id",
)
class ANIM_MT_keyframe_insert_pie(Menu):
bl_label = "Keyframe Insert Pie"
def draw(self, _context):
layout = self.layout
pie = layout.menu_pie()
prop = pie.operator("anim.keyframe_insert_by_name", text="Location")
prop.type = "Location"
prop = pie.operator("anim.keyframe_insert_by_name", text="Scale")
prop.type = "Scaling"
prop = pie.operator("anim.keyframe_insert_by_name", text="Available")
prop.type = "Available"
prop = pie.operator("anim.keyframe_insert_by_name", text="Rotation")
prop.type = "Rotation"
classes = (
ANIM_MT_keyframe_insert_pie,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)