Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2022-10-06 20:06:48 +0300
committerSybren A. Stüvel <sybren@blender.org>2022-10-06 20:07:33 +0300
commitc592bff0474548d69b3d1a63b05c670c4f499727 (patch)
tree80d42603bf96730f76f93e80f5376b98545afe0b
parent46c40d7fa1ec6fd230acb0b1e1f6cd01a32a05d2 (diff)
Animation: Expose "mute" for drivers in their properties UI
In the driver editor and the "edit driver" popover, add a checkbox that can mute the driver. This is the same functionality as the checkbox in the driver editor's channel list, but then exposed in a different place in the UI. This is for convenience, such that a driver can now be muted by right-clicking on the driven property, choosing "Edit Driver", then muting it there. The same checkbox was added to the regular driver editor's header for consistency. Reviewed By: Severin Maniphest Tasks: T101592 Differential Revision: https://developer.blender.org/D16173
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index edba3c39042..8ada6d31a2d 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -905,6 +905,45 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
/* ----------------------------------------------------------------- */
/* property driven by the driver - duplicates Active FCurve, but useful for clarity */
+
+static void graph_draw_driven_property_enabled_btn(uiLayout *layout,
+ ID *id,
+ FCurve *fcu,
+ const char *label)
+{
+ PointerRNA fcurve_ptr;
+ RNA_pointer_create(id, &RNA_FCurve, fcu, &fcurve_ptr);
+
+ uiBlock *block = uiLayoutGetBlock(layout);
+ uiDefButR(block,
+ UI_BTYPE_CHECKBOX_N,
+ 0,
+ label,
+ 0,
+ 0,
+ UI_UNIT_X,
+ UI_UNIT_Y,
+ &fcurve_ptr,
+ "mute",
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ TIP_("Let the driver determine this property's value"));
+}
+
+static void graph_panel_drivers_header(const bContext *C, Panel *panel)
+{
+ bAnimListElem *ale;
+ FCurve *fcu;
+ if (!graph_panel_context(C, &ale, &fcu)) {
+ return;
+ }
+
+ graph_draw_driven_property_enabled_btn(panel->layout, ale->id, fcu, IFACE_("Driver"));
+}
+
static void graph_draw_driven_property_panel(uiLayout *layout, ID *id, FCurve *fcu)
{
PointerRNA fcu_ptr;
@@ -1315,7 +1354,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel)
uiItemS(layout);
/* Drivers Settings */
- uiItemL(layout, IFACE_("Driver Settings:"), ICON_NONE);
+ graph_draw_driven_property_enabled_btn(panel->layout, id, fcu, IFACE_("Driver:"));
graph_draw_driver_settings_panel(panel->layout, id, fcu, true);
}
}
@@ -1432,6 +1471,7 @@ void graph_buttons_register(ARegionType *art)
strcpy(pt->category, "Drivers");
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
pt->draw = graph_panel_drivers;
+ pt->draw_header = graph_panel_drivers_header;
pt->poll = graph_panel_drivers_poll;
BLI_addtail(&art->paneltypes, pt);