[Bf-blender-cvs] [57b47ebb284] blender2.8: Drivers UI Cleanup (Part of T55145)

Joshua Leung noreply at git.blender.org
Wed May 23 16:32:57 CEST 2018


Commit: 57b47ebb284c03fd6d9863bf0ec9ddbb672e2034
Author: Joshua Leung
Date:   Wed May 23 15:03:59 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB57b47ebb284c03fd6d9863bf0ec9ddbb672e2034

Drivers UI Cleanup (Part of T55145)

* Remove "Show Debug Info" option. Everyone has it turned on all the time,
  since it's just useful to have
* Make the "Remove Driver" button less prominent. It doesn't happen that much,
  so it shouldn't take up as much room
* Make "expressions" textbox wider (i.e. taking up the whole column width)
  by separating the label and textbox on separate lines.
* Rename "Add Variable" button to make it clearer to users what "variables"
  may be (i.e. they serve as a way to specify Inputs, just like adding a
  "Source Data" node in a nodetree)
* Regroup buttons

===================================================================

M	source/blender/editors/animation/drivers.c
M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/makesdna/DNA_anim_types.h
M	source/blender/makesrna/intern/rna_fcurve.c

===================================================================

diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 2d04f73c4ac..f792bd2ea9b 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -117,7 +117,6 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
 			
 			/* add some new driver data */
 			fcu->driver = MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
-			fcu->driver->flag |= DRIVER_FLAG_SHOWDEBUG;
 			
 			/* F-Modifier or Keyframes? */
 			// FIXME: replace these magic numbers with defines
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 3f64217a021..d7905a0c2d9 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -776,7 +776,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	DriverVar *dvar;
 	
 	PointerRNA driver_ptr;
-	uiLayout *col;
+	uiLayout *col, *row;
 	uiBlock *block;
 	uiBut *but;
 	
@@ -786,20 +786,20 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	driver = fcu->driver;
 	
 	/* set event handler for panel */
-	block = uiLayoutGetBlock(pa->layout); // xxx?
+	block = uiLayoutGetBlock(pa->layout);
 	UI_block_func_handle_set(block, do_graph_region_driver_buttons, NULL);
 	
 	/* general actions - management */
-	col = uiLayoutColumn(pa->layout, false);
-	block = uiLayoutGetBlock(col);
+	row = uiLayoutRow(pa->layout, true);
+	block = uiLayoutGetBlock(row);
 	but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_FILE_REFRESH, IFACE_("Update Dependencies"),
 	               0, 0, 10 * UI_UNIT_X, UI_UNIT_Y,
 	               NULL, 0.0, 0.0, 0, 0,
 	               TIP_("Force updates of dependencies"));
 	UI_but_func_set(but, driver_update_flags_cb, fcu, NULL);
 
-	but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ZOOMOUT, IFACE_("Remove Driver"),
-	               0, 0, 10 * UI_UNIT_X, UI_UNIT_Y,
+	but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_X, "",
+	               0, 0, UI_UNIT_X, UI_UNIT_Y,
 	               NULL, 0.0, 0.0, 0, 0,
 	               TIP_("Remove this driver"));
 	UI_but_funcN_set(but, driver_remove_cb, MEM_dupallocN(ale), NULL);
@@ -810,6 +810,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	col = uiLayoutColumn(pa->layout, true);
 	block = uiLayoutGetBlock(col);
 	uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NONE);
