[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25760] trunk/blender/source/blender/ editors/interface/interface_layout.c: Fix for PROP_MATRIX auto UI layout
Matt Ebb
matt at mke3.net
Wed Jan 6 02:41:05 CET 2010
Revision: 25760
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25760
Author: broken
Date: 2010-01-06 02:41:00 +0100 (Wed, 06 Jan 2010)
Log Message:
-----------
Fix for PROP_MATRIX auto UI layout
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 2010-01-06 00:09:07 UTC (rev 25759)
+++ trunk/blender/source/blender/editors/interface/interface_layout.c 2010-01-06 01:41:00 UTC (rev 25760)
@@ -388,22 +388,22 @@
}
}
else if(subtype == PROP_MATRIX) {
- /* matrix layout */
+ int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */
int row, col;
uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 1));
- len= ceil(sqrt(len));
+ totdim= RNA_property_array_dimension(ptr, prop, dim_size);
+ if (totdim != 2) return; /* only 2D matrices supported in UI so far */
+
+ w /= dim_size[0];
+ h /= dim_size[1];
- h /= len;
- w /= len;
-
- // XXX test
for(a=0; a<len; a++) {
- col= a%len;
- row= a/len;
-
- but= uiDefAutoButR(block, ptr, prop, a, "", 0, x + w*col, y+(row-a-1)*UI_UNIT_Y, w, UI_UNIT_Y);
+ col= a % dim_size[0];
+ row= a / dim_size[0];
+
+ but= uiDefAutoButR(block, ptr, prop, a, "", 0, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y);
if(slider && but->type==NUM)
but->type= NUMSLI;
}
@@ -911,7 +911,7 @@
name= (char*)RNA_property_ui_name(prop);
if(!icon)
icon= RNA_property_ui_icon(prop);
-
+
if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
name= ui_item_name_add_colon(name, namestr);
else if(type == PROP_BOOLEAN && len && index == RNA_NO_INDEX)
More information about the Bf-blender-cvs
mailing list