[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50533] branches/soc-2011-tomato/source/ blender: Color Management: improve compatibility with old files with disabled color management
Sergey Sharybin
sergey.vfx at gmail.com
Tue Sep 11 18:28:01 CEST 2012
Revision: 50533
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50533
Author: nazgul
Date: 2012-09-11 16:28:01 +0000 (Tue, 11 Sep 2012)
Log Message:
-----------
Color Management: improve compatibility with old files with disabled color management
Still not perfect compatibility, but making it better is a bit tricky now.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
branches/soc-2011-tomato/source/blender/compositor/operations/COM_ImageOperation.cpp
Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2012-09-11 12:35:25 UTC (rev 50532)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2012-09-11 16:28:01 UTC (rev 50533)
@@ -7927,20 +7927,40 @@
{
Scene *scene;
Image *ima;
+ int colormanagement_disabled = FALSE;
+ /* make scenes which are not using color management have got None as display device,
+ * so they wouldn't perform linear-to-sRGB conversion on display
+ */
for (scene = main->scene.first; scene; scene = scene->id.next) {
if ((scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) == 0) {
ColorManagedDisplaySettings *display_settings = &scene->display_settings;
if (display_settings->display_device[0] == 0) {
BKE_scene_disable_color_management(scene);
+
}
+
+ colormanagement_disabled = TRUE;
}
}
for (ima = main->image.first; ima; ima = ima->id.next) {
- if (ima->source == IMA_SRC_VIEWER)
+ if (ima->source == IMA_SRC_VIEWER) {
ima->flag |= IMA_VIEW_AS_RENDER;
+ }
+ else if (colormanagement_disabled) {
+ /* if colormanagement not used, set image's color space to raw, so no sRGB->linear conversion
+ * would happen on display and render
+ * there's no clear way to check whether color management is enabled or not in render engine
+ * so set all images to raw if there's at least one scene with color management disabled
+ * this would still behave incorrect in cases when color management was used for only some
+ * of scenes, but such a setup is crazy anyway and think it's fair enough to break compatibility
+ * in that cases
+ */
+
+ BLI_strncpy(ima->colorspace_settings.name, "Raw", sizeof(ima->colorspace_settings.name));
+ }
}
}
Modified: branches/soc-2011-tomato/source/blender/compositor/operations/COM_ImageOperation.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/operations/COM_ImageOperation.cpp 2012-09-11 12:35:25 UTC (rev 50532)
+++ branches/soc-2011-tomato/source/blender/compositor/operations/COM_ImageOperation.cpp 2012-09-11 16:28:01 UTC (rev 50533)
@@ -33,6 +33,7 @@
#include "RE_render_ext.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+ #include "IMB_colormanagement.h"
}
BaseImageOperation::BaseImageOperation() : NodeOperation()
@@ -70,7 +71,7 @@
}
if (ibuf->rect_float == NULL) {
- IMB_float_from_rect(ibuf);
+ IMB_colormanagement_imbuf_float_from_rect(ibuf);
}
return ibuf;
}
More information about the Bf-blender-cvs
mailing list