[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43456] trunk/blender/source/blender/ editors/interface/interface_regions.c: Fix #29762: columns in long enum property menu's were in the wrong order.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Jan 17 17:06:17 CET 2012


Revision: 43456
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43456
Author:   blendix
Date:     2012-01-17 16:06:16 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
Fix #29762: columns in long enum property menu's were in the wrong order.

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

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2012-01-17 16:03:49 UTC (rev 43455)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2012-01-17 16:06:16 UTC (rev 43456)
@@ -1611,6 +1611,7 @@
 	MenuEntry *entry;
 	const char *instr= arg_str;
 	int columns, rows, a, b;
+	int column_start= 0, column_end= 0;
 
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	
@@ -1654,17 +1655,30 @@
 	/* create items */
 	split= uiLayoutSplit(layout, 0, 0);
 
-	for(a=0, b=0; a<md->nitems; a++, b++) {
+	for(a=0; a<md->nitems; a++) {
+		if(a == column_end) {
+			/* start new column, and find out where it ends in advance, so we
+			   can flip the order of items properly per column */
+			column_start= a;
+			column_end= md->nitems;
+
+			for(b=a+1; b<md->nitems; b++) {
+				entry= &md->items[b];
+
+				/* new column on N rows or on separation label */
+				if(((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
+					column_end = b;
+					break;
+				}
+			}
+
+			column= uiLayoutColumn(split, 0);
+		}
+
 		if(block->flag & UI_BLOCK_NO_FLIP)
 			entry= &md->items[a];
 		else
-			entry= &md->items[md->nitems-a-1];
-		
-		/* new column on N rows or on separation label */
-		if((b % rows == 0) || (entry->sepr && entry->str[0])) {
-			column= uiLayoutColumn(split, 0);
-			b= 0;
-		}
+			entry= &md->items[column_start + column_end-1-a];
 
 		if(entry->sepr) {
 			uiItemL(column, entry->str, entry->icon);



More information about the Bf-blender-cvs mailing list