UI
* Make Directional Order menus the default again. * Scale up contents panels that do not use layout system. * Fix for enum size and uncesseray colon in some cases. * For item_menu_enumO, show icons if specified in RNA in the menu (e.g. in the add modifier menu if there were icons specified).
This commit is contained in:
@@ -2753,7 +2753,7 @@ void uiBlockFlipOrder(uiBlock *block)
|
||||
uiBut *but, *next;
|
||||
float centy, miny=10000, maxy= -10000;
|
||||
|
||||
if(!(U.uiflag & USER_DIRECTIONALORDER))
|
||||
if(U.uiflag & USER_MENUFIXEDORDER)
|
||||
return;
|
||||
|
||||
for(but= block->buttons.first; but; but= but->next) {
|
||||
|
||||
@@ -601,7 +601,7 @@ void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
|
||||
RNA_property_enum_items(&ptr, prop, &item, &totitem);
|
||||
|
||||
for(i=0; i<totitem; i++)
|
||||
uiItemEnumO(layout, NULL, 0, opname, propname, item[i].value);
|
||||
uiItemEnumO(layout, (char*)item[i].name, item[i].icon, opname, propname, item[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,6 +716,8 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA
|
||||
else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
|
||||
if(type == PROP_BOOLEAN && strcmp(name, "") != 0)
|
||||
w += UI_UNIT_X;
|
||||
else if(type == PROP_ENUM)
|
||||
w += UI_UNIT_X/2;
|
||||
}
|
||||
|
||||
*r_w= w;
|
||||
@@ -745,9 +747,11 @@ void uiItemFullR(uiLayout *layout, char *name, int icon, PointerRNA *ptr, Proper
|
||||
if(!icon)
|
||||
icon= RNA_property_ui_icon(prop);
|
||||
|
||||
if(ELEM5(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_ENUM, PROP_POINTER))
|
||||
if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
if(type == PROP_BOOLEAN && len)
|
||||
else if(type == PROP_BOOLEAN && len)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
|
||||
name= ui_item_name_add_colon(name, namestr);
|
||||
|
||||
if(layout->root->type == UI_LAYOUT_MENU) {
|
||||
@@ -1453,9 +1457,9 @@ static void ui_litem_layout_free(uiLayout *litem)
|
||||
totw -= minx;
|
||||
toth -= miny;
|
||||
|
||||
if(litem->w && totw > litem->w)
|
||||
if(litem->w && totw > 0)
|
||||
scalex= (float)litem->w/(float)totw;
|
||||
if(litem->h && toth > litem->h)
|
||||
if(litem->h && toth > 0)
|
||||
scaley= (float)litem->h/(float)toth;
|
||||
|
||||
x= litem->x;
|
||||
@@ -1466,15 +1470,15 @@ static void ui_litem_layout_free(uiLayout *litem)
|
||||
ui_item_size(item, &itemw, &itemh);
|
||||
|
||||
if(scalex != 1.0f) {
|
||||
newx= itemx*scalex;
|
||||
itemw= (itemx + itemw)*scalex - newx;
|
||||
itemx= newx;
|
||||
newx= (itemx - minx)*scalex;
|
||||
itemw= (itemx - minx + itemw)*scalex - newx;
|
||||
itemx= minx + newx;
|
||||
}
|
||||
|
||||
if(scaley != 1.0f) {
|
||||
newy= itemy*scaley;
|
||||
itemh= (itemy + itemh)*scaley - newy;
|
||||
itemy= newy;
|
||||
newy= (itemy - miny)*scaley;
|
||||
itemh= (itemy - miny + itemh)*scaley - newy;
|
||||
itemy= miny + newy;
|
||||
}
|
||||
|
||||
ui_item_position(item, x+itemx-minx, y+itemy-miny, itemw, itemh);
|
||||
|
||||
@@ -1490,3 +1490,4 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ extern UserDef U; /* from blenkernel blender.c */
|
||||
#define USER_ZOOM_TO_MOUSEPOS (1 << 20)
|
||||
#define USER_SHOW_FPS (1 << 21)
|
||||
#define USER_MMB_PASTE (1 << 22)
|
||||
#define USER_DIRECTIONALORDER (1 << 23)
|
||||
#define USER_MENUFIXEDORDER (1 << 23)
|
||||
|
||||
/* Auto-Keying mode */
|
||||
/* AUTOKEY_ON is a bitflag */
|
||||
|
||||
@@ -1505,7 +1505,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox.");
|
||||
|
||||
prop= RNA_def_property(srna, "directional_menus", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DIRECTIONALORDER);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
|
||||
RNA_def_property_ui_text(prop, "Contents Follow Opening Direction", "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction.");
|
||||
|
||||
/* snap to grid */
|
||||
|
||||
Reference in New Issue
Block a user