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:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-06-16 13:32:50 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-06-16 14:16:05 +0300
commit3e086af79ceb38345eed1c76472eb6fc8cfc1196 (patch)
tree19630b47cc3459f49d8313acd2f3b4521f1769c9 /source/blender/editors/space_graph/graph_buttons.c
parent985f33719ce9108d35d5f37b4c7c79d81f708a0d (diff)
Drivers: fix Variable Copy & Paste in the edit popover.
Without these buttons the functionality of the popover is incomplete compared to the Graph Editor panel. To support this the operators have to read the active F-Curve from the context, instead of directly scanning animation data. Expanding the context would also help Python operators.
Diffstat (limited to 'source/blender/editors/space_graph/graph_buttons.c')
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c82
1 files changed, 33 insertions, 49 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index cdb5e672f4a..301fefaf989 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -904,7 +904,7 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
DriverVar *dvar;
PointerRNA driver_ptr;
- uiLayout *col, *row;
+ uiLayout *col, *row, *row_outer;
uiBlock *block;
uiBut *but;
@@ -1005,61 +1005,41 @@ static void graph_draw_driver_settings_panel(uiLayout *layout,
uiItemS(layout);
/* add/copy/paste driver variables */
- if (is_popover) {
- /* add driver variable - add blank */
- row = uiLayoutRow(layout, true);
- block = uiLayoutGetBlock(row);
- but = uiDefIconTextBut(
- block,
- UI_BTYPE_BUT,
- B_IPO_DEPCHANGE,
- ICON_ADD,
- IFACE_("Add Input Variable"),
- 0,
- 0,
- 10 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- TIP_("Add a Driver Variable to keep track an input used by the driver"));
- UI_but_func_set(but, driver_add_var_cb, driver, NULL);
+ row_outer = uiLayoutRow(layout, false);
+ /* add driver variable - add blank */
+ row = uiLayoutRow(row_outer, true);
+ block = uiLayoutGetBlock(row);
+ but = uiDefIconTextBut(
+ block,
+ UI_BTYPE_BUT,
+ B_IPO_DEPCHANGE,
+ ICON_ADD,
+ IFACE_("Add Input Variable"),
+ 0,
+ 0,
+ 10 * UI_UNIT_X,
+ UI_UNIT_Y,
+ NULL,
+ 0.0,
+ 0.0,
+ 0,
+ 0,
+ TIP_("Add a Driver Variable to keep track of an input used by the driver"));
+ UI_but_func_set(but, driver_add_var_cb, driver, NULL);
+
+ if (is_popover) {
/* add driver variable - add using eyedropper */
/* XXX: will this operator work like this? */
uiItemO(row, "", ICON_EYEDROPPER, "UI_OT_eyedropper_driver");
}
- else {
- /* add driver variable */
- row = uiLayoutRow(layout, false);
- block = uiLayoutGetBlock(row);
- but = uiDefIconTextBut(block,
- UI_BTYPE_BUT,
- B_IPO_DEPCHANGE,
- ICON_ADD,
- IFACE_("Add Input Variable"),
- 0,
- 0,
- 10 * UI_UNIT_X,
- UI_UNIT_Y,
- NULL,
- 0.0,
- 0.0,
- 0,
- 0,
- TIP_("Driver variables ensure that all dependencies will be accounted "
- "for, ensuring that drivers will update correctly"));
- UI_but_func_set(but, driver_add_var_cb, driver, NULL);
- /* copy/paste (as sub-row) */
- row = uiLayoutRow(row, true);
- block = uiLayoutGetBlock(row);
+ /* copy/paste (as sub-row) */
+ row = uiLayoutRow(row_outer, true);
+ block = uiLayoutGetBlock(row);
- uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy");
- uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste");
- }
+ uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy");
+ uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste");
/* loop over targets, drawing them */
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
@@ -1280,6 +1260,10 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *pa)
if (fcu && fcu->driver) {
ID *id = ptr.id.data;
+ PointerRNA ptr_fcurve;
+ RNA_pointer_create(id, &RNA_FCurve, fcu, &ptr_fcurve);
+ uiLayoutSetContextPointer(layout, "active_editable_fcurve", &ptr_fcurve);
+
/* Driven Property Settings */
uiItemL(layout, IFACE_("Driven Property:"), ICON_NONE);
graph_draw_driven_property_panel(pa->layout, id, fcu);