Packing Images fix:

- a 'procedural image' like 'UV Test Grid' now can be directly packed,
  it does ask first for confirming to pack it as PNG
This commit is contained in:
Ton Roosendaal
2006-12-21 13:39:02 +00:00
parent fc00e73a83
commit edccdf9340
3 changed files with 6 additions and 3 deletions

View File

@@ -489,8 +489,10 @@ void BKE_image_memorypack(Image *ima)
ibuf->encodedsize= 0;
ibuf->userflags &= ~IB_BITMAPDIRTY;
if(ima->source==IMA_SRC_GENERATED)
if(ima->source==IMA_SRC_GENERATED) {
ima->source= IMA_SRC_FILE;
ima->type= IMA_TYPE_IMAGE;
}
}
}

View File

@@ -1912,7 +1912,8 @@ void pack_image_sima()
else {
ImBuf *ibuf= BKE_image_get_ibuf(ima, &G.sima->iuser);
if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) {
error("Can't pack painted image. Save image or use Repack as PNG.");
if(okee("Can't pack painted image. Use Repack as PNG?"))
BKE_image_memorypack(ima);
}
else {
ima->packedfile = newPackedFile(ima->name);

View File

@@ -1162,7 +1162,7 @@ void image_buttons(void)
if (ima->packedfile) {
headerbuttons_packdummy = 1;
}
if (ima->packedfile && (ibuf->userflags & IB_BITMAPDIRTY))
if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
uiDefIconButBitI(block, TOG, 1, B_SIMA_REPACK, ICON_UGLYPACKAGE, xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG");
else
uiDefIconButBitI(block, TOG, 1, B_SIMAPACKIMA, ICON_PACKAGE, xco,0,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image");