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:
authorJoshua Leung <aligorith@gmail.com>2016-04-16 18:27:26 +0300
committerJoshua Leung <aligorith@gmail.com>2016-04-16 18:29:28 +0300
commitb49fd600609f264eef221288ca348ccf2fca5c8d (patch)
tree202098ad34050e3fe9b2fab8133a7b88ac8dd50a
parent4572d4d8614ba69a9444d8f4ceab6dcaa730e720 (diff)
Experimental Drivers UI Tweak: Use icons for variable types
This commit aims to streamline the driver variables layout a bit * Each variable type now has an icon. (The loc diff and rot diff ones are placeholders, which could deserve something better/dedicated if we continue to use this) * Instead of taking up an entire row, the variable type dropdown now only shows an icon, and is located before the variable name field. Feedback wanted: Is this more/less confusing than it was?
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c34
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c8
2 files changed, 26 insertions, 16 deletions
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 8230ba27db2..a9ab1502e16 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -851,21 +851,34 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
PointerRNA dvar_ptr;
uiLayout *box, *row;
+ uiLayout *subrow, *sub;
/* sub-layout column for this variable's settings */
col = uiLayoutColumn(pa->layout, true);
- /* header panel */
+ /* 1) header panel */
box = uiLayoutBox(col);
- /* first row context info for driver */
RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
row = uiLayoutRow(box, false);
block = uiLayoutGetBlock(row);
- /* variable name */
- uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE);
- /* invalid name? */
+ /* 1.1) variable type and name */
+ subrow = uiLayoutRow(row, true);
+
+ /* 1.1.1) variable type */
+ sub = uiLayoutRow(subrow, true); /* HACK: special group just for the enum, otherwise we */
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT); /* we get ugly layout with text included too... */
+
+ uiItemR(sub, &dvar_ptr, "type", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+
+ /* 1.1.2) variable name */
+ sub = uiLayoutRow(subrow, true); /* HACK: special group to counteract the effects of the previous */
+ uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_EXPAND); /* enum, which now pushes everything too far right */
+
+ uiItemR(sub, &dvar_ptr, "name", 0, "", ICON_NONE);
+
+ /* 1.2) invalid name? */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
if (dvar->flag & DVAR_FLAG_INVALID_NAME) {
@@ -874,17 +887,14 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
UI_but_func_set(but, driver_dvar_invalid_name_query_cb, dvar, NULL); // XXX: reports?
}
- /* remove button */
+ /* 1.3) remove button */
but = uiDefIconBut(block, UI_BTYPE_BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable"));
UI_but_func_set(but, driver_delete_var_cb, driver, dvar);
UI_block_emboss_set(block, UI_EMBOSS);
- /* variable type */
- row = uiLayoutRow(box, false);
- uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NONE);
-
- /* variable type settings */
+
+ /* 2) variable type settings */
box = uiLayoutBox(col);
/* controls to draw depends on the type of variable */
switch (dvar->type) {
@@ -902,7 +912,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
break;
}
- /* value of variable */
+ /* 3) value of variable */
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
char valBuf[32];
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 32008640930..a6e6f0713d7 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -1467,11 +1467,11 @@ static void rna_def_drivervar(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem prop_type_items[] = {
- {DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", 0, "Single Property", "Use the value from some RNA property (Default)"},
- {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", 0, "Transform Channel",
+ {DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", ICON_RNA, "Single Property", "Use the value from some RNA property (Default)"},
+ {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", ICON_MANIPUL, "Transform Channel",
"Final transformation value of object or bone"},
- {DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", 0, "Rotational Difference", "Use the angle between two bones"},
- {DVAR_TYPE_LOC_DIFF, "LOC_DIFF", 0, "Distance", "Distance between two bones or objects"},
+ {DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", ICON_PARTICLE_TIP, "Rotational Difference", "Use the angle between two bones"}, /* XXX: Icon... */
+ {DVAR_TYPE_LOC_DIFF, "LOC_DIFF", ICON_FULLSCREEN_ENTER, "Distance", "Distance between two bones or objects"}, /* XXX: Icon... */
{0, NULL, 0, NULL, NULL}
};