Bugfix #25720
authorTon Roosendaal <ton@blender.org>
Wed, 19 Jan 2011 17:10:05 +0000 (17:10 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 19 Jan 2011 17:10:05 +0000 (17:10 +0000)
Preview icons got lost... commit of yesterday caused it.
Conflict between preview render icons, and brush icons...

source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_intern.h

index bd79353..788de41 100644 (file)
@@ -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;
index 95b808f..7dde0a7 100644 (file)
@@ -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 */