[Bf-blender-cvs] [6573af52111] blender2.8: Drivers Editor UI Tweaks (Part of T55145)
Joshua Leung
noreply at git.blender.org
Tue May 22 16:44:23 CEST 2018
Commit: 6573af5211161bc621cd8f5d2bf6284666bb4381
Author: Joshua Leung
Date: Tue May 22 16:22:28 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6573af5211161bc621cd8f5d2bf6284666bb4381
Drivers Editor UI Tweaks (Part of T55145)
To bring the UI more in line with the proposed design in T54653 for the "Add Drivers"
popup panel (NOTE: this is separate from the "Drivers Editor", in previous commit!),
this commit adds a new panel - "Driven Property" to the Drivers Editor UI.
This basically duplicates the "Active F-Curve" panel (with less options)
to make it easier to see at a glance which property the Drivers Editor is
showing you.
===================================================================
M source/blender/editors/space_graph/graph_buttons.c
===================================================================
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index c79652795ac..cc7448fafd6 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -728,6 +728,50 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
+
+/* property driven by the driver - duplicates Active FCurve, but useful for clarity */
+static void graph_panel_driven_property(const bContext *C, Panel *pa)
+{
+ bAnimListElem *ale;
+ FCurve *fcu;
+ PointerRNA fcu_ptr;
+ uiLayout *layout = pa->layout;
+ char name[256];
+ int icon = 0;
+
+ if (!graph_panel_context(C, &ale, &fcu))
+ return;
+
+ /* F-Curve pointer */
+ RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr);
+
+ /* user-friendly 'name' for F-Curve */
+ if (ale->type == ANIMTYPE_FCURVE) {
+ /* get user-friendly name for F-Curve */
+ icon = getname_anim_fcurve(name, ale->id, fcu);
+ }
+ else {
+ /* NLA Control Curve, etc. */
+ const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
+
+ /* get name */
+ if (acf && acf->name) {
+ acf->name(ale, name);
+ }
+ else {
+ strcpy(name, IFACE_("<invalid>"));
+ icon = ICON_ERROR;
+ }
+
+ /* icon */
+ if (ale->type == ANIMTYPE_NLACURVE)
+ icon = ICON_NLA;
+ }
+ uiItemL(layout, name, icon);
+
+ MEM_freeN(ale);
+}
+
/* driver settings for active F-Curve (only for 'Drivers' mode) */
static void graph_panel_drivers(const bContext *C, Panel *pa)
{
@@ -1035,10 +1079,18 @@ void graph_buttons_register(ARegionType *art)
pt->poll = graph_panel_poll;
BLI_addtail(&art->paneltypes, pt);
+ pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers driven");
+ strcpy(pt->idname, "GRAPH_PT_driven_property");
+ strcpy(pt->label, N_("Driven Property"));
+ strcpy(pt->category, "Drivers");
+ strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ pt->draw = graph_panel_driven_property;
+ pt->poll = graph_panel_drivers_poll;
+ BLI_addtail(&art->paneltypes, pt);
pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
strcpy(pt->idname, "GRAPH_PT_drivers");
- strcpy(pt->label, N_("Drivers"));
+ strcpy(pt->label, N_("Driver"));
strcpy(pt->category, "Drivers");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = graph_panel_drivers;
More information about the Bf-blender-cvs
mailing list