[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60705] trunk/blender/source/blender/ editors/interface/interface_layout.c: Revert both own r60700 and r60702.

Bastien Montagne montagne29 at wanadoo.fr
Sat Oct 12 13:28:37 CEST 2013


Revision: 60705
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60705
Author:   mont29
Date:     2013-10-12 11:28:37 +0000 (Sat, 12 Oct 2013)
Log Message:
-----------
Revert both own r60700 and r60702. API behavior for expanded enums is completly inconsistent, but again, better to do such changes (soft-breaking API) in bulk...

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60700
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60702

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

Modified: trunk/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_layout.c	2013-10-12 11:18:38 UTC (rev 60704)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c	2013-10-12 11:28:37 UTC (rev 60705)
@@ -503,8 +503,16 @@
 	}
 }
 static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop,
-                                const char *UNUSED(uiname), int h, int icon_only)
+                                const char *uiname, int h, int icon_only)
 {
+	/* XXX The way this function currently handles uiname parameter is insane and inconsistent with general UI API:
+	 *     * uiname is the *enum property* label.
+	 *     * when it is NULL or empty, we do not draw *enum items* labels, this doubles the icon_only parameter.
+	 *     * we *never* draw (i.e. really use) the enum label uiname, it is just used as a mere flag!
+	 *     Unfortunately, fixing this implies an API "soft break", so better to defer it for later... :/
+	 *     --mont29
+	 */
+
 	uiBut *but;
 	EnumPropertyItem *item, *item_array;
 	const char *name;
@@ -512,14 +520,6 @@
 
 	RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item_array, NULL, &free);
 
-#if 0  /* XXX This would be consistent with general uiItemR (i.e. layout.prop() in py) behavior.
-        *     However, so far we never ever shown the label of an expanded enum prop, so for now disable this.
-        */
-	if (uiname && uiname[0]) {
-		uiItemL(layout, uiname, ICON_NONE);
-	}
-#endif
-
 	/* we dont want nested rows, cols in menus */
 	if (layout->root->type != UI_LAYOUT_MENU) {
 		uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
@@ -532,7 +532,7 @@
 		if (!item->identifier[0])
 			continue;
 
-		name = item->name;
+		name = uiname ? uiname : item->name;
 		icon = item->icon;
 		value = item->value;
 		itemw = ui_text_icon_width(block->curlayout, icon_only ? "" : name, icon, 0);




More information about the Bf-blender-cvs mailing list