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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-26 14:38:32 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-26 14:38:32 +0300
commit931ac1cebdc9b24bbe523a02d09babf1f3e1d1c3 (patch)
treec3d9b248084c3c575c34b1cd30345c7dfb19a0ff /source/blender
parente9ce2a9f3f7e93692a6dc1c25ed050391f510436 (diff)
Bugfix: recent rollback of premul changes gave issues. The premul
flag bit was changed and not changed back, and the flag was moved back from image user to image. This meant that files saved both before and during the premul changes did not read premul settings correct anymore. Now it uses the old premul flag bit again, which also keeps forward compatibility.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/readfile.c47
-rw-r--r--source/blender/makesdna/DNA_image_types.h4
2 files changed, 47 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index cf33bd4c5d5..6feb0d1cc2d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4644,10 +4644,13 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
}
}
-static void ntree_version_245(bNodeTree *ntree)
+static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
{
bNode *node;
NodeTwoFloats *ntf;
+ ID *nodeid;
+ Image *image;
+ ImageUser *iuser;
if(ntree->type==NTREE_COMPOSIT) {
for(node= ntree->nodes.first; node; node= node->next) {
@@ -4659,6 +4662,21 @@ static void ntree_version_245(bNodeTree *ntree)
ntf->x= 1.0f;
}
}
+
+ /* fix for temporary flag changes during 245 cycle */
+ nodeid= newlibadr(fd, lib, node->id);
+ if(node->storage && nodeid && GS(nodeid->name) == ID_IM) {
+ image= (Image*)nodeid;
+ iuser= node->storage;
+ if(iuser->flag & IMA_OLD_PREMUL) {
+ iuser->flag &= ~IMA_OLD_PREMUL;
+ iuser->flag |= IMA_DO_PREMUL;
+ }
+ if(iuser->flag & IMA_DO_PREMUL) {
+ image->flag &= ~IMA_OLD_PREMUL;
+ image->flag |= IMA_DO_PREMUL;
+ }
+ }
}
}
}
@@ -6846,6 +6864,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
World *wrld;
Mesh *me;
bNodeTree *ntree;
+ Tex *tex;
/* unless the file was created 2.44.3 but not 2.45, update the constraints */
if ( !(main->versionfile==244 && main->subversionfile==3) &&
@@ -7032,7 +7051,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(sce= main->scene.first; sce; sce= sce->id.next) {
if(sce->nodetree)
- ntree_version_245(sce->nodetree);
+ ntree_version_245(fd, lib, sce->nodetree);
if(sce->r.simplify_shadowsamples == 0) {
sce->r.simplify_subsurf= 6;
@@ -7043,7 +7062,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
for(ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
- ntree_version_245(ntree);
+ ntree_version_245(fd, lib, ntree);
+
+ /* fix for temporary flag changes during 245 cycle */
+ for(ima= main->image.first; ima; ima= ima->id.next) {
+ if(ima->flag & IMA_OLD_PREMUL) {
+ ima->flag &= ~IMA_OLD_PREMUL;
+ ima->flag |= IMA_DO_PREMUL;
+ }
+ }
+
+ for(tex=main->tex.first; tex; tex=tex->id.next) {
+ if(tex->iuser.flag & IMA_OLD_PREMUL) {
+ tex->iuser.flag &= ~IMA_OLD_PREMUL;
+ tex->iuser.flag |= IMA_DO_PREMUL;
+
+ }
+
+ ima= newlibadr(fd, lib, tex->ima);
+ if(ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
+ ima->flag &= ~IMA_OLD_PREMUL;
+ ima->flag |= IMA_DO_PREMUL;
+ }
+ }
if (main->versionfile < 245 || main->subversionfile < 12)
{
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index d5e4b7a1142..ef79f2e941f 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -58,6 +58,7 @@ typedef struct ImageUser {
/* iuser->flag */
#define IMA_ANIM_ALWAYS 1
#define IMA_ANIM_REFRESHED 2
+/* #define IMA_DO_PREMUL 4 */
typedef struct Image {
ID id;
@@ -104,11 +105,12 @@ typedef struct Image {
/* flag */
#define IMA_FIELDS 1
#define IMA_STD_FIELD 2
+#define IMA_DO_PREMUL 4
#define IMA_REFLECT 16
#define IMA_NOCOLLECT 32
#define IMA_ANTIALI 64
-#define IMA_DO_PREMUL 128
+#define IMA_OLD_PREMUL 128
/* tpageflag */
#define IMA_TILES 1