diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-19 20:10:05 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-19 20:10:05 +0300 |
commit | d0f4e7767ecaf2158a7a5403537c78d8fa4439a4 (patch) | |
tree | 98203189acd641f34ac4ce32b804c6c67defb724 /source/blender | |
parent | f49d7d59dc0a83e074e9202a54c22f3c056aa5a6 (diff) |
Bugfix #25720
Preview icons got lost... commit of yesterday caused it.
Conflict between preview render icons, and brush icons...
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 39 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 1 |
2 files changed, 29 insertions, 11 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index bd793538f50..788de41202d 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1001,17 +1001,35 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al } } -void ui_id_icon_render(bContext *C, ID *id, int UNUSED(preview)) +static void ui_id_icon_render(bContext *C, ID *id, int big) +{ + PreviewImage *pi = BKE_previewimg_get(id); + + if (pi) { + if ((pi->changed[0] ||!pi->rect[0])) /* changed only ever set by dynamic icons */ + { + /* create the rect if necessary */ + + icon_set_image(C, id, pi, 0); /* icon size */ + if (big) + icon_set_image(C, id, pi, 1); /* bigger preview size */ + + pi->changed[0] = 0; + } + } +} + +static void ui_id_brush_render(bContext *C, ID *id) { PreviewImage *pi = BKE_previewimg_get(id); int i; - + if(!pi) return; - + for(i = 0; i < PREVIEW_MIPMAPS; i++) { - /* check if preview rect needs to be created; changed - only set by dynamic icons */ + /* check if rect needs to be created; changed + only set by dynamic icons */ if((pi->changed[i] || !pi->rect[i])) { icon_set_image(C, id, pi, i); pi->changed[i] = 0; @@ -1019,13 +1037,14 @@ void ui_id_icon_render(bContext *C, ID *id, int UNUSED(preview)) } } -static int ui_id_brush_get_icon(bContext *C, ID *id, int preview) + +static int ui_id_brush_get_icon(bContext *C, ID *id) { Brush *br = (Brush*)id; if(br->flag & BRUSH_CUSTOM_ICON) { BKE_icon_getid(id); - ui_id_icon_render(C, id, preview); + ui_id_brush_render(C, id); } else { Object *ob = CTX_data_active_object(C); @@ -1071,7 +1090,7 @@ static int ui_id_brush_get_icon(bContext *C, ID *id, int preview) return id->icon_id; } -int ui_id_icon_get(bContext *C, ID *id, int preview) +int ui_id_icon_get(bContext *C, ID *id, int big) { int iconid= 0; @@ -1079,7 +1098,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) switch(GS(id->name)) { case ID_BR: - iconid= ui_id_brush_get_icon(C, id, preview); + iconid= ui_id_brush_get_icon(C, id); break; case ID_MA: /* fall through */ case ID_TE: /* fall through */ @@ -1088,7 +1107,7 @@ int ui_id_icon_get(bContext *C, ID *id, int preview) case ID_LA: /* fall through */ iconid= BKE_icon_getid(id); /* checks if not exists, or changed */ - ui_id_icon_render(C, id, preview); + ui_id_icon_render(C, id, big); break; default: break; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 95b808fe4b1..7dde0a73d56 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -479,7 +479,6 @@ void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, char *name, in void uiStyleInit(void); /* interface_icons.c */ -void ui_id_icon_render(struct bContext *C, struct ID *id, int preview); int ui_id_icon_get(struct bContext *C, struct ID *id, int preview); /* resources.c */ |