UI:
* Template slots are no longer specified per item, but are a state now, set with uiTemplateSlot. * Some renaming of Layout functions for consistency. * Fix for roundbox in stack template, now is always behind the other buttons. * Improved python API for layout: http://www.pasteall.org/5008/python
This commit is contained in:
@@ -43,10 +43,12 @@ struct wmOperator;
|
||||
struct AutoComplete;
|
||||
struct bContext;
|
||||
struct Panel;
|
||||
struct PanelType;
|
||||
struct PointerRNA;
|
||||
struct PropertyRNA;
|
||||
struct ReportList;
|
||||
struct rcti;
|
||||
struct uiFontStyle;
|
||||
|
||||
typedef struct uiBut uiBut;
|
||||
typedef struct uiBlock uiBlock;
|
||||
@@ -582,6 +584,7 @@ void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int
|
||||
|
||||
void uiTemplateLeftRight(uiLayout *layout);
|
||||
void uiTemplateColumn(uiLayout *layout);
|
||||
void uiTemplateColumnFlow(uiLayout *layout, int columns);
|
||||
uiLayout *uiTemplateStack(uiLayout *layout);
|
||||
|
||||
/* horizontal header templates */
|
||||
@@ -592,22 +595,24 @@ void uiTemplateHeaderButtons(uiLayout *layout);
|
||||
void uiTemplateHeaderID(uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, uiIDPoinFunc func);
|
||||
void uiTemplateSetColor(uiLayout *layout, int color);
|
||||
|
||||
void uiTemplateSlot(uiLayout *layout, int slot);
|
||||
|
||||
/* items */
|
||||
void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char *opname);
|
||||
void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname);
|
||||
void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, float value);
|
||||
void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, char *value);
|
||||
void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *idname, struct IDProperty *properties, int context);
|
||||
void uiItemO(uiLayout *layout, const char *name, int icon, char *opname);
|
||||
void uiItemEnumO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemsEnumO(uiLayout *layout, char *opname, char *propname);
|
||||
void uiItemBooleanO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemIntO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value);
|
||||
void uiItemFloatO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, float value);
|
||||
void uiItemStringO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, char *value);
|
||||
void uiItemFullO(uiLayout *layout, const char *name, int icon, char *idname, struct IDProperty *properties, int context);
|
||||
|
||||
void uiItemR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname);
|
||||
void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname, int index);
|
||||
void uiItemR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, char *propname);
|
||||
void uiItemFullR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, char *propname, int index);
|
||||
|
||||
void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon);
|
||||
void uiItemL(uiLayout *layout, const char *name, int icon);
|
||||
|
||||
void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCreateFunc func);
|
||||
void uiItemM(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func);
|
||||
|
||||
/* utilities */
|
||||
#define UI_PANEL_WIDTH 340
|
||||
|
||||
@@ -201,7 +201,7 @@ void ui_window_to_region(const ARegion *ar, int *x, int *y)
|
||||
|
||||
/* ******************* block calc ************************* */
|
||||
|
||||
static void ui_block_translate(uiBlock *block, int x, int y)
|
||||
void ui_block_translate(uiBlock *block, int x, int y)
|
||||
{
|
||||
uiBut *bt;
|
||||
|
||||
@@ -2253,8 +2253,6 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
|
||||
but->icon = 0;
|
||||
but->dt= block->dt;
|
||||
|
||||
BLI_addtail(&block->buttons, but);
|
||||
|
||||
but->retval= retval;
|
||||
if( strlen(str)>=UI_MAX_NAME_STR-1 ) {
|
||||
but->str= MEM_callocN( strlen(str)+2, "uiDefBut");
|
||||
@@ -2323,9 +2321,6 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
|
||||
but->flag |= UI_ICON_LEFT;
|
||||
}
|
||||
|
||||
if(but->type==ROUNDBOX)
|
||||
but->flag |= UI_NO_HILITE;
|
||||
|
||||
but->flag |= (block->flag & UI_BUT_ALIGN);
|
||||
if(block->flag & UI_BLOCK_NO_HILITE)
|
||||
but->flag |= UI_NO_HILITE;
|
||||
@@ -2336,6 +2331,13 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
|
||||
}
|
||||
}
|
||||
|
||||
if(but->type == ROUNDBOX) {
|
||||
but->flag |= UI_NO_HILITE;
|
||||
BLI_addhead(&block->buttons, but);
|
||||
}
|
||||
else
|
||||
BLI_addtail(&block->buttons, but);
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,36 +32,65 @@
|
||||
#include "RNA_define.h"
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
static void api_ui_item_common(FunctionRNA *func)
|
||||
{
|
||||
RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item.");
|
||||
RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Override automatic icon of the item.", 0, INT_MAX);
|
||||
}
|
||||
|
||||
void RNA_api_ui_layout(StructRNA *srna)
|
||||
{
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
static EnumPropertyItem slot_items[]= {
|
||||
{0, "DEFAULT", "Default", ""},
|
||||
{UI_TSLOT_COLUMN_1, "COLUMN_1", "Column 1", ""},
|
||||
{UI_TSLOT_COLUMN_2, "COLUMN_2", "Column 2", ""},
|
||||
{UI_TSLOT_COLUMN_3, "COLUMN_3", "Column 3", ""},
|
||||
{UI_TSLOT_COLUMN_4, "COLUMN_4", "Column 4", ""},
|
||||
{UI_TSLOT_COLUMN_5, "COLUMN_5", "Column 5", ""},
|
||||
{UI_TSLOT_LR_LEFT, "LEFT", "Left", ""},
|
||||
{UI_TSLOT_LR_RIGHT, "RIGHT", "Right", ""},
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* templates */
|
||||
func= RNA_def_function(srna, "template_column", "uiTemplateColumn");
|
||||
func= RNA_def_function(srna, "template_left_right", "uiTemplateLeftRight");
|
||||
|
||||
func= RNA_def_function(srna, "template_column_flow", "uiTemplateColumnFlow");
|
||||
parm= RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns.", 0, INT_MAX);
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "template_stack", "uiTemplateStack");
|
||||
parm= RNA_def_pointer(func, "sub_layout", "UILayout", "", "Sub-layout to put stack items in.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "template_header_menus", "uiTemplateHeaderMenus");
|
||||
func= RNA_def_function(srna, "template_header_buttons", "uiTemplateHeaderButtons");
|
||||
//func= RNA_def_function(srna, "template_header_ID", "uiTemplateHeaderID");
|
||||
|
||||
func= RNA_def_function(srna, "template_slot", "uiTemplateSlot");
|
||||
parm= RNA_def_enum(func, "slot", slot_items, 0, "", "Where in the template to put the following items.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
/* items */
|
||||
func= RNA_def_function(srna, "itemR", "uiItemR");
|
||||
RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
|
||||
RNA_def_string(func, "name", "", 0, "", "");
|
||||
RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
|
||||
RNA_def_pointer(func, "data", "AnyType", "", "");
|
||||
RNA_def_string(func, "property", "", 0, "", "");
|
||||
api_ui_item_common(func);
|
||||
parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "itemO", "uiItemO");
|
||||
RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
|
||||
RNA_def_string(func, "name", "", 0, "", "");
|
||||
RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
|
||||
RNA_def_string(func, "operator", "", 0, "", "");
|
||||
api_ui_item_common(func);
|
||||
parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator.");
|
||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||
|
||||
func= RNA_def_function(srna, "itemL", "uiItemLabel");
|
||||
RNA_def_int(func, "slot", 0, 0, 5, "", "", 0, 5);
|
||||
RNA_def_string(func, "name", "", 0, "", "");
|
||||
RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "", 0, INT_MAX);
|
||||
func= RNA_def_function(srna, "itemL", "uiItemL");
|
||||
api_ui_item_common(func);
|
||||
}
|
||||
|
||||
|
||||
@@ -2832,6 +2832,9 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
|
||||
|
||||
for(but=block->buttons.first; but; but= but->next) {
|
||||
/* give precedence to already activated buttons */
|
||||
if(but->flag & UI_NO_HILITE)
|
||||
continue;
|
||||
|
||||
if(ui_but_contains_pt(but, mx, my))
|
||||
if(!butover || (!butover->active && but->active))
|
||||
butover= but;
|
||||
|
||||
@@ -310,6 +310,7 @@ extern int ui_is_but_float(uiBut *but);
|
||||
extern void ui_update_block_buts_hsv(uiBlock *block, float *hsv);
|
||||
|
||||
extern void ui_bounds_block(uiBlock *block);
|
||||
extern void ui_block_translate(uiBlock *block, int x, int y);
|
||||
|
||||
/* interface_regions.c */
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ typedef struct uiItemLMenu {
|
||||
|
||||
typedef enum uiTemplateType {
|
||||
TEMPLATE_COLUMN,
|
||||
TEMPLATE_COLUMN_FLOW,
|
||||
TEMPLATE_LR,
|
||||
TEMPLATE_STACK,
|
||||
|
||||
@@ -108,9 +109,14 @@ typedef struct uiTemplate {
|
||||
uiTemplateType type;
|
||||
|
||||
ListBase items;
|
||||
int color;
|
||||
int color, slot;
|
||||
} uiTemplate;
|
||||
|
||||
typedef struct uiTemplateFlow {
|
||||
uiTemplate template;
|
||||
int columns;
|
||||
} uiTemplateFlow;
|
||||
|
||||
typedef struct uiTemplateStck {
|
||||
uiTemplate template;
|
||||
uiLayout *sublayout;
|
||||
@@ -427,12 +433,14 @@ static void ui_item_free(uiItem *item)
|
||||
}
|
||||
|
||||
/* operator items */
|
||||
void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *idname, IDProperty *properties, int context)
|
||||
void uiItemFullO(uiLayout *layout, const char *name, int icon, char *idname, IDProperty *properties, int context)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
wmOperatorType *ot= WM_operatortype_find(idname);
|
||||
uiItemOp *opitem;
|
||||
|
||||
if(!template)
|
||||
return;
|
||||
if(!ot)
|
||||
return;
|
||||
|
||||
@@ -441,7 +449,7 @@ void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *i
|
||||
opitem->item.name= name;
|
||||
opitem->item.icon= icon;
|
||||
opitem->item.type= ITEM_OPERATOR;
|
||||
opitem->item.slot= slot;
|
||||
opitem->item.slot= template->slot;
|
||||
|
||||
opitem->ot= ot;
|
||||
opitem->properties= properties;
|
||||
@@ -450,17 +458,17 @@ void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *i
|
||||
BLI_addtail(&template->items, opitem);
|
||||
}
|
||||
|
||||
void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
|
||||
void uiItemEnumO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create(&ptr, opname);
|
||||
RNA_enum_set(&ptr, propname, value);
|
||||
|
||||
uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, ptr.data, layout->opcontext);
|
||||
}
|
||||
|
||||
void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname)
|
||||
void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
|
||||
{
|
||||
wmOperatorType *ot= WM_operatortype_find(opname);
|
||||
PointerRNA ptr;
|
||||
@@ -479,65 +487,70 @@ void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname)
|
||||
RNA_property_enum_items(&ptr, prop, &item, &totitem);
|
||||
|
||||
for(i=0; i<totitem; i++)
|
||||
uiItemEnumO(layout, slot, "", 0, opname, propname, item[i].value);
|
||||
uiItemEnumO(layout, "", 0, opname, propname, item[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
|
||||
void uiItemBooleanO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create(&ptr, opname);
|
||||
RNA_boolean_set(&ptr, propname, value);
|
||||
|
||||
uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, ptr.data, layout->opcontext);
|
||||
}
|
||||
|
||||
void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value)
|
||||
void uiItemIntO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create(&ptr, opname);
|
||||
RNA_int_set(&ptr, propname, value);
|
||||
|
||||
uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, ptr.data, layout->opcontext);
|
||||
}
|
||||
|
||||
void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, float value)
|
||||
void uiItemFloatO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, float value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create(&ptr, opname);
|
||||
RNA_float_set(&ptr, propname, value);
|
||||
|
||||
uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, ptr.data, layout->opcontext);
|
||||
}
|
||||
|
||||
void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, char *value)
|
||||
void uiItemStringO(uiLayout *layout, const char *name, int icon, char *opname, char *propname, char *value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create(&ptr, opname);
|
||||
RNA_string_set(&ptr, propname, value);
|
||||
|
||||
uiItemFullO(layout, slot, name, icon, opname, ptr.data, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, ptr.data, layout->opcontext);
|
||||
}
|
||||
|
||||
void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char *opname)
|
||||
void uiItemO(uiLayout *layout, const char *name, int icon, char *opname)
|
||||
{
|
||||
uiItemFullO(layout, slot, name, icon, opname, NULL, layout->opcontext);
|
||||
uiItemFullO(layout, name, icon, opname, NULL, layout->opcontext);
|
||||
}
|
||||
|
||||
/* RNA property items */
|
||||
void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, PointerRNA *ptr, char *propname, int index)
|
||||
void uiItemFullR(uiLayout *layout, const char *name, int icon, PointerRNA *ptr, char *propname, int index)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
PropertyRNA *prop;
|
||||
uiItemRNA *rnaitem;
|
||||
|
||||
if(!ptr->data)
|
||||
return;
|
||||
if(!template)
|
||||
return;
|
||||
|
||||
prop= RNA_struct_find_property(ptr, propname);
|
||||
if(!prop){
|
||||
printf("Property not found : %s \n",propname);
|
||||
printf("uiItemR: property not found: %s\n",propname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -546,7 +559,7 @@ void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, Pointer
|
||||
rnaitem->item.name= name;
|
||||
rnaitem->item.icon= icon;
|
||||
rnaitem->item.type= ITEM_RNA_PROPERTY;
|
||||
rnaitem->item.slot= slot;
|
||||
rnaitem->item.slot= template->slot;
|
||||
|
||||
rnaitem->ptr= *ptr;
|
||||
rnaitem->prop= prop;
|
||||
@@ -555,21 +568,26 @@ void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, Pointer
|
||||
BLI_addtail(&template->items, rnaitem);
|
||||
}
|
||||
|
||||
void uiItemR(uiLayout *layout, int slot, const char *name, int icon, PointerRNA *ptr, char *propname)
|
||||
void uiItemR(uiLayout *layout, const char *name, int icon, PointerRNA *ptr, char *propname)
|
||||
{
|
||||
uiItemFullR(layout, slot, name, icon, ptr, propname, RNA_NO_INDEX);
|
||||
uiItemFullR(layout, name, icon, ptr, propname, RNA_NO_INDEX);
|
||||
}
|
||||
|
||||
/* menu item */
|
||||
void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCreateFunc func)
|
||||
void uiItemM(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
uiItemLMenu *menuitem= MEM_callocN(sizeof(uiItemLMenu), "uiItemLMenu");
|
||||
uiItemLMenu *menuitem;
|
||||
|
||||
if(!template)
|
||||
return;
|
||||
|
||||
menuitem= MEM_callocN(sizeof(uiItemLMenu), "uiItemLMenu");
|
||||
|
||||
menuitem->item.name= name;
|
||||
menuitem->item.icon= icon;
|
||||
menuitem->item.type= ITEM_MENU;
|
||||
menuitem->item.slot= slot;
|
||||
menuitem->item.slot= template->slot;
|
||||
|
||||
menuitem->func= func;
|
||||
|
||||
@@ -577,15 +595,20 @@ void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCr
|
||||
}
|
||||
|
||||
/* label item */
|
||||
void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon)
|
||||
void uiItemL(uiLayout *layout, const char *name, int icon)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
uiItem *item= MEM_callocN(sizeof(uiItem), "uiItem");
|
||||
uiItem *item;
|
||||
|
||||
if(!template)
|
||||
return;
|
||||
|
||||
item= MEM_callocN(sizeof(uiItem), "uiItem");
|
||||
|
||||
item->name= name;
|
||||
item->icon= icon;
|
||||
item->type= ITEM_LABEL;
|
||||
item->slot= slot;
|
||||
item->slot= template->slot;
|
||||
|
||||
BLI_addtail(&template->items, item);
|
||||
}
|
||||
@@ -630,6 +653,62 @@ static void ui_layout_column(uiLayout *layout, uiBlock *block, uiTemplate *templ
|
||||
*y= miny;
|
||||
}
|
||||
|
||||
/* multi-column layout, automatically flowing to the next */
|
||||
static void ui_layout_column_flow(uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
|
||||
{
|
||||
uiTemplateFlow *flow= (uiTemplateFlow*)template;
|
||||
uiItem *item;
|
||||
int col, colx, coly, colw, colh, miny, itemw, itemh, maxw=0;
|
||||
int toth, totcol, totitem;
|
||||
|
||||
/* compute max needed width and total height */
|
||||
toth= 0;
|
||||
totitem= 0;
|
||||
for(item=template->items.first; item; item=item->next) {
|
||||
ui_item_size(item, &itemw, &itemh);
|
||||
maxw= MAX2(maxw, itemw);
|
||||
toth += itemh + BUTTON_SPACE_Y;
|
||||
totitem++;
|
||||
}
|
||||
|
||||
if(flow->columns <= 0) {
|
||||
/* auto compute number of columns, not very good */
|
||||
if(maxw == 0)
|
||||
return;
|
||||
|
||||
totcol= MIN2(w/maxw, 1);
|
||||
totcol= MAX2(totcol, totitem);
|
||||
}
|
||||
else
|
||||
totcol= flow->columns;
|
||||
|
||||
/* compute sizes */
|
||||
colx= *x;
|
||||
coly= *y;
|
||||
colw= (w - (totcol-1)*COLUMN_SPACE)/totcol;
|
||||
colh= toth/totcol;
|
||||
miny= *y;
|
||||
|
||||
/* create column per column */
|
||||
col= 0;
|
||||
for(item=template->items.first; item; item=item->next) {
|
||||
ui_item_size(item, &itemw, &itemh);
|
||||
|
||||
coly -= itemh + BUTTON_SPACE_Y;
|
||||
ui_item_buts(block, item, colx, coly, colw, itemh);
|
||||
|
||||
miny= MIN2(miny, coly);
|
||||
|
||||
if(coly <= *y - colh && col < totcol) {
|
||||
colx += colw + COLUMN_SPACE;
|
||||
coly= *y;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
*y= miny;
|
||||
}
|
||||
|
||||
/* left-right layout, with buttons aligned on both sides */
|
||||
static void ui_layout_lr(uiLayout *layout, uiBlock *block, uiTemplate *template, int *x, int *y, int w, int h)
|
||||
{
|
||||
@@ -756,6 +835,15 @@ void uiTemplateColumn(uiLayout *layout)
|
||||
BLI_addtail(&layout->templates, template);
|
||||
}
|
||||
|
||||
void uiTemplateColumnFlow(uiLayout *layout, int columns)
|
||||
{
|
||||
uiTemplateFlow *flow;
|
||||
|
||||
flow= MEM_callocN(sizeof(uiTemplateFlow), "uiTemplateFlow");
|
||||
flow->template.type= TEMPLATE_COLUMN_FLOW;
|
||||
flow->columns= columns;
|
||||
BLI_addtail(&layout->templates, flow);
|
||||
}
|
||||
|
||||
void uiTemplateLeftRight(uiLayout *layout)
|
||||
{
|
||||
@@ -817,7 +905,16 @@ void uiTemplateSetColor(uiLayout *layout, int color)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
|
||||
template->color= color;
|
||||
if(template)
|
||||
template->color= color;
|
||||
}
|
||||
|
||||
void uiTemplateSlot(uiLayout *layout, int slot)
|
||||
{
|
||||
uiTemplate *template= layout->templates.last;
|
||||
|
||||
if(template)
|
||||
template->slot= slot;
|
||||
}
|
||||
|
||||
/********************** Layout *******************/
|
||||
@@ -837,6 +934,9 @@ static void ui_layout_templates(const bContext *C, uiBlock *block, uiLayout *lay
|
||||
case TEMPLATE_COLUMN:
|
||||
ui_layout_column(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
|
||||
break;
|
||||
case TEMPLATE_COLUMN_FLOW:
|
||||
ui_layout_column_flow(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
|
||||
break;
|
||||
case TEMPLATE_LR:
|
||||
ui_layout_lr(layout, block, template, &layout->x, &layout->y, layout->w, layout->h);
|
||||
break;
|
||||
|
||||
@@ -300,7 +300,7 @@ int uiDefAutoButsRNA(const bContext *C, uiBlock *block, PointerRNA *ptr)
|
||||
layout= uiLayoutBegin(UI_LAYOUT_VERTICAL, x, y, DEF_BUT_WIDTH*2, 0);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, (char*)RNA_struct_ui_name(ptr), 0);
|
||||
uiItemL(layout, (char*)RNA_struct_ui_name(ptr), 0);
|
||||
|
||||
iterprop= RNA_struct_iterator_property(ptr);
|
||||
RNA_property_collection_begin(ptr, iterprop, &iter);
|
||||
@@ -314,8 +314,10 @@ int uiDefAutoButsRNA(const bContext *C, uiBlock *block, PointerRNA *ptr)
|
||||
uiTemplateColumn(layout);
|
||||
|
||||
name= (char*)RNA_property_ui_name(ptr, prop);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, name, 0);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "", 0, ptr, (char*)RNA_property_identifier(ptr, prop));
|
||||
uiTemplateSlot(layout, UI_TSLOT_COLUMN_1);
|
||||
uiItemL(layout, name, 0);
|
||||
uiTemplateSlot(layout, UI_TSLOT_COLUMN_2);
|
||||
uiItemR(layout, "", 0, ptr, (char*)RNA_property_identifier(ptr, prop));
|
||||
}
|
||||
|
||||
RNA_property_collection_end(&iter);
|
||||
|
||||
@@ -59,10 +59,10 @@ static void object_panel_transform(const bContext *C, Panel *pnl)
|
||||
|
||||
RNA_id_pointer_create(&ob->id, &obptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "location");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &obptr, "rotation");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_3, NULL, 0, &obptr, "scale");
|
||||
uiTemplateColumnFlow(layout, 3);
|
||||
uiItemR(layout, NULL, 0, &obptr, "location");
|
||||
uiItemR(layout, NULL, 0, &obptr, "rotation");
|
||||
uiItemR(layout, NULL, 0, &obptr, "scale");
|
||||
}
|
||||
|
||||
static void object_panel_groups(const bContext *C, Panel *pnl)
|
||||
@@ -76,12 +76,12 @@ static void object_panel_groups(const bContext *C, Panel *pnl)
|
||||
|
||||
RNA_id_pointer_create(&ob->id, &obptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "pass_index");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &obptr, "parent");
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, NULL, 0, &obptr, "pass_index");
|
||||
uiItemR(layout, NULL, 0, &obptr, "parent");
|
||||
|
||||
/* uiTemplateLeftRight(layout);
|
||||
uiItemO(layout, UI_TSLOT_LR_LEFT, NULL, 0, "OBJECT_OT_add_group"); */
|
||||
uiItemO(layout, NULL, 0, "OBJECT_OT_add_group"); */
|
||||
|
||||
for(group=bmain->group.first; group; group=group->id.next) {
|
||||
if(object_in_group(ob, group)) {
|
||||
@@ -90,12 +90,14 @@ static void object_panel_groups(const bContext *C, Panel *pnl)
|
||||
sublayout= uiTemplateStack(layout);
|
||||
|
||||
uiTemplateLeftRight(sublayout);
|
||||
uiItemR(sublayout, UI_TSLOT_LR_LEFT, NULL, 0, &groupptr, "name");
|
||||
// uiItemO(sublayout, UI_TSLOT_LR_RIGHT, "", ICON_X, "OBJECT_OT_remove_group");
|
||||
uiTemplateSlot(sublayout, UI_TSLOT_LR_LEFT);
|
||||
uiItemR(sublayout, NULL, 0, &groupptr, "name");
|
||||
// uiTemplateSlot(sublayout, UI_TSLOT_RIGHT);
|
||||
// uiItemO(sublayout, "", ICON_X, "OBJECT_OT_remove_group");
|
||||
|
||||
uiTemplateColumn(sublayout);
|
||||
uiItemR(sublayout, UI_TSLOT_COLUMN_1, NULL, 0, &groupptr, "layer");
|
||||
uiItemR(sublayout, UI_TSLOT_COLUMN_2, NULL, 0, &groupptr, "dupli_offset");
|
||||
uiTemplateColumnFlow(sublayout, 2);
|
||||
uiItemR(sublayout, NULL, 0, &groupptr, "layer");
|
||||
uiItemR(sublayout, NULL, 0, &groupptr, "dupli_offset");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,19 +110,17 @@ static void object_panel_display(const bContext *C, Panel *pnl)
|
||||
|
||||
RNA_id_pointer_create(&ob->id, &obptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Type", 0, &obptr, "max_draw_type");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Bounds", 0, &obptr, "draw_bounds_type");
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Type", 0, &obptr, "max_draw_type");
|
||||
uiItemR(layout, "Bounds", 0, &obptr, "draw_bounds_type");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Extra", 0);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Name", 0, &obptr, "draw_name");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Axis", 0, &obptr, "draw_axis");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Wire", 0, &obptr, "draw_wire");
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_2, "", 0);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Texture Space", 0, &obptr, "draw_texture_space");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "X-Ray", 0, &obptr, "x_ray");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Transparency", 0, &obptr, "draw_transparent");
|
||||
uiTemplateColumnFlow(layout , 2);
|
||||
uiItemR(layout, "Name", 0, &obptr, "draw_name");
|
||||
uiItemR(layout, "Axis", 0, &obptr, "draw_axis");
|
||||
uiItemR(layout, "Wire", 0, &obptr, "draw_wire");
|
||||
uiItemR(layout, "Texture Space", 0, &obptr, "draw_texture_space");
|
||||
uiItemR(layout, "X-Ray", 0, &obptr, "x_ray");
|
||||
uiItemR(layout, "Transparency", 0, &obptr, "draw_transparent");
|
||||
}
|
||||
|
||||
static void object_panel_duplication(const bContext *C, Panel *pnl)
|
||||
@@ -132,18 +132,15 @@ static void object_panel_duplication(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&ob->id, &obptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Frames", 0, &obptr, "dupli_frames");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Verts", 0, &obptr, "dupli_verts");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_3, "Faces", 0, &obptr, "dupli_faces");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_4, "Group", 0, &obptr, "use_dupli_group");
|
||||
uiItemR(layout, "", 0, &obptr, "dupli_type");
|
||||
|
||||
if(RNA_boolean_get(&obptr, "dupli_frames")) {
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Start:", 0, &obptr, "dupli_frames_start");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "End:", 0, &obptr, "dupli_frames_end");
|
||||
if(RNA_enum_get(&obptr, "dupli_type") == OB_DUPLIFRAMES) {
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Start:", 0, &obptr, "dupli_frames_start");
|
||||
uiItemR(layout, "End:", 0, &obptr, "dupli_frames_end");
|
||||
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "On:", 0, &obptr, "dupli_frames_on");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Off:", 0, &obptr, "dupli_frames_off");
|
||||
uiItemR(layout, "On:", 0, &obptr, "dupli_frames_on");
|
||||
uiItemR(layout, "Off:", 0, &obptr, "dupli_frames_off");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,17 +153,18 @@ static void object_panel_animation(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&ob->id, &obptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Time Offset:", 0);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Edit", 0, &obptr, "time_offset_edit");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Particle", 0, &obptr, "time_offset_particle");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Parent", 0, &obptr, "time_offset_parent");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &obptr, "slow_parent");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Offset: ", 0, &obptr, "time_offset");
|
||||
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_2, "Tracking:", 0);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Axis: ", 0, &obptr, "track_axis");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Up Axis: ", 0, &obptr, "up_axis");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Rotation", 0, &obptr, "track_rotation");
|
||||
uiTemplateSlot(layout, UI_TSLOT_COLUMN_1);
|
||||
uiItemL(layout, "Time Offset:", 0);
|
||||
uiItemR(layout, "Edit", 0, &obptr, "time_offset_edit");
|
||||
uiItemR(layout, "Particle", 0, &obptr, "time_offset_particle");
|
||||
uiItemR(layout, "Parent", 0, &obptr, "time_offset_parent");
|
||||
uiItemR(layout, NULL, 0, &obptr, "slow_parent");
|
||||
uiItemR(layout, "Offset: ", 0, &obptr, "time_offset");
|
||||
uiTemplateSlot(layout, UI_TSLOT_COLUMN_2);
|
||||
uiItemL(layout, "Tracking:", 0);
|
||||
uiItemR(layout, "Axis: ", 0, &obptr, "track_axis");
|
||||
uiItemR(layout, "Up Axis: ", 0, &obptr, "up_axis");
|
||||
uiItemR(layout, "Rotation", 0, &obptr, "track_rotation");
|
||||
}
|
||||
|
||||
void buttons_object_register(ARegionType *art)
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#define R_DISPLAYWIN 1
|
||||
#define R_DISPLAYSCREEN 2
|
||||
|
||||
#if 0
|
||||
static void render_panel_output(const bContext *C, ARegion *ar)
|
||||
{
|
||||
uiBlock *block;
|
||||
@@ -149,7 +150,9 @@ static void render_panel_output(const bContext *C, ARegion *ar)
|
||||
|
||||
uiEndBlock(C, block);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void do_bake_func(bContext *C, void *unused_v, void *unused_p)
|
||||
{
|
||||
//XXX objects_bake_render_ui(0);
|
||||
@@ -211,6 +214,8 @@ static void render_panel_bake(const bContext *C, ARegion *ar)
|
||||
|
||||
uiEndBlock(C, block);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void render_panel_shading(const bContext *C, Panel *pnl)
|
||||
{
|
||||
uiLayout *layout= pnl->layout;
|
||||
@@ -220,22 +225,16 @@ static void render_panel_shading(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
renderptr = RNA_pointer_get(&sceneptr, "render_data");
|
||||
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Shadow", 0, &renderptr, "render_shadows");
|
||||
uiItemR(layout, "SSS", 0, &renderptr, "render_sss");
|
||||
uiItemR(layout, "EnvMap", 0, &renderptr, "render_envmaps");
|
||||
uiItemR(layout, "Radio", 0, &renderptr, "render_radiosity");
|
||||
uiItemR(layout, "Ray Tracing", 0, &renderptr, "render_raytracing");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "octree_resolution");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Shadow", 0, &renderptr, "render_shadows");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "SSS", 0, &renderptr, "render_sss");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_3, "EnvMap", 0, &renderptr, "render_envmaps");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_4, "Radio", 0, &renderptr, "render_radiosity");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Ray Tracing:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "render_raytracing");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "octree_resolution");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Alpha:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "alpha_mode");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "alpha_mode");
|
||||
|
||||
}
|
||||
static void render_panel_image(const bContext *C, Panel *pnl)
|
||||
@@ -247,13 +246,14 @@ static void render_panel_image(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
renderptr = RNA_pointer_get(&sceneptr, "render_data");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "SizeX", 0, &renderptr, "resolution_x");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "SizeY", 0, &renderptr, "resolution_y");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "AspX", 0, &renderptr, "pixel_aspect_x");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "AspY", 0, &renderptr, "pixel_aspect_y");
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "SizeX", 0, &renderptr, "resolution_x");
|
||||
uiItemR(layout, "SizeY", 0, &renderptr, "resolution_y");
|
||||
uiItemR(layout, "AspX", 0, &renderptr, "pixel_aspect_x");
|
||||
uiItemR(layout, "AspY", 0, &renderptr, "pixel_aspect_y");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "crop_to_border");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "crop_to_border");
|
||||
|
||||
}
|
||||
static void render_panel_antialiasing(const bContext *C, Panel *pnl)
|
||||
@@ -265,11 +265,11 @@ static void render_panel_antialiasing(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
renderptr = RNA_pointer_get(&sceneptr, "render_data");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "antialiasing");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Num Samples", 0, &renderptr, "antialiasing_samples");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "pixel_filter");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "filter_size");
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Enable", 0, &renderptr, "antialiasing");
|
||||
uiItemR(layout, "Samples", 0, &renderptr, "antialiasing_samples");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "pixel_filter");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "filter_size");
|
||||
|
||||
}
|
||||
|
||||
@@ -282,49 +282,45 @@ static void render_panel_render(const bContext *C, Panel *pnl)
|
||||
RNA_id_pointer_create(&scene->id, &sceneptr);
|
||||
renderptr = RNA_pointer_get(&sceneptr, "render_data");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemO(layout, UI_TSLOT_COLUMN_1, "RENDER", ICON_SCENE, "SCREEN_OT_render");
|
||||
uiItemBooleanO(layout, UI_TSLOT_COLUMN_2, "ANIM", 0, "SCREEN_OT_render", "anim", 1);
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemO(layout, "RENDER", ICON_SCENE, "SCREEN_OT_render");
|
||||
uiItemBooleanO(layout, "ANIM", 0, "SCREEN_OT_render", "anim", 1);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Sfra", 0, &sceneptr, "start_frame");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "Cfra", 0, &sceneptr, "current_frame");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_3, "Efra", 0, &sceneptr, "end_frame");
|
||||
uiTemplateColumnFlow(layout, 3);
|
||||
uiItemR(layout, "Start", 0, &sceneptr, "start_frame");
|
||||
uiItemR(layout, "End", 0, &sceneptr, "end_frame");
|
||||
uiItemR(layout, "Frame", 0, &sceneptr, "current_frame");
|
||||
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, NULL, 0, &renderptr, "do_composite");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "do_sequence");
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "do_composite");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "do_sequence");
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Camera:", 0, &sceneptr, "camera");
|
||||
uiItemR(layout, "Camera:", 0, &sceneptr, "camera");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "General:", 0);
|
||||
uiItemL(layout, "General:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Size ", 0, &renderptr, "resolution_percentage");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "dither_intensity");
|
||||
uiItemR(layout, "Size ", 0, &renderptr, "resolution_percentage");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "dither_intensity");
|
||||
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, NULL, 0, &renderptr, "parts_x");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "parts_y");
|
||||
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, NULL, 0, &renderptr, "threads");
|
||||
uiItemR(layout, "", 0, &renderptr, "threads_mode");
|
||||
|
||||
uiTemplateColumnFlow(layout, 3);
|
||||
uiItemR(layout, "Fields", 0, &renderptr, "fields");
|
||||
uiItemR(layout, "Order", 0, &renderptr, "field_order");
|
||||
uiItemR(layout, "Still", 0, &renderptr, "fields_still");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "parts_x");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "parts_y");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Multi-Threading:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "threads_mode");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "threads");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Fields:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "fields");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "field_order");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_3, NULL, 0, &renderptr, "fields_still");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Extra:", 0);
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Border Render", 0, &renderptr, "border");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "panorama");
|
||||
uiItemL(layout, "Extra:", 0);
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Border Render", 0, &renderptr, "border");
|
||||
uiItemR(layout, NULL, 0, &renderptr, "panorama");
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -367,23 +367,23 @@ static void text_header_draw(const bContext *C, uiLayout *layout)
|
||||
RNA_pointer_create(&sc->id, &RNA_SpaceTextEditor, st, &spaceptr);
|
||||
|
||||
uiTemplateHeaderMenus(layout);
|
||||
uiItemMenu(layout, UI_TSLOT_HEADER, "Text", 0, text_filemenu);
|
||||
uiItemM(layout, "Text", 0, text_filemenu);
|
||||
if(text) {
|
||||
uiItemMenu(layout, UI_TSLOT_HEADER, "Edit", 0, text_editmenu);
|
||||
uiItemMenu(layout, UI_TSLOT_HEADER, "Format", 0, text_formatmenu);
|
||||
uiItemM(layout, "Edit", 0, text_editmenu);
|
||||
uiItemM(layout, "Format", 0, text_formatmenu);
|
||||
}
|
||||
|
||||
/* warning button if text is out of date */
|
||||
if(text && text_file_modified(text)) {
|
||||
uiTemplateHeaderButtons(layout);
|
||||
uiTemplateSetColor(layout, TH_REDALERT);
|
||||
uiItemO(layout, UI_TSLOT_HEADER, "", ICON_HELP, "TEXT_OT_resolve_conflict");
|
||||
uiItemO(layout, "", ICON_HELP, "TEXT_OT_resolve_conflict");
|
||||
}
|
||||
|
||||
uiTemplateHeaderButtons(layout);
|
||||
uiItemR(layout, UI_TSLOT_HEADER, "", ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
|
||||
uiItemR(layout, UI_TSLOT_HEADER, "", ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
|
||||
uiItemR(layout, UI_TSLOT_HEADER, "", ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
|
||||
uiItemR(layout, "", ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
|
||||
uiItemR(layout, "", ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
|
||||
uiItemR(layout, "", ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
|
||||
// XXX uiItemR(layout, "", ICON_SCRIPTPLUGINS, &spaceptr, "do_python_plugins");
|
||||
|
||||
uiTemplateHeaderID(layout, &spaceptr, "text",
|
||||
@@ -411,7 +411,7 @@ static void text_header_draw(const bContext *C, uiLayout *layout)
|
||||
sprintf(headtxt, text->id.lib? "Text: External": "Text: Internal");
|
||||
|
||||
uiTemplateHeaderButtons(layout);
|
||||
uiItemLabel(layout, UI_TSLOT_HEADER, headtxt, 0);
|
||||
uiItemL(layout, headtxt, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,13 +439,13 @@ static void text_properties_panel_draw(const bContext *C, Panel *panel)
|
||||
RNA_pointer_create(&sc->id, &RNA_SpaceTextEditor, st, &spaceptr);
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
|
||||
uiItemR(layout, NULL, ICON_LINENUMBERS_OFF, &spaceptr, "line_numbers");
|
||||
uiItemR(layout, NULL, ICON_WORDWRAP_OFF, &spaceptr, "word_wrap");
|
||||
uiItemR(layout, NULL, ICON_SYNTAX_OFF, &spaceptr, "syntax_highlight");
|
||||
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &spaceptr, "font_size");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &spaceptr, "tab_width");
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "font_size");
|
||||
uiItemR(layout, NULL, 0, &spaceptr, "tab_width");
|
||||
}
|
||||
|
||||
static void text_find_panel_draw(const bContext *C, Panel *panel)
|
||||
@@ -459,26 +459,30 @@ static void text_find_panel_draw(const bContext *C, Panel *panel)
|
||||
|
||||
/* find */
|
||||
uiTemplateLeftRight(layout);
|
||||
uiItemR(layout, UI_TSLOT_LR_LEFT, "", 0, &spaceptr, "find_text");
|
||||
uiItemO(layout, UI_TSLOT_LR_RIGHT, "", ICON_TEXT, "TEXT_OT_find_set_selected");
|
||||
uiTemplateSlot(layout, UI_TSLOT_LR_LEFT);
|
||||
uiItemR(layout, "", 0, &spaceptr, "find_text");
|
||||
uiTemplateSlot(layout, UI_TSLOT_LR_RIGHT);
|
||||
uiItemO(layout, "", ICON_TEXT, "TEXT_OT_find_set_selected");
|
||||
uiTemplateColumn(layout);
|
||||
uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_find");
|
||||
uiItemO(layout, NULL, 0, "TEXT_OT_find");
|
||||
|
||||
/* replace */
|
||||
uiTemplateLeftRight(layout);
|
||||
uiItemR(layout, UI_TSLOT_LR_LEFT, "", 0, &spaceptr, "replace_text");
|
||||
uiItemO(layout, UI_TSLOT_LR_RIGHT, "", ICON_TEXT, "TEXT_OT_replace_set_selected");
|
||||
uiTemplateSlot(layout, UI_TSLOT_LR_LEFT);
|
||||
uiItemR(layout, "", 0, &spaceptr, "replace_text");
|
||||
uiTemplateSlot(layout, UI_TSLOT_LR_RIGHT);
|
||||
uiItemO(layout, "", ICON_TEXT, "TEXT_OT_replace_set_selected");
|
||||
uiTemplateColumn(layout);
|
||||
uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_replace");
|
||||
uiItemO(layout, NULL, 0, "TEXT_OT_replace");
|
||||
|
||||
/* mark */
|
||||
uiTemplateColumn(layout);
|
||||
uiItemO(layout, UI_TSLOT_COLUMN_1, NULL, 0, "TEXT_OT_mark_all");
|
||||
uiItemO(layout, NULL, 0, "TEXT_OT_mark_all");
|
||||
|
||||
/* settings */
|
||||
uiTemplateColumn(layout);
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_1, "Wrap", 0, &spaceptr, "find_wrap");
|
||||
uiItemR(layout, UI_TSLOT_COLUMN_2, "All", 0, &spaceptr, "find_all");
|
||||
uiTemplateColumnFlow(layout, 2);
|
||||
uiItemR(layout, "Wrap", 0, &spaceptr, "find_wrap");
|
||||
uiItemR(layout, "All", 0, &spaceptr, "find_all");
|
||||
}
|
||||
|
||||
void text_properties_register(ARegionType *art)
|
||||
|
||||
Reference in New Issue
Block a user