[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19765] branches/blender2.5/blender/source /blender: UI:
Brecht Van Lommel
brecht at blender.org
Thu Apr 16 23:58:06 CEST 2009
Revision: 19765
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19765
Author: blendix
Date: 2009-04-16 23:58:06 +0200 (Thu, 16 Apr 2009)
Log Message:
-----------
UI:
* Broke loading buttons_scene.py in last commit.
* Fix issue with space not being distributed equally
in the layout engine.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
branches/blender2.5/blender/source/blender/python/intern/bpy_panel_wrap.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 2009-04-16 21:51:20 UTC (rev 19764)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c 2009-04-16 21:58:06 UTC (rev 19765)
@@ -160,14 +160,14 @@
#define UI_FIT_EXPAND 1
-static int ui_item_fit(int item, int pos, int all, int available, int last, int flag)
+static int ui_item_fit(int item, int pos, int all, int available, int spacing, int last, int flag)
{
- if(all > available) {
+ if(all > available-spacing) {
/* contents is bigger than available space */
if(last)
return available-pos;
else
- return (item*available)/all;
+ return (item*(available-spacing))/all;
}
else {
/* contents is smaller or equal to available space */
@@ -175,7 +175,7 @@
if(last)
return available-pos;
else
- return (item*available)/all;
+ return (item*(available-spacing))/all;
}
else
return item;
@@ -210,7 +210,7 @@
/* special check for layer layout */
int butw, buth;
- butw= ui_item_fit(EM_UNIT_X, 0, EM_UNIT_X*10 + BUTTON_SPACE_X, w, 0, UI_FIT_EXPAND);
+ butw= ui_item_fit(EM_UNIT_X, 0, EM_UNIT_X*10 + BUTTON_SPACE_X, w, 0, 0, UI_FIT_EXPAND);
buth= MIN2(EM_UNIT_Y, butw);
y += 2*(EM_UNIT_Y - buth);
@@ -295,7 +295,7 @@
uiBlockBeginAlign(block);
pos= 0;
for(a=0; a<totitem; a++) {
- itemw= ui_item_fit(1, pos, totitem, w, a == totitem-1, UI_FIT_EXPAND);
+ itemw= ui_item_fit(1, pos, totitem, w, 0, a == totitem-1, UI_FIT_EXPAND);
uiDefButR(block, ROW, 0, NULL, x+pos, y, itemw, h, &rnaitem->ptr, propname, -1, 0, item[a].value, -1, -1, NULL);
pos += itemw;
}
@@ -665,11 +665,11 @@
/* create buttons starting from left */
x= 0;
- w= layout->w - (tot-1)*BUTTON_SPACE_X;
+ w= layout->w;
for(item=template->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
- itemw= ui_item_fit(itemw, x, totw, w, !item->next, UI_FIT_EXPAND);
+ itemw= ui_item_fit(itemw, x, totw, w, (tot-1)*BUTTON_SPACE_X, !item->next, UI_FIT_EXPAND);
ui_item_buts(block, item, layout->x+x, layout->y-itemh, itemw, itemh);
x += itemw+BUTTON_SPACE_X;
@@ -693,13 +693,13 @@
x= 0;
miny= 0;
- w= layout->w - (totcol-1)*COLUMN_SPACE;
+ w= layout->w;
/* create column per column */
for(col=0; col<totcol; col++) {
y= 0;
- itemw= ui_item_fit(1, x, totcol, w, col == totcol-1, UI_FIT_EXPAND);
+ itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*COLUMN_SPACE, col == totcol-1, UI_FIT_EXPAND);
for(item=template->items.first; item; item=item->next) {
if(item->slot != col)
@@ -754,14 +754,14 @@
emy= 0;
miny= 0;
- w= layout->w - totcol*(COLUMN_SPACE);
+ w= layout->w;
emh= toth/totcol;
/* create column per column */
col= 0;
for(item=template->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
- itemw= ui_item_fit(1, x, totcol, w, col == totcol-1, UI_FIT_EXPAND);
+ itemw= ui_item_fit(1, x, totcol, w, (totcol-1)*COLUMN_SPACE, col == totcol-1, UI_FIT_EXPAND);
y -= itemh;
emy -= itemh;
@@ -836,7 +836,7 @@
for(a=0; a<split->number; a++) {
sublayout= split->sublayout[a];
- splitw= ui_item_fit(1, x, split->number, w, a == split->number-1, UI_FIT_EXPAND);
+ splitw= ui_item_fit(1, x, split->number, w, (split->number-1)*COLUMN_SPACE, a == split->number-1, UI_FIT_EXPAND);
sublayout->x= layout->x + x;
sublayout->w= splitw;
sublayout->y= layout->y;
Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_panel_wrap.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_panel_wrap.c 2009-04-16 21:51:20 UTC (rev 19764)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_panel_wrap.c 2009-04-16 21:58:06 UTC (rev 19765)
@@ -237,8 +237,8 @@
pt->py_data= (void *)py_class;
RNA_struct_py_type_set(pt->srna, py_class);
- C= (bContext *)PyCObject_AsVoidPtr(PyDict_GetItemString(PyEval_GetGlobals(), "__bpy_context__"));
- if(C)
+ item= PyDict_GetItemString(PyEval_GetGlobals(), "__bpy_context__");
+ if(item && (C=(bContext *)PyCObject_AsVoidPtr(item)))
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
Py_RETURN_NONE;
More information about the Bf-blender-cvs
mailing list