Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9c6e82cf998..48e2814e018 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8663,8 +8663,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 5)) {
Scene *scene;
- Image *image, *nimage;
- Tex *tex, *otex;
+ Image *image;
+ Tex *tex;
bNodeTreeType *ntreetype;
bNodeTree *ntree;
@@ -8711,67 +8711,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
else {
BKE_image_alpha_mode_from_extension(image);
}
-
- image->flag &= ~IMA_DONE_TAG;
}
- /* use alpha flag moved from texture to image datablock */
for (tex = main->tex.first; tex; tex = tex->id.next) {
if (tex->type == TEX_IMAGE && (tex->imaflag & TEX_USEALPHA) == 0) {
image = blo_do_versions_newlibadr(fd, tex->id.lib, tex->ima);
- /* skip if no image or already tested */
- if (!image || (image->flag & (IMA_DONE_TAG|IMA_IGNORE_ALPHA)))
- continue;
-
- image->flag |= IMA_DONE_TAG;
-
- /* we might have some textures using alpha and others not, so we check if
- * they exist and duplicate the image datablock if necessary */
- for (otex = main->tex.first; otex; otex = otex->id.next)
- if (otex->type == TEX_IMAGE && (otex->imaflag & TEX_USEALPHA))
- if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima))
- break;
-
- /* no duplication if the texture and image datablock are not
- * from the same .blend file, the image datablock may not have
- * been loaded from a library file otherwise */
- if (otex && (tex->id.lib == image->id.lib)) {
- /* copy image datablock */
- nimage = BKE_image_copy(main, image);
- nimage->flag |= IMA_IGNORE_ALPHA|IMA_DONE_TAG;
- nimage->id.us--;
-
- /* we need to do some trickery to make file loading think
- * this new datablock is part of file we're loading */
- blo_do_versions_oldnewmap_insert(fd->libmap, nimage, nimage, 0);
- nimage->id.lib = image->id.lib;
- nimage->id.flag |= (image->id.flag & LIB_NEED_LINK);
-
- /* assign new image, and update the users counts accordingly */
- for (otex = main->tex.first; otex; otex = otex->id.next) {
- if (otex->type == TEX_IMAGE && (otex->imaflag & TEX_USEALPHA) == 0) {
- if (image == blo_do_versions_newlibadr(fd, otex->id.lib, otex->ima)) {
- if (!(otex->id.flag & LIB_NEED_LINK)) {
- image->id.us--;
- nimage->id.us++;
- }
- otex->ima = nimage;
- break;
- }
- }
- }
- }
- else {
- /* no other textures using alpha, just set the flag */
+ if (image && (image->flag & IMA_DO_PREMUL) == 0)
image->flag |= IMA_IGNORE_ALPHA;
- }
}
}
- for (image = main->image.first; image; image = image->id.next)
- image->flag &= ~IMA_DONE_TAG;
-
ntreetype = ntreeGetType(NTREE_COMPOSIT);
if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, fd, do_version_node_straight_image_alpha_workaround);
@@ -8779,6 +8729,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next)
do_version_node_straight_image_alpha_workaround(fd, NULL, ntree);
}
+ else if (main->versionfile < 266 || (main->versionfile == 266 && main->subversionfile < 1)) {
+ /* texture use alpha was removed for 2.66 but added back again for 2.66a,
+ * for compatibility all textures assumed it to be enabled */
+ Tex *tex;
+
+ for (tex = main->tex.first; tex; tex = tex->id.next)
+ if (tex->type == TEX_IMAGE)
+ tex->imaflag |= TEX_USEALPHA;
+ }
if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
Curve *cu;