Color management: get rid of hardcoded color space None

This commit is contained in:
Sergey Sharybin
2012-09-10 17:38:48 +00:00
parent 74885d1d84
commit b4cac859e9
2 changed files with 11 additions and 16 deletions

View File

@@ -904,9 +904,6 @@ static void colormanage_check_view_settings(ColorManagedDisplaySettings *display
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 @@ static void colormanage_check_colorspace_settings(ColorManagedColorspaceSettings
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 @@ static void colormanagement_transform_ex(float *buffer, int width, int height, i
{
ColormanageProcessor *cm_processor;
if (!strcmp(from_colorspace, "NONE")) {
if (from_colorspace[0] == '\0') {
return;
}
@@ -1416,7 +1413,7 @@ void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspac
{
ColormanageProcessor *cm_processor;
if (!strcmp(from_colorspace, "NONE")) {
if (from_colorspace[0] == '\0') {
return;
}
@@ -1667,9 +1664,8 @@ void IMB_colormanagement_pixel_from_role_v4(float pixel[4], int role)
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 @@ const char *IMB_colormanagement_view_get_indexed_name(int index)
return view->name;
}
return "NONE";
return NULL;
}
const char *IMB_colormanagement_view_get_default_name(const char *display_name)
@@ -2225,7 +2221,7 @@ const char *IMB_colormanagement_colorspace_get_indexed_name(int index)
return colorspace->name;
}
return "NONE";
return "";
}
/*********************** RNA helper functions *************************/

View File

@@ -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 @@ static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(bCo
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 @@ static void rna_def_colormanage(BlenderRNA *brna)
{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");