IRC reported bug:
authorTon Roosendaal <ton@blender.org>
Mon, 27 Nov 2006 13:00:50 +0000 (13:00 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 27 Nov 2006 13:00:50 +0000 (13:00 +0000)
When linking a referenced (Library) Image to a texture face, it wasn't
tagged to become saved in file. So you lost data.

Also fixed: tooltip for the "Li" icons was wrong.

source/blender/blenkernel/intern/image.c
source/blender/src/drawimage.c
source/blender/src/editsima.c
source/blender/src/headerbuttons.c

index a87b02b4153a1dd0307b4fa3899250119817bd74..cf19d64ca036e56c720b9394fbde54b3b0e20484 100644 (file)
@@ -140,7 +140,7 @@ Image *add_image(char *name)
                if( strcmp(strtest, str)==0 ) {
                        if(ima->anim==0 || ima->id.us==0) {
                                strcpy(ima->name, name);        /* for stringcode */
-                               ima->id.us++;
+                               ima->id.us++;                           /* officially should not, it doesn't link here! */
                                ima->ok= 1;
                                return ima;
                        }
index eef9bfbad08497dc97e669d799dc629de0e5990b..3d11568a8bce9727961be97fbe8880cc88af6134 100644 (file)
@@ -331,7 +331,8 @@ void image_changed(SpaceImage *sima, int dotile)
                                                        if(sima->image->tpageflag & IMA_TILES) tface->mode |= TF_TILES;
                                                        else tface->mode &= ~TF_TILES;
                                                
-                                                       if(sima->image->id.us==0) sima->image->id.us= 1;
+                                                       if(sima->image->id.us==0) id_us_plus(&sima->image->id);
+                                                       else id_lib_extern(&sima->image->id);
                                                }
                                        }
                                        tface++;
@@ -2201,7 +2202,7 @@ static ScrArea *imagewindow_set_render_display(void)
                sima->image= ima;
        }
        else if(sima->image->id.us==0)  /* well... happens on reload, dunno yet what todo, imagewindow cannot be user when hidden*/
-               sima->image->id.us= 1;
+               id_us_plus(&sima->image->id);
        
        /* this enforces reading empty buffer in what_image(), so display is cleared */
        IMB_freeImBuf(sima->image->ibuf);
index 46cdcad75dbc2b9d1ed4de58dc47c33760bbcdb2..3e25340048fcea5b6e2c45533e2dbf5de0546427 100644 (file)
@@ -1560,7 +1560,7 @@ static void image_replace(Image *old, Image *new)
        me= G.main->mesh.first;
        while(me) {
 
-               if(me->mtface) {
+               if(me->id.lib==NULL && me->mtface) {
                        tface= me->mtface;
                        a= me->totface;
                        while(a--) {
@@ -1575,7 +1575,9 @@ static void image_replace(Image *old, Image *new)
  
        }
        if(rep) {
-               if(new->id.us==0) new->id.us= 1;
+               if(new->id.us==0) id_us_plus(&new->id);
+               else id_lib_extern(&new->id);
+               
        }
        else error("Nothing replaced");
 }
index 03f5972ee0f2387a6ef6d5d132ed5610237eb6ee..26169c89345f9b5fc23ffb1131b7bbd0f6c89f4b 100644 (file)
@@ -334,8 +334,8 @@ int std_libbuttons(uiBlock *block, short xco, short yco,
                
                if(id->lib) {
                        
-                       if(parid && parid->lib) uiDefIconBut(block, BUT, 0, ICON_DATALIB,xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Displays name of the current Indirect Library Datablock. Click to change.");
-                       else uiDefIconBut(block, BUT, lib, ICON_PARLIB, xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Displays current Library Datablock name. Click to make local.");
+                       if(id->flag & LIB_INDIRECT) uiDefIconBut(block, BUT, 0, ICON_DATALIB,xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Indirect Library Datablock. Cannot change.");
+                       else uiDefIconBut(block, BUT, lib, ICON_PARLIB, xco,yco,XIC,YIC, 0, 0, 0, 0, 0, "Direct linked Library Datablock. Click to make local.");
                        
                        xco+= XIC;
                }