diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 18 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 28 |
2 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1d76bef8dc1..93bc0502b19 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8649,6 +8649,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (scene = main->scene.first; scene; scene = scene->id.next) { Sequence *seq; + bool set_premul = false; SEQ_BEGIN (scene->ed, seq) { @@ -8659,6 +8660,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if (scene->r.bake_samples == 0) scene->r.bake_samples = 256; + + if (scene->world) { + World *world = blo_do_versions_newlibadr(fd, scene->id.lib, scene->world); + + if (is_zero_v3(&world->horr)) { + if ((world->skytype & WO_SKYBLEND) == 0 || is_zero_v3(&world->zenr)) { + set_premul = true; + } + } + } + else + set_premul = true; + + if (set_premul) { + printf("2.66 versioning fix: replacing black sky with premultiplied alpha for scene %s\n", scene->id.name + 2); + scene->r.alphamode = R_ALPHAPREMUL; + } } for (image = main->image.first; image; image = image->id.next) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 2c90110b458..d2b47a7bf4d 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1355,6 +1355,19 @@ static int composite_needs_render(Scene *sce, int this_scene) return 0; } +static bool rlayer_node_uses_alpha(bNodeTree *ntree, bNode *node) +{ + bNodeSocket *sock; + + for (sock = node->outputs.first; sock; sock = sock->next) { + /* Weak! but how to make it better? */ + if (!strcmp(sock->name, "Alpha") && nodeCountSocketLinks(ntree, sock) > 0) + return true; + } + + return false; +} + static void tag_scenes_for_render(Render *re) { bNode *node; @@ -1372,6 +1385,21 @@ static void tag_scenes_for_render(Render *re) for (node = re->scene->nodetree->nodes.first; node; node = node->next) { if (node->type == CMP_NODE_R_LAYERS) { if (node->id) { + if (!MAIN_VERSION_ATLEAST(re->main, 265, 5)) { + if (rlayer_node_uses_alpha(re->scene->nodetree, node)) { + Scene *scene = (Scene*) node->id; + + if (scene->r.alphamode != R_ALPHAPREMUL) { + BKE_reportf(re->reports, RPT_WARNING, "Setting scene %s alpha mode to Premul\n", scene->id.name + 2); + + /* also print, so feedback is immediate */ + printf("2.66 versioning fix: setting scene %s alpha mode to Premul\n", scene->id.name + 2); + + scene->r.alphamode = R_ALPHAPREMUL; + } + } + } + if (node->id != (ID *)re->scene) node->id->flag |= LIB_DOIT; } |