[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55328] trunk/blender/source/blender/ editors/interface: Any ID Selector Template: ID Type dropdown now shows icon only as originally

Joshua Leung aligorith at gmail.com
Sat Mar 16 04:59:05 CET 2013


Revision: 55328
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55328
Author:   aligorith
Date:     2013-03-16 03:59:03 +0000 (Sat, 16 Mar 2013)
Log Message:
-----------
Any ID Selector Template: ID Type dropdown now shows icon only as originally
intended

Finally, I've figured out a way to get the ID Selector Template to only show the
icon for the type of ID block (i.e. the intended design), instead of icon+text.
This improves the layout a bit, as previously the type selector and ID-block
pointer and label would all be the same sizes (roughly 1/3rd of the overall
width each), which meant that there wasn't much room left to actually see which
datablock had been selected.

Additionally, I've fixed a few more layout types which still didn't correctly
propagate the red-alert flags.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_layout.c
    trunk/blender/source/blender/editors/interface/interface_templates.c

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c	2013-03-16 02:53:45 UTC (rev 55327)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c	2013-03-16 03:59:03 UTC (rev 55328)
@@ -2369,6 +2369,7 @@
 	litem->active = 1;
 	litem->enabled = 1;
 	litem->context = layout->context;
+	litem->redalert = layout->redalert;
 	BLI_addtail(&layout->items, litem);
 
 	uiBlockSetCurLayout(layout->root->block, litem);
@@ -2396,6 +2397,7 @@
 	litem->active = 1;
 	litem->enabled = 1;
 	litem->context = layout->context;
+	litem->redalert = layout->redalert;
 	BLI_addtail(&layout->items, litem);
 
 	uiBlockSetCurLayout(layout->root->block, litem);
@@ -2415,6 +2417,7 @@
 	split->litem.enabled = 1;
 	split->litem.context = layout->context;
 	split->litem.space = layout->root->style->columnspace;
+	split->litem.redalert = layout->redalert;
 	split->litem.w = layout->w;
 	split->percentage = percentage;
 	BLI_addtail(&layout->items, split);

Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c	2013-03-16 02:53:45 UTC (rev 55327)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c	2013-03-16 03:59:03 UTC (rev 55328)
@@ -669,7 +669,7 @@
                      const char *text)
 {
 	PropertyRNA *propID, *propType;
-	uiLayout *row;
+	uiLayout *split, *row, *sub;
 	
 	/* get properties... */
 	propID = RNA_struct_find_property(ptr, propname);
@@ -685,22 +685,34 @@
 	}
 	
 	/* Start drawing UI Elements using standard defines */
-	row = uiLayoutRow(layout, TRUE);
+	split = uiLayoutSplit(layout, 0.33f, FALSE); /* NOTE: split amount here needs to be synced with normal labels */
 	
+	/* FIRST PART ................................................ */
+	row = uiLayoutRow(split, FALSE);
+	
 	/* Label - either use the provided text, or will become "ID-Block:" */
 	if (text) {
 		if (text[0])
 			uiItemL(row, text, ICON_NONE);
 	}
-	else
+	else {
 		uiItemL(row, IFACE_("ID-Block:"), ICON_NONE);
+	}
 	
+	/* SECOND PART ................................................ */
+	row = uiLayoutRow(split, TRUE);
+	
 	/* ID-Type Selector - just have a menu of icons */
-	/* FIXME: the icon-only setting doesn't work when we supply a blank name */
-	uiItemFullR(row, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+	sub = uiLayoutRow(row, TRUE);                     /* HACK: special group just for the enum, otherwise we */
+	uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);  /*       we get ugly layout with text included too...  */
 	
+	uiItemFullR(sub, ptr, propType, 0, 0, UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+	
 	/* ID-Block Selector - just use pointer widget... */
-	uiItemFullR(row, ptr, propID, 0, 0, 0, "", ICON_NONE);
+	sub = uiLayoutRow(row, 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         */
+	
+	uiItemFullR(sub, ptr, propID, 0, 0, 0, "", ICON_NONE);
 }
 
 /********************* RNA Path Builder Template ********************/




More information about the Bf-blender-cvs mailing list