diff options
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 26 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 12 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 73 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 11 |
5 files changed, 86 insertions, 48 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 499fe3b9767..232b6f7f317 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -46,6 +46,7 @@ #include "DNA_screen_types.h" #include "DNA_userdef_types.h" +#include "DNA_brush_types.h" #include "BKE_context.h" #include "BKE_global.h" @@ -762,6 +763,7 @@ static void icon_create_mipmap(struct PreviewImage* prv_img, int miplevel) prv_img->w[miplevel] = size; prv_img->h[miplevel] = size; prv_img->changed[miplevel] = 1; + prv_img->changed_timestamp[miplevel] = 0; prv_img->rect[miplevel] = MEM_callocN(size*size*sizeof(unsigned int), "prv_rect"); } } @@ -976,6 +978,16 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) /* checks if not exists, or changed */ ui_id_icon_render(C, id, preview); break; + case ID_BR: + { /* use the image in the brush as the icon */ + /* XXX redundancy here can be reduced be rewriting this switch as an if */ + ID* ima_id = (ID*)((Brush*)id)->image_icon; + id = ima_id ? ima_id : id; + iconid= BKE_icon_getid(id); + /* checks if not exists, or changed */ + ui_id_icon_render(C, id, preview); + } + break; default: break; } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index dae2e35f99b..61694b859c5 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -285,32 +285,6 @@ void uiEndPanel(uiBlock *block, int width, int height) } } -#if 0 -void uiPanelToMouse(const bContext *C, Panel *pa) -{ - /* global control over this feature; UI_PNL_TO_MOUSE only called for hotkey panels */ - if(U.uiflag & USER_PANELPINNED); - else if(pa->control & UI_PNL_TO_MOUSE) { - int mx, my; - - mx= CTX_wm_window(C)->eventstate->x; - my= CTX_wm_window(C)->eventstate->y; - - pa->ofsx= mx-pa->sizex/2; - pa->ofsy= my-pa->sizey/2; - - if(pa->flag & PNL_CLOSED) pa->flag &= ~PNL_CLOSED; - } - - if(pa->control & UI_PNL_UNSTOW) { - if(pa->flag & PNL_CLOSEDY) { - pa->flag &= ~PNL_CLOSED; - } - } -} -#endif - - static void ui_offset_panel_block(uiBlock *block) { uiStyle *style= U.uistyles.first; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index fb00d4f968e..f17a3371df1 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -1600,7 +1600,7 @@ void ui_update_block_buts_rgb(uiBlock *block, float *rgb, float *rhsv) if (rgb_gamma[1] > 1.0f) rgb_gamma[1] = modf(rgb_gamma[1], &intpart); if (rgb_gamma[2] > 1.0f) rgb_gamma[2] = modf(rgb_gamma[2], &intpart); - sprintf(col, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); + sprintf(col, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); strcpy(bt->poin, col); } @@ -1832,11 +1832,11 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR /* RGB values */ uiBlockBeginAlign(block); - bt= uiDefButR(block, NUMSLI, 0, "R ", 0, -60, butwidth, UI_UNIT_Y, ptr, propname, 0, 0.0, 0.0, 0, 0, ""); + bt= uiDefButR(block, NUMSLI, 0, "R ", 0, -60, butwidth, UI_UNIT_Y, ptr, propname, 0, 0.0, 0.0, 0, 3, ""); uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); - bt= uiDefButR(block, NUMSLI, 0, "G ", 0, -80, butwidth, UI_UNIT_Y, ptr, propname, 1, 0.0, 0.0, 0, 0, ""); + bt= uiDefButR(block, NUMSLI, 0, "G ", 0, -80, butwidth, UI_UNIT_Y, ptr, propname, 1, 0.0, 0.0, 0, 3, ""); uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); - bt= uiDefButR(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, propname, 2, 0.0, 0.0, 0, 0, ""); + bt= uiDefButR(block, NUMSLI, 0, "B ", 0, -100, butwidth, UI_UNIT_Y, ptr, propname, 2, 0.0, 0.0, 0, 3, ""); uiButSetFunc(bt, do_picker_rna_cb, bt, NULL); // could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", 0); @@ -1861,8 +1861,8 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR } rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); - - sprintf(hexcol, "%02X%02X%02X", (unsigned int)(rgb_gamma[0]*255.0), (unsigned int)(rgb_gamma[1]*255.0), (unsigned int)(rgb_gamma[2]*255.0)); + + sprintf(hexcol, "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2])); bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)"); uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8f116828ac5..f8e94b87ea9 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -42,6 +42,7 @@ #include "BKE_main.h" #include "BKE_texture.h" #include "BKE_utildefines.h" +#include "BKE_report.h" #include "ED_screen.h" #include "ED_render.h" @@ -143,6 +144,8 @@ typedef struct TemplateID { ListBase *idlb; int prv_rows, prv_cols; + + char filterop[64]; } TemplateID; /* Search browse menu, assign */ @@ -172,15 +175,53 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea /* ID listbase */ for(id= lb->first; id; id= id->next) { if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) { + int filter_yes; + + filter_yes= 0; + + /* use filter */ + if (template->filterop[0] != 0) { + PointerRNA ptr; + ReportList reports; + FunctionRNA *func; + ParameterList parms; + + RNA_id_pointer_create(id, &ptr); + + BKE_reports_init(&reports, RPT_PRINT); + + func= RNA_struct_find_function(&ptr, template->filterop); + + if (func) { + RNA_parameter_list_create(&parms, &ptr, func); + + RNA_parameter_set_lookup(&parms, "context", &C); + + if (RNA_function_call(C, &reports, &ptr, func, &parms) == 0) { + int* ret; + RNA_parameter_get_lookup(&parms, "ret", &ret); - /* hide dot-datablocks */ - if(U.uiflag & USER_HIDE_DOT) + if (!(*ret)) { + RNA_parameter_list_free(&parms); + continue; + } + else { + filter_yes= 1; + } + } + + RNA_parameter_list_free(&parms); + } + } + + /* hide dot-datablocks, but only if filter does not force it visible */ + if(!filter_yes && U.uiflag & USER_HIDE_DOT) if ((id->name[2]=='.') && (str[0] != '.')) continue; if(BLI_strcasestr(id->name+2, str)) { iconid= ui_id_icon_get((bContext*)C, id, 1); - + if(!uiSearchItemAdd(items, id->name+2, id, iconid)) break; } @@ -342,7 +383,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, char *newop, char *openop, char *unlinkop, char *filterop) { uiBut *but; uiBlock *block; @@ -482,7 +523,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, char *propname, char *newop, char *openop, char *unlinkop, char* filterop, int flag, int prv_rows, int prv_cols) { TemplateID *template; PropertyRNA *prop; @@ -500,7 +541,12 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char template->prop= prop; template->prv_rows = prv_rows; template->prv_cols = prv_cols; - + + if (filterop) + BLI_strncpy(template->filterop, filterop, sizeof(template->filterop)); + else + template->filterop[0] = 0; + if(newop) flag |= UI_ID_ADD_NEW; if(openop) @@ -514,26 +560,25 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char */ if(template->idlb) { uiLayoutRow(layout, 1); - template_ID(C, layout, template, type, flag, newop, openop, unlinkop); + template_ID(C, layout, template, type, flag, newop, openop, unlinkop, filterop); } 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, char *propname, char *newop, char *openop, char *unlinkop, char *filterop) { - ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE, 0, 0); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, 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, char *propname, char *newop, char *openop, char *unlinkop, char *filterop) { - ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, 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, char *propname, char *newop, char *openop, char *unlinkop, char *filterop, 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); + ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, filterop, UI_ID_BROWSE|UI_ID_RENAME|UI_ID_DELETE|UI_ID_PREVIEWS, rows, cols); } /************************ ID Chooser Template ***************************/ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index cf47feb312b..bea8d3bd1f6 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1463,7 +1463,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255); } } - if (G.main->versionfile <= 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) { + if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) { bTheme *btheme; /* interface_widgets.c */ @@ -1521,7 +1521,14 @@ void init_userdef_do_versions(void) /* this timer uses U */ // XXX reset_autosave(); -} + /* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */ + if (U.sculpt_paint_unified_alpha == 0) + U.sculpt_paint_unified_alpha = 0.5f; + if (U.sculpt_paint_unified_unprojected_radius == 0) + U.sculpt_paint_unified_unprojected_radius = 0.125f; + if (U.sculpt_paint_unified_size == 0) + U.sculpt_paint_unified_size = 35; +} |