Add an Action Slot selector to the Action editor's header, next to the Action selector. The selector shows all slots in the action that are suitable for animating objects (as the Action editor itself is limited to showing the Action of the active object). This also considerably simplifies the 'Animation Debug' panel, as some debugging code has been removed, as well as the display of any animation layers. The latter can be reintroduced (if necessary) when multi-layer animation support is added. Most importantly, it removes the WindowManager property that was used as a hack to assign layered Actions to objects. API change: the RNA property `AnimData.slot` is now a pointer property that reflects the actual slot (it used to be an enum property). Some small changes to the UI code were necessary to make the selector show the slot's display name (and not their internal name). Pull Request: https://projects.blender.org/blender/blender/pulls/125416
66 lines
1.8 KiB
Python
66 lines
1.8 KiB
Python
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
"""NOTE: this is temporary UI code to show animation layers.
|
|
|
|
It is not meant for any particular use, just to have *something* in the UI.
|
|
"""
|
|
|
|
import bpy
|
|
from bpy.types import (
|
|
Panel,
|
|
WindowManager,
|
|
)
|
|
from bpy.props import PointerProperty
|
|
|
|
|
|
class VIEW3D_PT_animation_layers(Panel):
|
|
bl_space_type = 'VIEW_3D'
|
|
bl_region_type = 'UI'
|
|
bl_category = "Animation"
|
|
bl_label = "Animation Debug"
|
|
|
|
@classmethod
|
|
def poll(cls, context):
|
|
return context.preferences.experimental.use_animation_baklava and context.object
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
layout.use_property_split = True
|
|
layout.use_property_decorate = False
|
|
|
|
col = layout.column(align=False)
|
|
|
|
adt = context.object.animation_data
|
|
anim = adt and adt.action
|
|
if anim:
|
|
slot_sub = col.column(align=True)
|
|
slot_sub.template_search(
|
|
adt, "action_slot",
|
|
adt, "action_slots",
|
|
new="",
|
|
unlink="anim.slot_unassign_object",
|
|
)
|
|
|
|
internal_sub = slot_sub.box().column(align=True)
|
|
internal_sub.active = False # Just to dim.
|
|
internal_sub.prop(adt, "action_slot_handle", text="handle")
|
|
if adt.action_slot:
|
|
internal_sub.prop(adt.action_slot, "name", text="Internal Name")
|
|
|
|
if adt:
|
|
col.prop(adt, "action_slot_name", text="ADT Slot Name")
|
|
else:
|
|
col.label(text="ADT Slot Name: -")
|
|
|
|
|
|
classes = (
|
|
VIEW3D_PT_animation_layers,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__": # only for live edit.
|
|
register_, _ = bpy.utils.register_classes_factory(classes)
|
|
register_()
|