* Added SCROLL button type, use like a NUMSLI basically, with
  a1 used to define the scroller size.
* Add scroll and toggle colors to the Theme (toggle was set to
  draw like radio in a recent commit, but it's the intention
  these look different).
* Added rudimentary list template, used for object material
  slots, this is WIP though.
* In popup menu, split text with line breaks over multiple
  lines, makes python errors display slightly nicer.
This commit is contained in:
Brecht Van Lommel 2009-06-24 14:16:56 +00:00
parent a379fdd7fb
commit 5b26f520bb
13 changed files with 378 additions and 27 deletions

@ -48,4 +48,32 @@ class DATA_PT_mesh(DataButtonsPanel):
layout.itemR(mesh, "texco_mesh") layout.itemR(mesh, "texco_mesh")
class DATA_PT_materials(DataButtonsPanel):
__idname__ = "DATA_PT_materials"
__label__ = "Materials"
def poll(self, context):
return (context.object and context.object.type in ('MESH', 'CURVE', 'FONT', 'SURFACE'))
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.template_list(ob, "materials", "active_material_index", items=10)
col = row.column(align=True)
col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
row = layout.row(align=True)
row.itemO("OBJECT_OT_material_slot_assign", text="Assign");
row.itemO("OBJECT_OT_material_slot_select", text="Select");
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect");
bpy.types.register(DATA_PT_mesh) bpy.types.register(DATA_PT_mesh)
bpy.types.register(DATA_PT_materials)

@ -1,10 +1,6 @@
import bpy import bpy
# temporary
ICON_TEXT = 120
ICON_HELP = 1
class TEXT_HT_header(bpy.types.Header): class TEXT_HT_header(bpy.types.Header):
__space_type__ = "TEXT_EDITOR" __space_type__ = "TEXT_EDITOR"
__idname__ = "TEXT_HT_header" __idname__ = "TEXT_HT_header"

@ -617,6 +617,7 @@ void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type); void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname);
void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser); void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
void uiTemplateList(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *activeprop, int items);
/* items */ /* items */
void uiItemO(uiLayout *layout, char *name, int icon, char *opname); void uiItemO(uiLayout *layout, char *name, int icon, char *opname);

@ -746,11 +746,8 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
ui_apply_but_ROW(C, block, but, data); ui_apply_but_ROW(C, block, but, data);
break; break;
case SCROLL: case SCROLL:
break;
case NUM: case NUM:
case NUMABS: case NUMABS:
ui_apply_but_NUM(C, but, data);
break;
case SLI: case SLI:
case NUMSLI: case NUMSLI:
ui_apply_but_NUM(C, but, data); ui_apply_but_NUM(C, but, data);
@ -2061,6 +2058,11 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0*but->aspect); if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0*but->aspect);
else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2 - 5.0*but->aspect); else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2 - 5.0*but->aspect);
else if(but->type==SCROLL) {
int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1);
deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1);
}
else deler= (but->x2-but->x1- 5.0*but->aspect); else deler= (but->x2-but->x1- 5.0*but->aspect);
f= (float)(mx-data->dragstartx)/deler + data->dragfstart; f= (float)(mx-data->dragstartx)/deler + data->dragfstart;
@ -2231,6 +2233,54 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
return retval; return retval;
} }
static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
int mx, my, click= 0;
int retval= WM_UI_HANDLER_CONTINUE;
int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
mx= event->x;
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(event->val==KM_PRESS) {
if(event->type == LEFTMOUSE) {
if(horizontal) {
data->dragstartx= mx;
data->draglastx= mx;
}
else {
data->dragstartx= my;
data->draglastx= my;
}
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
retval= WM_UI_HANDLER_BREAK;
}
else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
click= 1;
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
if(event->type == ESCKEY) {
data->cancel= 1;
data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
else if(event->type == MOUSEMOVE) {
if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
ui_numedit_apply(C, block, but, data);
}
retval= WM_UI_HANDLER_BREAK;
}
return retval;
}
static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{ {
@ -3073,13 +3123,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
case OPTIONN: case OPTIONN:
retval= ui_do_but_TOG(C, but, data, event); retval= ui_do_but_TOG(C, but, data, event);
break; break;
#if 0
case SCROLL: case SCROLL:
/* DrawBut(b, 1); */ retval= ui_do_but_SCROLL(C, block, but, data, event);
/* do_scrollbut(b); */
/* DrawBut(b,0); */
break; break;
#endif
case NUM: case NUM:
case NUMABS: case NUMABS:
retval= ui_do_but_NUM(C, block, but, data, event); retval= ui_do_but_NUM(C, block, but, data, event);

@ -50,6 +50,9 @@ struct bContextStore;
/* visual types for drawing */ /* visual types for drawing */
/* for time being separated from functional types */ /* for time being separated from functional types */
typedef enum { typedef enum {
/* default */
UI_WTYPE_REGULAR,
/* standard set */ /* standard set */
UI_WTYPE_LABEL, UI_WTYPE_LABEL,
UI_WTYPE_TOGGLE, UI_WTYPE_TOGGLE,
@ -78,7 +81,8 @@ typedef enum {
UI_WTYPE_SWATCH, UI_WTYPE_SWATCH,
UI_WTYPE_RGB_PICKER, UI_WTYPE_RGB_PICKER,
UI_WTYPE_NORMAL, UI_WTYPE_NORMAL,
UI_WTYPE_BOX UI_WTYPE_BOX,
UI_WTYPE_SCROLL
} uiWidgetTypeEnum; } uiWidgetTypeEnum;

@ -1271,7 +1271,6 @@ static void ui_litem_layout_box(uiLayout *litem)
h= litem->h; h= litem->h;
litem->x += style->boxspace; litem->x += style->boxspace;
litem->y -= style->boxspace;
if(w != 0) litem->w -= 2*style->boxspace; if(w != 0) litem->w -= 2*style->boxspace;
if(h != 0) litem->h -= 2*style->boxspace; if(h != 0) litem->h -= 2*style->boxspace;
@ -1352,6 +1351,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
} }
} }
litem->w= x;
litem->h= litem->y - miny; litem->h= litem->y - miny;
} }