+	
+	{
+		char valBuf[32];
+		
+		/* value of driver */
+		row = uiLayoutRow(col, true);
+		uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
+		BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
+		uiItemL(row, valBuf, ICON_NONE);
+	}
 
 	/* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */
 	if (driver->type == DRIVER_TYPE_PYTHON) {
@@ -817,10 +827,20 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 		bool bpy_ctx_expr_error  = (strstr(driver->expression, "bpy.context.") != NULL);
 		
 		/* expression */
-		uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
+		/* TODO: "Show syntax hints" button */
+		col = uiLayoutColumn(pa->layout, true);
+		block = uiLayoutGetBlock(col);
+		
+		uiItemL(col, IFACE_("Expression:"), ICON_NONE);
+		uiItemR(col, &driver_ptr, "expression", 0, "", ICON_NONE);
+		uiItemR(col, &driver_ptr, "use_self", 0, NULL, ICON_NONE);
 		
 		/* errors? */
+		col = uiLayoutColumn(pa->layout, true);
+		block = uiLayoutGetBlock(col);
+		
 		if ((G.f & G_SCRIPT_AUTOEXEC) == 0) {
+			/* TODO: Add button to enable? */
 			uiItemL(col, IFACE_("ERROR: Python auto-execution disabled"), ICON_CANCEL);
 		}
 		else if (driver->flag & DRIVER_FLAG_INVALID) {
@@ -842,6 +862,9 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	}
 	else {
 		/* errors? */
+		col = uiLayoutColumn(pa->layout, true);
+		block = uiLayoutGetBlock(col);
+		
 		if (driver->flag & DRIVER_FLAG_INVALID)
 			uiItemL(col, IFACE_("ERROR: Invalid target channel(s)"), ICON_ERROR);
 			
@@ -860,38 +883,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 			}
 		}
 	}
-		
-	col = uiLayoutColumn(pa->layout, true);
-
-	if (driver->type == DRIVER_TYPE_PYTHON) {
-		uiItemR(col, &driver_ptr, "use_self", 0, NULL, ICON_NONE);
-	}
-
-	/* debug setting */
-	uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, ICON_NONE);
-		
-	/* value of driver */
-	if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
-		uiLayout *row = uiLayoutRow(col, true);
-		char valBuf[32];
-			
-		uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
-			
-		BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
-		uiItemL(row, valBuf, ICON_NONE);
-	}
 	
 	/* add/copy/paste driver variables */
 	{
-		uiLayout *row;
-		
 		/* add driver variable */
 		row = uiLayoutRow(pa->layout, false);
 		block = uiLayoutGetBlock(row);
-		but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ZOOMIN, IFACE_("Add Variable"),
+		but = uiDefIconTextBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_ZOOMIN, 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 and that drivers will update correctly"));
+	                           TIP_("Driver variables ensure that all dependencies will be accounted for, eusuring that drivers will update correctly"));
 		UI_but_func_set(but, driver_add_var_cb, driver, NULL);
 		
 		/* copy/paste (as sub-row) */
@@ -905,7 +906,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	/* loop over targets, drawing them */
 	for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
 		PointerRNA dvar_ptr;
-		uiLayout *box, *row;
+		uiLayout *box;
 		uiLayout *subrow, *sub;
 		
 		/* sub-layout column for this variable's settings */
@@ -968,7 +969,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 		}
 		
 		/* 3) value of variable */
-		if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
+		{
 			char valBuf[32];
 			
 			box = uiLayoutBox(col);
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 13656c543ce..c2248778c46 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -438,6 +438,7 @@ typedef enum eDriver_Types {
 } eDriver_Types;
 
 /* driver flags */
+/* note: (1<<5) is deprecated; was "DRIVER_FLAG_SHOWDEBUG" */
 typedef enum eDriver_Flags {
 		/* driver has invalid settings (internal flag)  */
 	DRIVER_FLAG_INVALID		= (1<<0),
@@ -450,8 +451,6 @@ typedef enum eDriver_Flags {
 	DRIVER_FLAG_RECOMPILE	= (1<<3),
 		/* the names are cached so they don't need have python unicode versions created each time */
 	DRIVER_FLAG_RENAMEVAR	= (1<<4),
-		/* intermediate values of driver should be shown in the UI for debugging purposes */
-	DRIVER_FLAG_SHOWDEBUG	= (1<<5),
 		/* include 'self' in the drivers namespace. */
 	DRIVER_FLAG_USE_SELF	= (1<<6),
 } eDriver_Flags;
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 84ed95bb7a9..d48a0cacd18 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1640,11 +1640,6 @@ static void rna_def_channeldriver(BlenderRNA *brna)
 	rna_def_channeldriver_variables(brna, prop);
 	
 	/* Settings */
-	prop = RNA_def_property(srna, "show_debug_info", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_SHOWDEBUG);
-	RNA_def_property_ui_text(prop, "Show Debug Info",
-	                         "Show intermediate values for the driver calculations to allow debugging of drivers");
-
 	prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_USE_SELF);
 	RNA_def_property_ui_text(prop, "Use Self",



More information about the Bf-blender-cvs mailing list