More fixes for bug [#25649], Image editor paint icon missing until
authorNicholas Bishop <nicholasbishop@gmail.com>
Tue, 18 Jan 2011 04:08:01 +0000 (04:08 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Tue, 18 Jan 2011 04:08:01 +0000 (04:08 +0000)
enter weight paint, hopefully fully fixed this time

* The texture selector for brushes wasn't updating. Seems that preview
  images have two sizes, small (icon) and big, but it was only
  updating if the icon size was set to update. Now both are checked.

* Also changed the previewimage arrays to use the already-existing
  PREVIEW_MIPMAPS define, makes it a little clearer what the arrays
  are for.

source/blender/editors/interface/interface_icons.c
source/blender/makesdna/DNA_ID.h

index bb6738c..df4ab33 100644 (file)
@@ -1004,17 +1004,18 @@ 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 preview)
 {
        PreviewImage *pi = BKE_previewimg_get(id); 
+       int i;
                
-       if (pi) {                       
-               if ((pi->changed[0] ||!pi->rect[0])) /* changed only ever set by dynamic icons */
-               {
-                       /* create the preview rect if necessary */                              
-                       
-                       icon_set_image(C, id, pi, 0);           /* icon size */
-                       if (preview)
-                               icon_set_image(C, id, pi, 1);   /* preview size */
-                       
-                       pi->changed[0] = 0;
+       if(!pi)
+               return;
+
+       for(i = 0; i < PREVIEW_MIPMAPS; i++) {
+               /* check if preview rect needs to be created; changed
+                  only set by dynamic icons */
+               if((pi->changed[i] || !pi->rect[i])) {
+                       if(i == 0 || preview)
+                               icon_set_image(C, id, pi, i);
+                       pi->changed[i] = 0;
                }
        }
 }
index 8356176..ce1c328 100644 (file)
@@ -127,11 +127,11 @@ typedef struct Library {
 #define PREVIEW_MIPMAP_LARGE 1
 
 typedef struct PreviewImage {
-       unsigned int w[2];
-       unsigned int h[2];      
-       short changed[2];
-       short changed_timestamp[2];
-       unsigned int * rect[2];
+       unsigned int w[PREVIEW_MIPMAPS];
+       unsigned int h[PREVIEW_MIPMAPS];        
+       short changed[PREVIEW_MIPMAPS];
+       short changed_timestamp[PREVIEW_MIPMAPS];
+       unsigned int * rect[PREVIEW_MIPMAPS];
 } PreviewImage;
 
 /**