@ -181,7 +181,7 @@ MenuData *decompose_menu_string(char *str)
*s= '\0'; *s= '\0';
s++; s++;
} }
} else if (c=='|' || c=='\0') { } else if (c=='|' || c == '\n' || c=='\0') {
if (nitem) { if (nitem) {
*s= '\0'; *s= '\0';
@ -2567,7 +2567,6 @@ static uiPopupBlockHandle *ui_pup_menu(bContext *C, int maxrow, uiMenuHandleFunc
return menu; return menu;
} }
static void operator_name_cb(bContext *C, void *arg, int retval) static void operator_name_cb(bContext *C, void *arg, int retval)
{ {
const char *opname= arg; const char *opname= arg;

@ -1494,3 +1494,147 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname)
} }
} }
/************************* List Template **************************/
typedef struct ListItem {
PointerRNA ptr;
PropertyRNA *prop;
PropertyRNA *activeprop;
PointerRNA activeptr;
int activei;
int selected;
} ListItem;
static void list_item_cb(bContext *C, void *arg_item, void *arg_unused)
{
ListItem *item= (ListItem*)arg_item;
PropertyType activetype;
char *activename;
if(item->selected) {
activetype= RNA_property_type(item->activeprop);
if(activetype == PROP_POINTER)
RNA_property_pointer_set(&item->ptr, item->activeprop, item->activeptr);
else if(activetype == PROP_INT)
RNA_property_int_set(&item->ptr, item->activeprop, item->activei);
else if(activetype == PROP_STRING) {
activename= RNA_struct_name_get_alloc(&item->activeptr, NULL, 0);
RNA_property_string_set(&item->ptr, item->activeprop, activename);
MEM_freeN(activename);
}
}
}
void uiTemplateList(uiLayout *layout, PointerRNA *ptr, char *propname, char *activepropname, int items)
{
PropertyRNA *prop, *activeprop;
PropertyType type, activetype;
PointerRNA activeptr;
uiLayout *box, *row, *col;
uiBlock *block;
uiBut *but;
char *name, *activename= NULL;
int i= 1, activei= 0, len;
static int scroll = 1;
/* validate arguments */
if(!ptr->data)
return;
prop= RNA_struct_find_property(ptr, propname);
if(!prop) {
printf("uiTemplateList: property not found: %s\n", propname);
return;
}
activeprop= RNA_struct_find_property(ptr, activepropname);
if(!activeprop) {
printf("uiTemplateList: property not found: %s\n", activepropname);
return;
}
type= RNA_property_type(prop);
if(type != PROP_COLLECTION) {
printf("uiTemplateList: expected collection property.\n");
return;
}
activetype= RNA_property_type(activeprop);
if(!ELEM3(activetype, PROP_POINTER, PROP_INT, PROP_STRING)) {
printf("uiTemplateList: expected pointer, integer or string property.\n");
return;
}
if(items == 0)
items= 5;
/* get active data */
if(activetype == PROP_POINTER)
activeptr= RNA_property_pointer_get(ptr, activeprop);
else if(activetype == PROP_INT)
activei= RNA_property_int_get(ptr, activeprop);
else if(activetype == PROP_STRING)
activename= RNA_property_string_get_alloc(ptr, activeprop, NULL, 0);
box= uiLayoutBox(layout);
row= uiLayoutRow(box, 0);
col = uiLayoutColumn(row, 1);
block= uiLayoutGetBlock(col);
uiBlockSetEmboss(block, UI_EMBOSSN);
len= RNA_property_collection_length(ptr, prop);
CLAMP(scroll, 1, len);
RNA_BEGIN(ptr, itemptr, propname) {
if(i >= scroll && i<scroll+items) {
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
if(name) {
ListItem *item= MEM_callocN(sizeof(ListItem), "uiTemplateList ListItem");
item->ptr= *ptr;
item->prop= prop;
item->activeprop= activeprop;
item->activeptr= itemptr;
item->activei= i;
if(activetype == PROP_POINTER)
item->selected= (activeptr.data == itemptr.data);
else if(activetype == PROP_INT)
item->selected= (activei == i);
else if(activetype == PROP_STRING)
item->selected= (strcmp(activename, name) == 0);
but= uiDefIconTextButI(block, TOG, 0, RNA_struct_ui_icon(itemptr.type), name, 0,0,UI_UNIT_X*10,UI_UNIT_Y, &item->selected, 0, 0, 0, 0, "");
uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
uiButSetNFunc(but, list_item_cb, item, NULL);
MEM_freeN(name);
}
}
i++;
}
RNA_END;
while(i < scroll+items) {
if(i >= scroll)
uiItemL(col, "", 0);
i++;
}
uiBlockSetEmboss(block, UI_EMBOSS);
if(len > items) {
col= uiLayoutColumn(row, 0);
uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &scroll, 1, len-items+1, items, 0, "");
}
//uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*15,UI_UNIT_Y*0.75, &scroll, 1, 16-5, 5, 0, "");
}

