Color management: fix missed color management settings for new created scenes
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 17 Jul 2012 11:10:40 +0000 (11:10 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 17 Jul 2012 11:10:40 +0000 (11:10 +0000)
- Initialize color management settings if creating new scene
- Copy settings from active scene if creating with copying settings
  or if using other copy/link object settings

This also should fix issue with Export UV Layout operator

source/blender/blenkernel/intern/scene.c

index d9afd1eefb48edd2865130cf376721caea9fab51..960713fd5d198427625fd52fd43c56d83f59df16 100644 (file)
@@ -57,6 +57,7 @@
 
 #include "BKE_anim.h"
 #include "BKE_animsys.h"
+#include "BKE_colortools.h"
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
 #include "BKE_group.h"
@@ -132,6 +133,8 @@ Scene *BKE_scene_copy(Scene *sce, int type)
                MEM_freeN(scen->toolsettings);
        }
        else {
+               ImageFormatData *im_format, *im_formatn;
+
                scen = BKE_libblock_copy(&sce->id);
                BLI_duplicatelist(&(scen->base), &(sce->base));
                
@@ -166,6 +169,13 @@ Scene *BKE_scene_copy(Scene *sce, int type)
                        obase = obase->next;
                        base = base->next;
                }
+
+               /* copy color management settings */
+               im_format = &sce->r.im_format;
+               im_formatn = &scen->r.im_format;
+
+               BKE_color_managed_display_settings_copy(&im_formatn->display_settings, &im_format->display_settings);
+               BKE_color_managed_view_settings_copy(&im_formatn->view_settings, &im_format->view_settings);
        }
 
        /* tool settings */
@@ -545,6 +555,9 @@ Scene *BKE_scene_add(const char *name)
 
        sound_create_scene(sce);
 
+       BKE_color_managed_display_settings_init(&sce->r.im_format.display_settings);
+       BKE_color_managed_view_settings_init(&sce->r.im_format.view_settings);
+
        return sce;
 }