diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-08 19:56:14 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-08 19:56:14 +0400 |
commit | 32a6a3eb63b80e47fb083d49814090b89541e9ab (patch) | |
tree | 9575675b6a615906de50834b3ec0b39c2fa12c0b /source/blender/blenkernel | |
parent | 95b28a65f366c4a1f571f35dabd79edaa94cfe51 (diff) |
Fix #33747: do better backwards compatibility for image transparency changes.
The use alpha option moved from the texture datablock to the image, and now it
will duplicate the image datablock in case you have one texture using alpha and
the other not.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index f098defb907..d12b048bc96 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -205,7 +205,7 @@ void BKE_image_memorypack(struct Image *ima); void BKE_image_print_memlist(void); /* empty image block, of similar type and filename */ -struct Image *BKE_image_copy(struct Image *ima); +struct Image *BKE_image_copy(struct Main *bmain, struct Image *ima); /* merge source into dest, and free source */ void BKE_image_merge(struct Image *dest, struct Image *source); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 39d76eb36f1..018cd25187a 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -323,9 +323,9 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) } /* empty image block, of similar type and filename */ -Image *BKE_image_copy(Image *ima) +Image *BKE_image_copy(Main *bmain, Image *ima) { - Image *nima = image_alloc(G.main, ima->id.name + 2, ima->source, ima->type); + Image *nima = image_alloc(bmain, ima->id.name + 2, ima->source, ima->type); BLI_strncpy(nima->name, ima->name, sizeof(ima->name)); @@ -343,6 +343,9 @@ Image *BKE_image_copy(Image *ima) BKE_color_managed_colorspace_settings_copy(&nima->colorspace_settings, &ima->colorspace_settings); + if (ima->packedfile) + nima->packedfile = dupPackedFile(ima->packedfile); + return nima; } @@ -433,7 +436,7 @@ void BKE_image_make_local(struct Image *ima) extern_local_image(ima); } else if (is_local && is_lib) { - Image *ima_new = BKE_image_copy(ima); + Image *ima_new = BKE_image_copy(bmain, ima); ima_new->id.us = 0; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index cd40f752b03..0c5e2b89cf7 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -312,7 +312,7 @@ int id_copy(ID *id, ID **newid, int test) if (!test) *newid = (ID *)BKE_texture_copy((Tex *)id); return 1; case ID_IM: - if (!test) *newid = (ID *)BKE_image_copy((Image *)id); + if (!test) *newid = (ID *)BKE_image_copy(G.main, (Image *)id); return 1; case ID_LT: if (!test) *newid = (ID *)BKE_lattice_copy((Lattice *)id); |