svn merge ^/trunk/blender -r42009:42053
[blender.git] / source / blender / blenloader / intern / readfile.c
index b58a27f..f49a6be 100644 (file)
@@ -7430,6 +7430,67 @@ static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
        }
 }
 
+void do_versions_image_settings_2_60(Scene *sce)
+{
+       /* note: rd->subimtype is moved into indervidual settings now and no longer
+        * exists */
+       RenderData *rd= &sce->r;
+       ImageFormatData *imf= &sce->r.im_format;
+
+       imf->imtype= rd->imtype;
+       imf->planes= rd->planes;
+       imf->compress= rd->quality;
+       imf->quality= rd->quality;
+
+       /* default, was stored in multiple places, may override later */
+       imf->depth= R_IMF_CHAN_DEPTH_8;
+
+       /* openexr */
+       imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
+
+       switch (imf->imtype) {
+       case R_IMF_IMTYPE_OPENEXR:
+               imf->depth=  (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
+               if (rd->subimtype & R_PREVIEW_JPG) {
+                       imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
+               }
+               if (rd->subimtype & R_OPENEXR_ZBUF) {
+                       imf->flag |= R_IMF_FLAG_ZBUF;
+               }
+               break;
+       case R_IMF_IMTYPE_TIFF:
+               if (rd->subimtype & R_TIFF_16BIT) {
+                       imf->depth= R_IMF_CHAN_DEPTH_16;
+               }
+               break;
+       case R_IMF_IMTYPE_JP2:
+               if (rd->subimtype & R_JPEG2K_16BIT) {
+                       imf->depth= R_IMF_CHAN_DEPTH_16;
+               }
+               else if (rd->subimtype & R_JPEG2K_12BIT) {
+                       imf->depth= R_IMF_CHAN_DEPTH_12;
+               }
+
+               if (rd->subimtype & R_JPEG2K_YCC) {
+                       imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
+               }
+               if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
+                       imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
+               }
+               if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
+                       imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
+               }
+               break;
+       case R_IMF_IMTYPE_CINEON:
+       case R_IMF_IMTYPE_DPX:
+               if (rd->subimtype & R_CINEON_LOG) {
+                       imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
+               }
+               break;
+       }
+
+}
+
 static void do_versions(FileData *fd, Library *lib, Main *main)
 {
        /* WATCH IT!!!: pointers from libdata have not been converted */
@@ -12626,6 +12687,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
        /* put compatibility code here until next subversion bump */
        {
+               Scene *sce;
+               for(sce = main->scene.first; sce; sce = sce->id.next) {
+                       if (sce->r.im_format.depth == 0) {
+                               do_versions_image_settings_2_60(sce);
+                       }
+               }
        }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */