Merged changes in the trunk up to revision 42116.
[blender.git] / source / blender / blenloader / intern / readfile.c
index c96d7f7ffa1e8d3a6e331adcbd1d1c303c905767..9246773bdc1825a8e0f339b98f5653733627b048 100644 (file)
@@ -501,7 +501,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
 {
        Main *m;
        Library *lib;
-       char name1[FILE_MAXDIR+FILE_MAXFILE];
+       char name1[FILE_MAX];
        
        BLI_strncpy(name1, filepath, sizeof(name1));
        cleanup_path(relabase, name1);
@@ -6668,8 +6668,8 @@ static void customdata_version_242(Mesh *me)
 
                if (layer->type == CD_MTFACE) {
                        if (layer->name[0] == 0) {
-                               if (mtfacen == 0) strcpy(layer->name, "UVTex");
-                               else sprintf(layer->name, "UVTex.%.3d", mtfacen);
+                               if (mtfacen == 0) strcpy(layer->name, "UVMap");
+                               else sprintf(layer->name, "UVMap.%.3d", mtfacen);
                        }
                        mtfacen++;
                }
@@ -7537,6 +7537,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 */
@@ -12733,6 +12794,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);
+                       }
+               }
        }
 
        /* default values in Freestyle settings */