From 1f5647c07d15d2b298b491ebe260a411f7b0d1b8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 19 Feb 2021 10:11:35 -0600 Subject: UI: FModifier layout updates, drag and drop This patch implements the list panel system D7490 for FCurve modifiers. The UI layouts are updated to make use of subpanels and to be consistent with the rest of the interface, and easier to understand. See the differential revision for screenshots. This commit also significantly cleans up the FModifier UI code, and improves, mainly by replacing the old button creation code is with the newer interface API using RNA. In turn there is a bit of complexity added because each FModifier has a separate panel. Although reordering of FModifiers was not implemented before, we get drag and drop basically for free here, so it is also included. As noted in some older to do tasks, FModifiers aren't evaluated in perfect order, which may be a point of improvement for the future. Differential Revision: https://developer.blender.org/D7997 --- source/blender/editors/include/ED_anim_api.h | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/include/ED_anim_api.h') diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 9cf67816df2..2415c85e299 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -33,7 +33,11 @@ struct ID; struct ListBase; struct ARegion; +struct ARegionType; struct Main; +struct NlaStrip; +struct FModifier; +struct PanelType; struct ReportList; struct ScrArea; struct SpaceLink; @@ -675,11 +679,25 @@ void ANIM_draw_framerange(struct Scene *scene, struct View2D *v2d); /* ------------- UI Panel Drawing -------------- */ -/* draw a given F-Modifier for some layout/UI-Block */ -void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, - struct ID *fcurve_owner_id, - ListBase *modifiers, - struct FModifier *fcm); +struct NlaStrip *ANIM_nla_context_strip(const struct bContext *C); +struct FCurve *ANIM_graph_context_fcurve(const struct bContext *C); + +/* Needed for abstraction between the graph editor and the NLA editor. */ +typedef bool (*PanelTypePollFn)(const struct bContext *C, struct PanelType *pt); +/* Avoid including "UI_interface.h" here. */ +typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname); + +void ANIM_fmodifier_panels(const struct bContext *C, + struct ID *owner_id, + struct ListBase *fmodifiers, + uiListPanelIDFromDataFunc panel_id_fn); + +void ANIM_modifier_panels_register_graph_and_NLA(struct ARegionType *region_type, + const char *modifier_panel_prefix, + PanelTypePollFn poll_function); +void ANIM_modifier_panels_register_graph_only(struct ARegionType *region_type, + const char *modifier_panel_prefix, + PanelTypePollFn poll_function); /* ------------- Copy/Paste Buffer -------------- */ -- cgit v1.2.3