@ -120,6 +120,8 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
if(!pptr.type) if(!pptr.type)
pptr.type= RNA_property_pointer_type(ptr, prop); pptr.type= RNA_property_pointer_type(ptr, prop);
icon= RNA_struct_ui_icon(pptr.type); icon= RNA_struct_ui_icon(pptr.type);
if(icon == ICON_DOT)
icon= 0;
but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL); but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break; break;

@ -102,6 +102,7 @@ typedef struct uiWidgetBase {
float inner_uv[64][2]; float inner_uv[64][2];
short inner, outline, emboss; /* set on/off */ short inner, outline, emboss; /* set on/off */
short shadedir;
uiWidgetTrias tria1; uiWidgetTrias tria1;
uiWidgetTrias tria2; uiWidgetTrias tria2;
@ -199,6 +200,7 @@ static void widget_init(uiWidgetBase *wtb)
wtb->inner= 1; wtb->inner= 1;
wtb->outline= 1; wtb->outline= 1;
wtb->emboss= 1; wtb->emboss= 1;
wtb->shadedir= 1;
} }
/* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */ /* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */
@ -583,7 +585,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
for(a=0; a<wtb->totvert; a++) { for(a=0; a<wtb->totvert; a++) {
round_box_shade_col4(col1, col2, wtb->inner_uv[a][1]); round_box_shade_col4(col1, col2, wtb->inner_uv[a][wtb->shadedir]);
glVertex2fv(wtb->inner_v[a]); glVertex2fv(wtb->inner_v[a]);
} }
glEnd(); glEnd();
@ -1088,6 +1090,32 @@ static struct uiWidgetColors wcol_box= {
0, 0 0, 0
}; };
static struct uiWidgetColors wcol_toggle= {
{25, 25, 25, 255},
{153, 153, 153, 255},
{100, 100, 100, 255},
{25, 25, 25, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
0,
0, 0
};
static struct uiWidgetColors wcol_scroll= {
{25, 25, 25, 255},
{180, 180, 180, 255},
{153, 153, 153, 255},
{90, 90, 90, 255},
{0, 0, 0, 255},
{255, 255, 255, 255},
1,
0, -20
};
/* free wcol struct to play with */ /* free wcol struct to play with */
static struct uiWidgetColors wcol_tmp= { static struct uiWidgetColors wcol_tmp= {
{0, 0, 0, 255}, {0, 0, 0, 255},
@ -1109,9 +1137,10 @@ void ui_widget_color_init(ThemeUI *tui)
tui->wcol_regular= wcol_regular; tui->wcol_regular= wcol_regular;
tui->wcol_tool= wcol_tool; tui->wcol_tool= wcol_tool;
tui->wcol_radio= wcol_radio;
tui->wcol_text= wcol_text; tui->wcol_text= wcol_text;
tui->wcol_radio= wcol_radio;
tui->wcol_option= wcol_option; tui->wcol_option= wcol_option;
tui->wcol_toggle= wcol_toggle;
tui->wcol_num= wcol_num; tui->wcol_num= wcol_num;
tui->wcol_numslider= wcol_numslider; tui->wcol_numslider= wcol_numslider;
tui->wcol_menu= wcol_menu; tui->wcol_menu= wcol_menu;
@ -1119,6 +1148,7 @@ void ui_widget_color_init(ThemeUI *tui)
tui->wcol_menu_back= wcol_menu_back; tui->wcol_menu_back= wcol_menu_back;
tui->wcol_menu_item= wcol_menu_item; tui->wcol_menu_item= wcol_menu_item;
tui->wcol_box= wcol_box; tui->wcol_box= wcol_box;
tui->wcol_scroll= wcol_scroll;
} }
/* ************ button callbacks, state ***************** */ /* ************ button callbacks, state ***************** */
@ -1602,6 +1632,75 @@ void ui_draw_link_bezier(rcti *rect)
} }
} }
static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
rcti rect1;
double value;
char inner[3];
float fac, size, rad;
int horizontal;
/* determine horizontal/vertical */
horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
if(horizontal)
rad= 0.5f*(rect->ymax - rect->ymin);
else
rad= 0.5f*(rect->xmax - rect->xmin);
widget_init(&wtb);
wtb.shadedir= (horizontal)? 1: 0;
/* draw back part, colors swapped and shading inverted */
VECCOPY(inner, wcol->inner);
VECCOPY(wcol->inner, wcol->item);
if(horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
if(state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
round_box_edges(&wtb, roundboxalign, rect, rad); /* XXX vertical gradient is wrong */
widgetbase_draw(&wtb, wcol);
VECCOPY(wcol->inner, inner);
if(horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
if(state & UI_SELECT)
SWAP(short, wcol->shadetop, wcol->shadedown);
/* front part */
value= ui_get_but_val(but);
size= (but->softmax + but->a1 - but->softmin);
size= MAX2(size, 2);
/* position */
rect1= *rect;
if(horizontal) {
fac= (rect->xmax - rect->xmin)/(size-1);
rect1.xmin= rect1.xmin + ceil(fac*(value - but->softmin));
rect1.xmax= rect1.xmin + ceil(fac*(but->a1 - but->softmin));
}
else {
fac= (rect->ymax - rect->ymin)/(size-1);
rect1.ymax= rect1.ymax - ceil(fac*(value - but->softmin));
rect1.ymin= rect1.ymax - ceil(fac*(but->a1 - but->softmin));
}
/* draw */
wtb.emboss= 0; /* only emboss once */
if(!horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
round_box_edges(&wtb, roundboxalign, &rect1, rad); /* XXX vertical gradient is wrong */
widgetbase_draw(&wtb, wcol);
if(!horizontal)
SWAP(short, wcol->shadetop, wcol->shadedown);
}
static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) static void widget_link(uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{ {
@ -1896,13 +1995,16 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
wt.text= widget_draw_text_icon; wt.text= widget_draw_text_icon;
switch(type) { switch(type) {
case UI_WTYPE_REGULAR:
break;
case UI_WTYPE_LABEL: case UI_WTYPE_LABEL:
wt.draw= NULL; wt.draw= NULL;
wt.state= widget_state_label; wt.state= widget_state_label;
break; break;
case UI_WTYPE_TOGGLE: case UI_WTYPE_TOGGLE:
wt.wcol_theme= &btheme->tui.wcol_radio;/*use radio theme for toggles*/ wt.wcol_theme= &btheme->tui.wcol_toggle;
break; break;
case UI_WTYPE_OPTION: case UI_WTYPE_OPTION:
@ -1996,6 +2098,11 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
case UI_WTYPE_NORMAL: case UI_WTYPE_NORMAL:
break; break;
case UI_WTYPE_SCROLL:
wt.wcol_theme= &btheme->tui.wcol_scroll;
wt.custom= widget_scroll;
break;
} }
return &wt; return &wt;
@ -2090,6 +2197,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
case BUT: case BUT:
wt= widget_type(UI_WTYPE_EXEC); wt= widget_type(UI_WTYPE_EXEC);
break; break;
case NUM: case NUM:
wt= widget_type(UI_WTYPE_NUMBER); wt= widget_type(UI_WTYPE_NUMBER);
break; break;
@ -2186,8 +2294,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect); ui_draw_but_CURVE(ar, but, &tui->wcol_regular, rect);
break; break;
case SCROLL:
wt= widget_type(UI_WTYPE_SCROLL);
break;
default: default:
wt= widget_type(UI_WTYPE_TOGGLE); wt= widget_type(UI_WTYPE_REGULAR);
} }
} }
@ -2196,6 +2308,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
int roundboxalign, state; int roundboxalign, state;
roundboxalign= widget_roundbox_set(but, rect); roundboxalign= widget_roundbox_set(but, rect);
state= but->flag; state= but->flag;
if(but->editstr) state |= UI_TEXTINPUT; if(but->editstr) state |= UI_TEXTINPUT;

