[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50509] branches/soc-2011-tomato/source/ blender: Color management: get rid of hardcoded color space None

Sergey Sharybin sergey.vfx at gmail.com
Mon Sep 10 19:38:48 CEST 2012


Revision: 50509
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50509
Author:   nazgul
Date:     2012-09-10 17:38:48 +0000 (Mon, 10 Sep 2012)
Log Message:
-----------
Color management: get rid of hardcoded color space None

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c	2012-09-10 17:24:48 UTC (rev 50508)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c	2012-09-10 17:38:48 UTC (rev 50509)
@@ -904,9 +904,6 @@
 static void colormanage_check_colorspace_settings(ColorManagedColorspaceSettings *colorspace_settings, const char *what)
 {
 	if (colorspace_settings->name[0] == '\0') {
-		BLI_strncpy(colorspace_settings->name, "NONE", sizeof(colorspace_settings->name));
-	}
-	else if (!strcmp(colorspace_settings->name, "NONE")) {
 		/* pass */
 	}
 	else {
@@ -916,7 +913,7 @@
 			printf("Color management: %s colorspace \"%s\" not found, setting NONE instead.\n",
 			       what, colorspace_settings->name);
 
-			BLI_strncpy(colorspace_settings->name, "NONE", sizeof(colorspace_settings->name));
+			BLI_strncpy(colorspace_settings->name, "", sizeof(colorspace_settings->name));
 		}
 	}
 
@@ -1375,7 +1372,7 @@
 {
 	ColormanageProcessor *cm_processor;
 
-	if (!strcmp(from_colorspace, "NONE")) {
+	if (from_colorspace[0] == '\0') {
 		return;
 	}
 
@@ -1416,7 +1413,7 @@
 {
 	ColormanageProcessor *cm_processor;
 
-	if (!strcmp(from_colorspace, "NONE")) {
+	if (from_colorspace[0] == '\0') {
 		return;
 	}
 
@@ -1667,9 +1664,8 @@
 void IMB_colormanagement_imbuf_assign_spaces(ImBuf *ibuf, ColorManagedColorspaceSettings *colorspace_settings)
 {
 #ifdef WITH_OCIO
-	/* OCIO_TODO: get rid of NONE color space */
 	if (colorspace_settings) {
-		if (colorspace_settings->name[0] == 0 || !strcmp(colorspace_settings->name, "NONE")) {
+		if (colorspace_settings->name[0] == '\0') {
 			/* when opening new image, assign it's color space based on default roles */
 
 			if (ibuf->rect_float)
@@ -2121,7 +2117,7 @@
 		return view->name;
 	}
 
-	return "NONE";
+	return NULL;
 }
 
 const char *IMB_colormanagement_view_get_default_name(const char *display_name)
@@ -2225,7 +2221,7 @@
 		return colorspace->name;
 	}
 
-	return "NONE";
+	return "";
 }
 
 /*********************** RNA helper functions *************************/

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c	2012-09-10 17:24:48 UTC (rev 50508)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_color.c	2012-09-10 17:38:48 UTC (rev 50509)
@@ -37,11 +37,6 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-static EnumPropertyItem color_space_items[] = {
-	{0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"},
-	{0, NULL, 0, NULL, NULL}
-};
-
 #ifdef RNA_RUNTIME
 
 #include "RNA_access.h"
@@ -461,7 +456,6 @@
 	EnumPropertyItem *items = NULL;
 	int totitem = 0;
 
-	RNA_enum_item_add(&items, &totitem, &color_space_items[0]);
 	IMB_colormanagement_colorspace_items_add(&items, &totitem);
 	RNA_enum_item_end(&items, &totitem);
 
@@ -857,6 +851,11 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem color_space_items[] = {
+		{0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"},
+		{0, NULL, 0, NULL, NULL}
+	};
+
 	/* ** Display Settings  **  */
 	srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
 	RNA_def_struct_ui_text(srna, "ColorManagedDisplaySettings", "Color management specific to display device");




More information about the Bf-blender-cvs mailing list