From d0f4e7767ecaf2158a7a5403537c78d8fa4439a4 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 19 Jan 2011 17:10:05 +0000 Subject: Bugfix #25720 Preview icons got lost... commit of yesterday caused it. Conflict between preview render icons, and brush icons... --- source/blender/editors/interface/interface_icons.c | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/interface/interface_icons.c') 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; -- cgit v1.2.3