Use appropriate context for the DopeSheet Action Custom Properties panel.

Refactor D14646 to use context.active_action for the Action
Custom Properties panel, matching the already existing Action panel.

This has the advantage that it allows access to the properties of
any actions with channels visible in the Dope Sheet, e.g. Shape Keys,
Materials etc; while using just the active object is limited to just
the object animation.

Also move both panels from Item to the Action tab.

Differential Revision: https://developer.blender.org/D15288
This commit is contained in:
Alexander Gavrilov 2022-06-24 17:08:54 +03:00
parent ae49e0e8be
commit 054a169be0
1 changed files with 4 additions and 6 deletions

View File

@ -548,22 +548,20 @@ class DopesheetActionPanelBase:
class DOPESHEET_PT_custom_props_action(PropertyPanel, Panel):
bl_space_type = 'DOPESHEET_EDITOR'
bl_category = "Item"
bl_category = "Action"
bl_region_type = 'UI'
bl_context = 'data'
_context_path = "active_object.animation_data.action"
_context_path = "active_action"
_property_type = bpy.types.Action
@classmethod
def poll(cls, context):
return context.active_object \
and context.active_object.animation_data \
and context.active_object.animation_data.action
return bool(context.active_action)
class DOPESHEET_PT_action(DopesheetActionPanelBase, Panel):
bl_space_type = 'DOPESHEET_EDITOR'
bl_category = "Item"
bl_category = "Action"
@classmethod
def poll(cls, context):