Merged changes in the trunk up to revision 33348.
This commit is contained in:
@@ -759,6 +759,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
|
||||
/* widgets */
|
||||
for(but= block->buttons.first; but; but= but->next) {
|
||||
ui_but_to_pixelrect(&rect, ar, block, but);
|
||||
|
||||
if(!(but->flag & UI_HIDDEN) &&
|
||||
/* XXX: figure out why invalid coordinates happen when closing render window */
|
||||
/* and material preview is redrawn in main window (temp fix for bug #23848) */
|
||||
@@ -1252,8 +1253,8 @@ int ui_is_but_unit(uiBut *but)
|
||||
|
||||
unit_type = RNA_SUBTYPE_UNIT(RNA_property_subtype(but->rnaprop));
|
||||
|
||||
#if 0 // removed so angle buttons get correct snapping
|
||||
if (scene->unit.flag & USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
#if 1 // removed so angle buttons get correct snapping
|
||||
if (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
@@ -1941,7 +1942,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
|
||||
return block;
|
||||
}
|
||||
|
||||
uiBlock *uiGetBlock(char *name, ARegion *ar)
|
||||
uiBlock *uiGetBlock(const char *name, ARegion *ar)
|
||||
{
|
||||
uiBlock *block= ar->uiblocks.first;
|
||||
|
||||
@@ -2212,7 +2213,7 @@ static void ui_block_do_align_but(uiBut *first, int nr)
|
||||
|
||||
/* clear old flag */
|
||||
but->flag &= ~UI_BUT_ALIGN;
|
||||
|
||||
|
||||
if(flag==0) { /* first case */
|
||||
if(next) {
|
||||
if(buts_are_horiz(but, next)) {
|
||||
@@ -2261,14 +2262,19 @@ static void ui_block_do_align_but(uiBut *first, int nr)
|
||||
else { /* next button switches to new row */
|
||||
|
||||
if(prev && buts_are_horiz(prev, but))
|
||||
flag |= UI_BUT_ALIGN_LEFT;
|
||||
flag |= UI_BUT_ALIGN_LEFT;
|
||||
else {
|
||||
flag &= ~UI_BUT_ALIGN_LEFT;
|
||||
flag |= UI_BUT_ALIGN_TOP;
|
||||
}
|
||||
|
||||
if( (flag & UI_BUT_ALIGN_TOP)==0) { /* stil top row */
|
||||
if(prev) {
|
||||
if(next && buts_are_horiz(next, but))
|
||||
flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
|
||||
else {
|
||||
if(next && buts_are_horiz(but, next))
|
||||
flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT;
|
||||
else {
|
||||
/* last button in top row */
|
||||
flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2303,6 +2309,10 @@ static void ui_block_do_align_but(uiBut *first, int nr)
|
||||
/* the previous button is a single one in its row */
|
||||
but->y2= (prev->y1+but->y2)/2.0;
|
||||
prev->y1= but->y2;
|
||||
|
||||
but->x1= prev->x1;
|
||||
if(next && buts_are_horiz(but, next)==0)
|
||||
but->x2= prev->x2;
|
||||
}
|
||||
else {
|
||||
/* the previous button is not a single one in its row */
|
||||
@@ -2344,7 +2354,7 @@ for float buttons:
|
||||
all greater values will be clamped to 4.
|
||||
|
||||
*/
|
||||
static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
short slen;
|
||||
@@ -2439,7 +2449,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, char *str, short
|
||||
return but;
|
||||
}
|
||||
|
||||
uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
PropertyRNA *prop;
|
||||
@@ -2606,12 +2616,12 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
|
||||
but->a1= ui_get_but_step_unit(but, but->a1);
|
||||
|
||||
if(freestr)
|
||||
MEM_freeN(str);
|
||||
MEM_freeN((void *)str);
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
uiBut *ui_def_but_operator(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, int opcontext, const char *str, short x1, short y1, short x2, short y2, const char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
wmOperatorType *ot;
|
||||
@@ -2640,7 +2650,7 @@ uiBut *ui_def_but_operator(uiBlock *block, int type, char *opname, int opcontext
|
||||
return but;
|
||||
}
|
||||
|
||||
uiBut *ui_def_but_operator_text(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
wmOperatorType *ot;
|
||||
@@ -2669,7 +2679,7 @@ uiBut *ui_def_but_operator_text(uiBlock *block, int type, char *opname, int opco
|
||||
return but;
|
||||
}
|
||||
|
||||
uiBut *uiDefBut(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
|
||||
|
||||
@@ -2819,7 +2829,7 @@ uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, sh
|
||||
{
|
||||
return uiDefButBit(block, type|CHA, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
@@ -2829,7 +2839,7 @@ uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, shor
|
||||
|
||||
return but;
|
||||
}
|
||||
uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
@@ -2840,7 +2850,7 @@ uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *st
|
||||
return but;
|
||||
}
|
||||
|
||||
uiBut *uiDefButTextO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but= ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
|
||||
|
||||
@@ -2919,7 +2929,7 @@ uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, short x1, s
|
||||
|
||||
return but;
|
||||
}
|
||||
uiBut *uiDefIconButO(uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip)
|
||||
uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
@@ -2934,7 +2944,7 @@ uiBut *uiDefIconButO(uiBlock *block, int type, char *opname, int opcontext, int
|
||||
}
|
||||
|
||||
/* Button containing both string label and icon */
|
||||
uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
|
||||
|
||||
@@ -2947,7 +2957,7 @@ uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, char *st
|
||||
|
||||
return but;
|
||||
}
|
||||
static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
int bitIdx= findBitIndex(bit);
|
||||
if (bitIdx==-1) {
|
||||
@@ -2957,39 +2967,39 @@ static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval,
|
||||
}
|
||||
}
|
||||
|
||||
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type|FLO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type|FLO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type|INT, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type|INT, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type|SHO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type|SHO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextBut(block, type|CHA, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
return uiDefIconTextButBit(block, type|CHA, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
|
||||
}
|
||||
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, short x1, short y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
@@ -3005,7 +3015,7 @@ uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *s
|
||||
|
||||
return but;
|
||||
}
|
||||
uiBut *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, short x1, short y1, short x2, short y2, char *tip)
|
||||
{
|
||||
uiBut *but;
|
||||
|
||||
|
||||
@@ -105,10 +105,11 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
|
||||
|
||||
// TODO: this should probably respect the keyingset only option for anim
|
||||
if(autokeyframe_cfra_can_key(scene, id)) {
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
short flag = ANIM_get_keyframing_flags(scene, 1);
|
||||
|
||||
fcu->flag &= ~FCURVE_SELECTED;
|
||||
insert_keyframe(id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
||||
insert_keyframe(reports, id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
||||
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ static void ui_apply_autokey_undo(bContext *C, uiBut *but)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
uiAfterFunc *after;
|
||||
char *str= NULL;
|
||||
const char *str= NULL;
|
||||
|
||||
if(but->flag & UI_BUT_UNDO) {
|
||||
/* define which string to use for undo */
|
||||
@@ -4090,7 +4090,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
|
||||
uiPopupMenu *pup;
|
||||
uiLayout *layout;
|
||||
int length;
|
||||
char *name;
|
||||
const char *name;
|
||||
|
||||
if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
|
||||
return 0;
|
||||
@@ -4960,15 +4960,14 @@ void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct P
|
||||
|
||||
if(activebut) {
|
||||
if(activebut->rnapoin.data) {
|
||||
uiHandleButtonData *data= activebut->active;
|
||||
|
||||
/* found RNA button */
|
||||
*ptr= activebut->rnapoin;
|
||||
*prop= activebut->rnaprop;
|
||||
*index= activebut->rnaindex;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* recurse into opened menu */
|
||||
uiHandleButtonData *data= activebut->active;
|
||||
|
||||
/* recurse into opened menu, like colorpicker case */
|
||||
if(data && data->menu)
|
||||
ar = data->menu->region;
|
||||
else
|
||||
@@ -5006,18 +5005,12 @@ void uiContextAnimUpdate(const bContext *C)
|
||||
}
|
||||
|
||||
if(activebut) {
|
||||
if(activebut->rnapoin.data) {
|
||||
/* found RNA button */
|
||||
/* always recurse into opened menu, so all buttons update (like colorpicker) */
|
||||
uiHandleButtonData *data= activebut->active;
|
||||
if(data && data->menu)
|
||||
ar = data->menu->region;
|
||||
else
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* recurse into opened menu */
|
||||
uiHandleButtonData *data= activebut->active;
|
||||
if(data && data->menu)
|
||||
ar = data->menu->region;
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* no active button */
|
||||
|
||||
@@ -682,7 +682,7 @@ static void free_iconfile_list(struct ListBase *list)
|
||||
}
|
||||
}
|
||||
|
||||
int UI_iconfile_get_index(char *filename)
|
||||
int UI_iconfile_get_index(const char *filename)
|
||||
{
|
||||
IconFile *ifile;
|
||||
ListBase *list=&(iconfilelist);
|
||||
|
||||
@@ -204,7 +204,7 @@ struct uiBut {
|
||||
uiLink *link;
|
||||
short linkto[2];
|
||||
|
||||
char *tip, *lockstr;
|
||||
const char *tip, *lockstr;
|
||||
|
||||
BIFIconID icon;
|
||||
char lock;
|
||||
|
||||
@@ -152,7 +152,7 @@ typedef struct uiLayoutItemRoot {
|
||||
|
||||
/************************** Item ***************************/
|
||||
|
||||
static char *ui_item_name_add_colon(char *name, char namestr[UI_MAX_NAME_STR])
|
||||
static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_NAME_STR])
|
||||
{
|
||||
int len= strlen(name);
|
||||
|
||||
@@ -205,7 +205,7 @@ static int ui_layout_vary_direction(uiLayout *layout)
|
||||
}
|
||||
|
||||
/* estimated size of text + icon */
|
||||
static int ui_text_icon_width(uiLayout *layout, char *name, int icon, int compact)
|
||||
static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int compact)
|
||||
{
|
||||
int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X;
|
||||
|
||||
@@ -326,7 +326,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
|
||||
}
|
||||
|
||||
/* create buttons for an item with an RNA array */
|
||||
static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only)
|
||||
static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int h, int expand, int slider, int toggle, int icon_only)
|
||||
{
|
||||
uiStyle *style= layout->root->style;
|
||||
uiBut *but;
|
||||
@@ -434,7 +434,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, char *name, int icon
|
||||
uiBlockSetCurLayout(block, layout);
|
||||
}
|
||||
|
||||
static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, char *uiname, int h, int icon_only)
|
||||
static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, const char *uiname, int h, int icon_only)
|
||||
{
|
||||
uiBut *but;
|
||||
EnumPropertyItem *item;
|
||||
@@ -483,7 +483,7 @@ static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_
|
||||
}
|
||||
|
||||
/* create label + button for RNA property */
|
||||
static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag)
|
||||
static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag)
|
||||
{
|
||||
uiLayout *sub;
|
||||
uiBut *but=NULL;
|
||||
@@ -569,7 +569,7 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA
|
||||
/********************* Button Items *************************/
|
||||
|
||||
/* disabled item */
|
||||
static void ui_item_disabled(uiLayout *layout, char *name)
|
||||
static void ui_item_disabled(uiLayout *layout, const char *name)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
uiBut *but;
|
||||
@@ -589,7 +589,7 @@ static void ui_item_disabled(uiLayout *layout, char *name)
|
||||
}
|
||||
|
||||
/* operator items */
|
||||
PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDProperty *properties, int context, int flag)
|
||||
PointerRNA uiItemFullO(uiLayout *layout, const char *idname, const char *name, int icon, IDProperty *properties, int context, int flag)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
wmOperatorType *ot= WM_operatortype_find(idname, 0);
|
||||
@@ -646,7 +646,7 @@ PointerRNA uiItemFullO(uiLayout *layout, char *idname, char *name, int icon, IDP
|
||||
return PointerRNA_NULL;
|
||||
}
|
||||
|
||||
static char *ui_menu_enumpropname(uiLayout *layout, char *opname, char *propname, int retval)
|
||||
static char *ui_menu_enumpropname(uiLayout *layout, const char *opname, const char *propname, int retval)
|
||||
{
|
||||
wmOperatorType *ot= WM_operatortype_find(opname, 0);
|
||||
PointerRNA ptr;
|
||||
@@ -676,7 +676,7 @@ static char *ui_menu_enumpropname(uiLayout *layout, char *opname, char *propname
|
||||
return "";
|
||||
}
|
||||
|
||||
void uiItemEnumO(uiLayout *layout, char *opname, char *name, int icon, char *propname, int value)
|
||||
void uiItemEnumO(uiLayout *layout, const char *opname, char *name, int icon, const char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -689,7 +689,7 @@ void uiItemEnumO(uiLayout *layout, char *opname, char *name, int icon, char *pro
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemsFullEnumO(uiLayout *layout, char *opname, char *propname, IDProperty *properties, int context, int flag)
|
||||
void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, IDProperty *properties, int context, int flag)
|
||||
{
|
||||
wmOperatorType *ot= WM_operatortype_find(opname, 0);
|
||||
PointerRNA ptr;
|
||||
@@ -753,13 +753,13 @@ void uiItemsFullEnumO(uiLayout *layout, char *opname, char *propname, IDProperty
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemsEnumO(uiLayout *layout, char *opname, char *propname)
|
||||
void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname)
|
||||
{
|
||||
uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
/* for use in cases where we have */
|
||||
void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value_str)
|
||||
void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, char *value_str)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -796,7 +796,7 @@ void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, ch
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemBooleanO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value)
|
||||
void uiItemBooleanO(uiLayout *layout, char *name, int icon, const char *opname, const char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -806,7 +806,7 @@ void uiItemBooleanO(uiLayout *layout, char *name, int icon, char *opname, char *
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value)
|
||||
void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -816,7 +816,7 @@ void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *prop
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *propname, float value)
|
||||
void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, float value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -826,7 +826,7 @@ void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *pr
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value)
|
||||
void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, char *value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
@@ -836,14 +836,14 @@ void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *p
|
||||
uiItemFullO(layout, opname, name, icon, ptr.data, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
void uiItemO(uiLayout *layout, char *name, int icon, char *opname)
|
||||
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
|
||||
{
|
||||
uiItemFullO(layout, opname, name, icon, NULL, layout->root->opcontext, 0);
|
||||
}
|
||||
|
||||
/* RNA property items */
|
||||
|
||||
static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int icon_only, int *r_w, int *r_h)
|
||||
static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int icon_only, int *r_w, int *r_h)
|
||||
{
|
||||
PropertyType type;
|
||||
PropertySubType subtype;
|
||||
@@ -887,7 +887,7 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PointerRNA
|
||||
*r_h= h;
|
||||
}
|
||||
|
||||
void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, char *name, int icon)
|
||||
void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, const char *name, int icon)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
uiBut *but;
|
||||
@@ -977,7 +977,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
}
|
||||
|
||||
void uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, int flag, char *name, int icon)
|
||||
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
|
||||
@@ -990,7 +990,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, char *propname, int flag, char *
|
||||
uiItemFullR(layout, ptr, prop, RNA_NO_INDEX, 0, flag, name, icon);
|
||||
}
|
||||
|
||||
void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value)
|
||||
void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
|
||||
@@ -1003,7 +1003,7 @@ void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr,
|
||||
uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, value, 0, name, icon);
|
||||
}
|
||||
|
||||
void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *value, char *name, int icon)
|
||||
void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
EnumPropertyItem *item;
|
||||
@@ -1035,7 +1035,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, char *propname
|
||||
MEM_freeN(item);
|
||||
}
|
||||
|
||||
void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname)
|
||||
void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
uiBlock *block= layout->root->block;
|
||||
@@ -1102,7 +1102,7 @@ int sort_search_items_list(void *a, void *b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, uiSearchItems *items)
|
||||
static void rna_search_cb(const struct bContext *C, void *arg_but, const char *str, uiSearchItems *items)
|
||||
{
|
||||
uiBut *but= arg_but;
|
||||
char *name;
|
||||
@@ -1220,7 +1220,7 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname, char *name, int icon)
|
||||
void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
|
||||
{
|
||||
PropertyRNA *prop, *searchprop;
|
||||
PropertyType type;
|
||||
@@ -1282,7 +1282,7 @@ static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
|
||||
mt->draw(C, &menu);
|
||||
}
|
||||
|
||||
static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN)
|
||||
static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
uiBut *but;
|
||||
@@ -1324,7 +1324,7 @@ static void ui_item_menu(uiLayout *layout, char *name, int icon, uiMenuCreateFun
|
||||
}
|
||||
}
|
||||
|
||||
void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name, int icon)
|
||||
void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const char *name, int icon)
|
||||
{
|
||||
MenuType *mt;
|
||||
|
||||
@@ -1344,7 +1344,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), char *menuname, char *name,
|
||||
}
|
||||
|
||||
/* label item */
|
||||
static uiBut *uiItemL_(uiLayout *layout, char *name, int icon)
|
||||
static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
uiBut *but;
|
||||
@@ -1360,16 +1360,16 @@ static uiBut *uiItemL_(uiLayout *layout, char *name, int icon)
|
||||
w= ui_text_icon_width(layout, name, icon, 0);
|
||||
|
||||
if(icon && strcmp(name, "") != 0)
|
||||
but= uiDefIconTextBut(block, LABEL, 0, icon, (char*)name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
but= uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
else if(icon)
|
||||
but= uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
else
|
||||
but= uiDefBut(block, LABEL, 0, (char*)name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
return but;
|
||||
}
|
||||
|
||||
void uiItemL(uiLayout *layout, char *name, int icon)
|
||||
void uiItemL(uiLayout *layout, const char *name, int icon)
|
||||
{
|
||||
uiItemL_(layout, name, icon);
|
||||
}
|
||||
@@ -1419,7 +1419,7 @@ void uiItemS(uiLayout *layout)
|
||||
}
|
||||
|
||||
/* level items */
|
||||
void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func, void *arg)
|
||||
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
|
||||
{
|
||||
if(!func)
|
||||
return;
|
||||
@@ -1429,8 +1429,8 @@ void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func,
|
||||
|
||||
typedef struct MenuItemLevel {
|
||||
int opcontext;
|
||||
char *opname;
|
||||
char *propname;
|
||||
const char *opname;
|
||||
const char *propname;
|
||||
PointerRNA rnapoin;
|
||||
} MenuItemLevel;
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
|
||||
uiItemsEnumO(layout, lvl->opname, lvl->propname);
|
||||
}
|
||||
|
||||
void uiItemMenuEnumO(uiLayout *layout, char *opname, char *propname, char *name, int icon)
|
||||
void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name, int icon)
|
||||
{
|
||||
wmOperatorType *ot= WM_operatortype_find(opname, 0);
|
||||
MenuItemLevel *lvl;
|
||||
@@ -1473,7 +1473,7 @@ static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void
|
||||
uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname);
|
||||
}
|
||||
|
||||
void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname, char *name, int icon)
|
||||
void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon)
|
||||
{
|
||||
MenuItemLevel *lvl;
|
||||
PropertyRNA *prop;
|
||||
@@ -2553,7 +2553,7 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
|
||||
}
|
||||
}
|
||||
|
||||
void uiLayoutSetContextPointer(uiLayout *layout, char *name, PointerRNA *ptr)
|
||||
void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr)
|
||||
{
|
||||
uiBlock *block= layout->root->block;
|
||||
layout->context= CTX_store_add(&block->contexts, name, ptr);
|
||||
@@ -2631,7 +2631,7 @@ static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout)
|
||||
}
|
||||
|
||||
static char *str = NULL; // XXX, constant re-freeing, far from ideal.
|
||||
char *uiLayoutIntrospect(uiLayout *layout)
|
||||
const char *uiLayoutIntrospect(uiLayout *layout)
|
||||
{
|
||||
DynStr *ds= BLI_dynstr_new();
|
||||
|
||||
|
||||
@@ -34,11 +34,15 @@
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_text_types.h" /* for UI_OT_reports_to_text */
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math_color.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_text.h" /* for UI_OT_reports_to_text */
|
||||
#include "BKE_report.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
#include "RNA_define.h"
|
||||
@@ -402,7 +406,51 @@ void UI_OT_copy_to_selected_button(wmOperatorType *ot)
|
||||
/* properties */
|
||||
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array.");
|
||||
}
|
||||
|
||||
|
||||
/* Reports to Textblock Operator ------------------------ */
|
||||
|
||||
/* FIXME: this is just a temporary operator so that we can see all the reports somewhere
|
||||
* when there are too many to display...
|
||||
*/
|
||||
|
||||
static int reports_to_text_poll(bContext *C)
|
||||
{
|
||||
return CTX_wm_reports(C) != NULL;
|
||||
}
|
||||
|
||||
static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
Text *txt;
|
||||
char *str;
|
||||
|
||||
/* create new text-block to write to */
|
||||
txt = add_empty_text("Recent Reports");
|
||||
|
||||
/* convert entire list to a display string, and add this to the text-block
|
||||
* - if commandline debug option enabled, show debug reports too
|
||||
* - otherwise, up to info (which is what users normally see)
|
||||
*/
|
||||
str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO);
|
||||
|
||||
write_text(txt, str);
|
||||
MEM_freeN(str);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void UI_OT_reports_to_textblock(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Reports to Text Block";
|
||||
ot->idname= "UI_OT_reports_to_textblock";
|
||||
ot->description= "Write the reports ";
|
||||
|
||||
/* callbacks */
|
||||
ot->poll= reports_to_text_poll;
|
||||
ot->exec= reports_to_text_exec;
|
||||
}
|
||||
|
||||
/* ********************************************************* */
|
||||
/* Registration */
|
||||
|
||||
@@ -413,5 +461,6 @@ void UI_buttons_operatortypes(void)
|
||||
WM_operatortype_append(UI_OT_copy_data_path_button);
|
||||
WM_operatortype_append(UI_OT_reset_default_button);
|
||||
WM_operatortype_append(UI_OT_copy_to_selected_button);
|
||||
WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp?
|
||||
}
|
||||
|
||||
|
||||
@@ -403,9 +403,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
||||
}
|
||||
|
||||
/* rna info */
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
}
|
||||
|
||||
if(but->rnapoin.id.data) {
|
||||
ID *id= but->rnapoin.id.data;
|
||||
@@ -424,9 +426,11 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
|
||||
str= WM_operator_pystring(C, but->optype, opptr, 0);
|
||||
|
||||
/* operator info */
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
|
||||
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", str);
|
||||
data->color[data->totline]= 0x888888;
|
||||
data->totline++;
|
||||
}
|
||||
|
||||
MEM_freeN(str);
|
||||
|
||||
@@ -2246,7 +2250,7 @@ static void confirm_cancel_operator(void *opv)
|
||||
WM_operator_free(opv);
|
||||
}
|
||||
|
||||
static void vconfirm_opname(bContext *C, char *opname, char *title, char *itemfmt, va_list ap)
|
||||
static void vconfirm_opname(bContext *C, const char *opname, char *title, char *itemfmt, va_list ap)
|
||||
{
|
||||
uiPopupBlockHandle *handle;
|
||||
char *s, buf[512];
|
||||
@@ -2258,7 +2262,7 @@ static void vconfirm_opname(bContext *C, char *opname, char *title, char *itemfm
|
||||
handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
|
||||
|
||||
handle->popup_func= operator_name_cb;
|
||||
handle->popup_arg= opname;
|
||||
handle->popup_arg= (void *)opname;
|
||||
}
|
||||
|
||||
static void confirm_operator(bContext *C, wmOperator *op, char *title, char *item)
|
||||
@@ -2276,7 +2280,7 @@ static void confirm_operator(bContext *C, wmOperator *op, char *title, char *ite
|
||||
handle->cancel_func= confirm_cancel_operator;
|
||||
}
|
||||
|
||||
void uiPupMenuOkee(bContext *C, char *opname, char *str, ...)
|
||||
void uiPupMenuOkee(bContext *C, const char *opname, char *str, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char titlestr[256];
|
||||
@@ -2391,7 +2395,7 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
|
||||
|
||||
/*************************** Popup Block API **************************/
|
||||
|
||||
void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, char *opname, int opcontext)
|
||||
void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext)
|
||||
{
|
||||
wmWindow *window= CTX_wm_window(C);
|
||||
uiPopupBlockHandle *handle;
|
||||
|
||||
@@ -230,7 +230,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, char *str)
|
||||
/* ************** helpers ************************ */
|
||||
|
||||
/* temporarily, does widget font */
|
||||
int UI_GetStringWidth(char *str)
|
||||
int UI_GetStringWidth(const char *str)
|
||||
{
|
||||
uiStyle *style= U.uistyles.first;
|
||||
uiFontStyle *fstyle= &style->widget;
|
||||
@@ -249,7 +249,7 @@ int UI_GetStringWidth(char *str)
|
||||
}
|
||||
|
||||
/* temporarily, does widget font */
|
||||
void UI_DrawString(float x, float y, char *str)
|
||||
void UI_DrawString(float x, float y, const char *str)
|
||||
{
|
||||
uiStyle *style= U.uistyles.first;
|
||||
|
||||
@@ -314,6 +314,20 @@ void uiStyleInit(void)
|
||||
if(style==NULL) {
|
||||
ui_style_new(&U.uistyles, "Default Style");
|
||||
}
|
||||
|
||||
// XXX, this should be moved into a style, but for now best only load the monospaced font once.
|
||||
if (blf_mono_font == -1)
|
||||
blf_mono_font= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
|
||||
|
||||
BLF_aspect(blf_mono_font, 1.0);
|
||||
BLF_size(blf_mono_font, 12, 72);
|
||||
|
||||
/* second for rendering else we get threading problems */
|
||||
if (blf_mono_font_render == -1)
|
||||
blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
|
||||
|
||||
BLF_aspect(blf_mono_font_render, 1.0);
|
||||
BLF_size(blf_mono_font_render, 12, 72);
|
||||
}
|
||||
|
||||
void uiStyleFontSet(uiFontStyle *fs)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_library.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_report.h"
|
||||
|
||||
@@ -95,7 +96,7 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item)
|
||||
}
|
||||
|
||||
/* ID Search browse menu, do the search */
|
||||
static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSearchItems *items)
|
||||
static void id_search_cb(const bContext *C, void *arg_template, const char *str, uiSearchItems *items)
|
||||
{
|
||||
TemplateID *template= (TemplateID*)arg_template;
|
||||
ListBase *lb= template->idlb;
|
||||
@@ -287,7 +288,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
|
||||
}
|
||||
}
|
||||
|
||||
static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, char *newop, char *openop, char *unlinkop)
|
||||
static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, StructRNA *type, int flag, const char *newop, const char *openop, const char *unlinkop)
|
||||
{
|
||||
uiBut *but;
|
||||
uiBlock *block;
|
||||
@@ -435,7 +436,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int flag, int prv_rows, int prv_cols)
|
||||
static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int flag, int prv_rows, int prv_cols)
|
||||
{
|
||||
TemplateID *template;
|
||||
PropertyRNA *prop;
|
||||
@@ -473,17 +474,17 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char
|
||||
MEM_freeN(template);
|
||||
}
|
||||
|
||||
void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
|
||||
void uiTemplateID(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0);
|
||||
}
|
||||
|
||||
void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop)
|
||||
void uiTemplateIDBrowse(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
|
||||
}
|
||||
|
||||
void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, char *newop, char *openop, char *unlinkop, int rows, int cols)
|
||||
void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int rows, int cols)
|
||||
{
|
||||
ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols);
|
||||
}
|
||||
@@ -495,7 +496,7 @@ void uiTemplateIDPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, char *p
|
||||
* - propname: property identifier for property that ID-pointer gets stored to
|
||||
* - proptypename: property identifier for property used to determine the type of ID-pointer that can be used
|
||||
*/
|
||||
void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *proptypename, char *text)
|
||||
void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, const char *text)
|
||||
{
|
||||
PropertyRNA *propID, *propType;
|
||||
uiLayout *row;
|
||||
@@ -540,7 +541,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, char *propname, char *pr
|
||||
* - propname: property identifier for property that path gets stored to
|
||||
* - root_ptr: struct that path gets built from
|
||||
*/
|
||||
void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, char *propname, PointerRNA *UNUSED(root_ptr), char *text)
|
||||
void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), const char *text)
|
||||
{
|
||||
PropertyRNA *propPath;
|
||||
uiLayout *row;
|
||||
@@ -1054,7 +1055,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event)
|
||||
}
|
||||
}
|
||||
|
||||
void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent, MTex *slot)
|
||||
void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, MTex *slot)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
uiBlock *block;
|
||||
@@ -1102,7 +1103,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, ID *parent, MTex *slot)
|
||||
uiBlockSetHandleFunc(block, do_preview_buttons, NULL);
|
||||
|
||||
/* add buttons */
|
||||
if(pid) {
|
||||
if (pid && show_buttons) {
|
||||
if(GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
|
||||
if(GS(pid->name) == ID_MA) ma= (Material*)pid;
|
||||
else ma= (Material*)pparent;
|
||||
@@ -1293,7 +1294,7 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand
|
||||
colorband_buttons_large(layout, block, coba, 0, 0, cb);
|
||||
}
|
||||
|
||||
void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int expand)
|
||||
void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
PointerRNA cptr;
|
||||
@@ -1323,7 +1324,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, char *propname, int
|
||||
|
||||
/********************* Histogram Template ************************/
|
||||
|
||||
void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
PointerRNA cptr;
|
||||
@@ -1362,7 +1363,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
|
||||
/********************* Waveform Template ************************/
|
||||
|
||||
void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
PointerRNA cptr;
|
||||
@@ -1398,7 +1399,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
|
||||
/********************* Vectorscope Template ************************/
|
||||
|
||||
void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, char *propname)
|
||||
void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propname)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
PointerRNA cptr;
|
||||
@@ -1762,7 +1763,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
|
||||
uiBlockSetNFunc(block, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, char *propname, int type, int levels, int brush)
|
||||
void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, int levels, int brush)
|
||||
{
|
||||
RNAUpdateCb *cb;
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
@@ -1788,7 +1789,7 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, char *propname, i
|
||||
|
||||
#define WHEEL_SIZE 100
|
||||
|
||||
void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
|
||||
void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic)
|
||||
{
|
||||
PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
|
||||
uiBlock *block= uiLayoutGetBlock(layout);
|
||||
@@ -1853,8 +1854,8 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
|
||||
// - for now, grouping of layers is determined by dividing up the length of
|
||||
// the array of layer bitflags
|
||||
|
||||
void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, char *propname,
|
||||
PointerRNA *used_ptr, char *used_propname, int active_layer)
|
||||
void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
|
||||
PointerRNA *used_ptr, const char *used_propname, int active_layer)
|
||||
{
|
||||
uiLayout *uRow, *uCol;
|
||||
PropertyRNA *prop, *used_prop= NULL;
|
||||
@@ -1956,7 +1957,7 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon)
|
||||
return rnaicon;
|
||||
}
|
||||
|
||||
static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, char *activepropname)
|
||||
static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, const char *activepropname)
|
||||
{
|
||||
Object *ob;
|
||||
uiBlock *block= uiLayoutGetBlock(layout);
|
||||
@@ -2000,6 +2001,28 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL);
|
||||
}
|
||||
else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
|
||||
/* provision to draw active node name */
|
||||
Material *ma, *manode;
|
||||
Object *ob= (Object*)ptr->id.data;
|
||||
int index= (Material**)ptr->data - ob->mat;
|
||||
|
||||
/* default item with material base name */
|
||||
uiItemL(sub, name, icon);
|
||||
|
||||
ma= give_current_material(ob, index+1);
|
||||
if(ma) {
|
||||
manode= give_node_material(ma);
|
||||
if(manode) {
|
||||
char str[MAX_ID_NAME + 12];
|
||||
sprintf(str, "Node %s", manode->id.name+2);
|
||||
uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
|
||||
}
|
||||
else if(ma->use_nodes) {
|
||||
uiItemL(sub, "Node <none>", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(itemptr->type == &RNA_ShapeKey) {
|
||||
ob= (Object*)activeptr->data;
|
||||
|
||||
@@ -2025,7 +2048,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
|
||||
MEM_freeN(namebuf);
|
||||
}
|
||||
|
||||
void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, char *propname, PointerRNA *activeptr, char *activepropname, int rows, int maxrows, int listtype)
|
||||
void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, int rows, int maxrows, int listtype)
|
||||
{
|
||||
//Scene *scene= CTX_data_scene(C);
|
||||
PropertyRNA *prop= NULL, *activeprop;
|
||||
@@ -2212,7 +2235,7 @@ static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
|
||||
WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
|
||||
}
|
||||
|
||||
static void operator_search_cb(const bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items)
|
||||
static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_first();
|
||||
|
||||
@@ -2331,6 +2354,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
|
||||
uiBut *but;
|
||||
uiStyle *style= U.uistyles.first;
|
||||
int width;
|
||||
int icon=0;
|
||||
|
||||
/* if the report display has timed out, don't show */
|
||||
if (!reports->reporttimer) return;
|
||||
@@ -2364,13 +2388,24 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
|
||||
|
||||
/* icon and report message on top */
|
||||
if(report->type & RPT_ERROR_ALL)
|
||||
uiDefIconBut(block, LABEL, 0, ICON_ERROR, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
icon = ICON_ERROR;
|
||||
else if(report->type & RPT_WARNING_ALL)
|
||||
uiDefIconBut(block, LABEL, 0, ICON_ERROR, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
icon = ICON_ERROR;
|
||||
else if(report->type & RPT_INFO_ALL)
|
||||
uiDefIconBut(block, LABEL, 0, ICON_INFO, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
icon = ICON_INFO;
|
||||
|
||||
/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
|
||||
* to be shown instead of icon when appropriate...
|
||||
*/
|
||||
uiBlockSetEmboss(block, UI_EMBOSSN);
|
||||
|
||||
if (reports->list.first != reports->list.last)
|
||||
uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, "Click to see rest of reports in textblock: 'Recent Reports'");
|
||||
else
|
||||
uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user