@ -124,10 +124,11 @@ typedef struct uiWidgetColors {
typedef struct ThemeUI { typedef struct ThemeUI {
/* Interface Elements (buttons, menus, icons) */ /* Interface Elements (buttons, menus, icons) */
uiWidgetColors wcol_regular, wcol_tool, wcol_radio, wcol_text, wcol_option; uiWidgetColors wcol_regular, wcol_tool, wcol_text;
uiWidgetColors wcol_radio, wcol_option, wcol_toggle;
uiWidgetColors wcol_num, wcol_numslider; uiWidgetColors wcol_num, wcol_numslider;
uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item; uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item;
uiWidgetColors wcol_box; uiWidgetColors wcol_box, wcol_scroll;
char iconfile[80]; // FILE_MAXFILE length char iconfile[80]; // FILE_MAXFILE length

@ -249,6 +249,12 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "image_user", "ImageUser", "", ""); parm= RNA_def_pointer(func, "image_user", "ImageUser", "", "");
RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_flag(parm, PROP_REQUIRED);
func= RNA_def_function(srna, "template_list", "uiTemplateList");
api_ui_item_rna_common(func);
parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, indicating the active element.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_int(func, "items", 5, 0, INT_MAX, "", "Number of items to display.", 0, INT_MAX);
} }
#endif #endif

@ -307,6 +307,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Option Widget Colors", ""); RNA_def_property_ui_text(prop, "Option Widget Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL); RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "wcol_toggle");
RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NEVER_NULL); prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "wcol_num"); RNA_def_property_pointer_sdna(prop, NULL, "wcol_num");
RNA_def_property_struct_type(prop, "ThemeWidgetColors"); RNA_def_property_struct_type(prop, "ThemeWidgetColors");
@ -349,6 +355,11 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Menu Item Colors", ""); RNA_def_property_ui_text(prop, "Menu Item Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL); RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "wcol_scroll");
RNA_def_property_struct_type(prop, "ThemeWidgetColors");
RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
RNA_def_property_update(prop, NC_WINDOW, NULL);
prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH); prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "iconfile"); RNA_def_property_string_sdna(prop, NULL, "iconfile");