Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/OpenColorIO/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ void Config::validate() const
os << "Config failed color space validation. ";
os << "The color space '" << name << "' ";
os << "refers to an interop ID, '" << interop << "', ";
os << "which is not defined in this config.";
os << "which is not a color space name or alias.";
getImpl()->m_validationtext = os.str();
throw Exception(getImpl()->m_validationtext.c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenColorIO/ViewingRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ViewingRule
os << "The rule '" << m_name << "' ";
os << "refers to encoding '" << std::string(encName);
os << "' that is not used by any of the color spaces.";
LogWarning(os.str());
LogInfo(os.str());
}
}
if (numCS + numEnc == 0)
Expand Down
73 changes: 57 additions & 16 deletions src/apps/ociocheck/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const char * DESC_STRING = "\n\n"
"that has been manually edited, using the '-o' option.\n";


// returns true if the interopID is valid
// Returns true if the interopID is valid.
bool isValidInteropID(const std::string& id)
{
// See https://github.com/AcademySoftwareFoundation/ColorInterop for the details.
Expand Down Expand Up @@ -56,7 +56,7 @@ bool isValidInteropID(const std::string& id)
"srgb_rec709_display",
"g24_rec709_display",
"srgb_p3d65_display",
"srgbx_p3d65_display",
"srgbe_p3d65_display",
"pq_p3d65_display",
"pq_rec2020_display",
"hlg_rec2020_display",
Expand All @@ -70,44 +70,45 @@ bool isValidInteropID(const std::string& id)
if (id.empty())
return true;

// Check if has a namespace.
// Check if the ID has a namespace.
size_t pos = id.find(':');
if (pos == std::string::npos)
{
// No namespace, so id must be in the Color Interop Forum ID list.
// No namespace, so the ID must be in the Color Interop Forum ID list.
if (cifTextureIDs.count(id) == 0 && cifDisplayIDs.count(id)==0)
{
std::cout << "ERROR: InteropID '" << id << "' is not valid. "
"It should either be one of Color Interop Forum standard IDs or "
std::cout << "WARNING: InteropID '" << id << "' is not valid. "
"It should either be one of the Color Interop Forum standard IDs or "
"it must contain a namespace followed by ':', e.g. 'mycompany:mycolorspace'." <<
std::endl;
return false;
}
}
else
{
// Namespace found, split into namespace and id.
// Namespace found, split into namespace and ID.
std::string ns = id.substr(0, pos);
std::string cs = id.substr(pos+1);

// Id should not be in the Color Interop Forum ID list.
// The ID should not be in the Color Interop Forum ID list.
if (cifTextureIDs.count(cs) > 0 || cifDisplayIDs.count(cs)> 0)
{
std::cout << "ERROR: InteropID '" << id << "' is not valid. "
"The ID part must not be one of the Color Interop Forum standard IDs when a namespace is used." <<
std::endl;
std::cout << "WARNING: InteropID '" << id << "' is not valid. "
"The ID part must not be one of the Color Interop Forum standard IDs "
"when a namespace is used." << std::endl;
return false;
}
}

// all clear.
// All clear.
return true;
}

int main(int argc, const char **argv)
{
bool help = false;
int errorcount = 0;
int warningcount = 0;
std::string inputconfig;
std::string outputconfig;

Expand Down Expand Up @@ -357,6 +358,7 @@ int main(int argc, const char **argv)
if(!cs)
{
std::cout << "WARNING: NOT DEFINED (" << role << ")" << std::endl;
warningcount += 1;
}
}
}
Expand All @@ -369,6 +371,9 @@ int main(int argc, const char **argv)
OCIO::SEARCH_REFERENCE_SPACE_ALL, // Iterate over scene & display color spaces.
OCIO::COLORSPACE_ALL); // Iterate over active & inactive color spaces.

bool foundCategory = false;
bool foundNoCategory = false;

for(int i=0; i<numCS; ++i)
{
OCIO::ConstColorSpaceRcPtr cs = config->getColorSpace(config->getColorSpaceNameByIndex(
Expand All @@ -381,10 +386,16 @@ int main(int argc, const char **argv)
{
if (!isValidInteropID(interopID))
{
errorcount += 1;
warningcount += 1;
}
}

if(!config->isInactiveColorSpace(cs->getName()))
{
if(cs->getNumCategories() > 0) foundCategory = true;
else foundNoCategory = true;
}

// Try to load the transform for the to_ref direction -- this will load any LUTs.
bool toRefOK = true;
std::string toRefErrorText;
Expand Down Expand Up @@ -440,6 +451,14 @@ int main(int argc, const char **argv)
std::cout << cs->getName() << std::endl;
}
}

if(foundCategory && foundNoCategory)
{
// Categories should either be missing in all, or present in all active items.
std::cout << "\nWARNING: The config has some color spaces "
"where the categories are not set.\n";
warningcount += 1;
}
}

{
Expand All @@ -453,11 +472,20 @@ int main(int argc, const char **argv)
std::cout << "no named transforms defined" << std::endl;
}

bool foundCategory = false;
bool foundNoCategory = false;

for(int i = 0; i<numNT; ++i)
{
OCIO::ConstNamedTransformRcPtr nt = config->getNamedTransform(
config->getNamedTransformNameByIndex(OCIO::NAMEDTRANSFORM_ALL, i));

if(!config->isInactiveColorSpace(nt->getName()))
{
if(nt->getNumCategories() > 0) foundCategory = true;
else foundNoCategory = true;
}

// Try to load the transform -- this will load any LUTs.
bool fwdOK = true;
std::string fwdErrorText;
Expand Down Expand Up @@ -513,6 +541,14 @@ int main(int argc, const char **argv)
std::cout << nt->getName() << std::endl;
}
}

if(foundCategory && foundNoCategory)
{
// Categories should either be missing in all, or present in all active items.
std::cout << "\nWARNING: The config has some named transforms "
"where the categories are not set.\n";
warningcount += 1;
}
}

{
Expand Down Expand Up @@ -605,11 +641,11 @@ int main(int argc, const char **argv)
StringUtils::StringVec svec = StringUtils::SplitByLines(logGuard.output());
if (!StringUtils::Contain(svec, "[OpenColorIO Error]"))
{
std::cout << "passed" << std::endl;
std::cout << "Validation: passed" << std::endl;
}
else
{
std::cout << "failed" << std::endl;
std::cout << "Validation: failed" << std::endl;
errorcount += 1;
}
}
Expand All @@ -618,7 +654,7 @@ int main(int argc, const char **argv)
std::cout << "ERROR:" << std::endl;
errorcount += 1;
std::cout << exception.what() << std::endl;
std::cout << "failed" << std::endl;
std::cout << "Validation: failed" << std::endl;
}

std::cout << std::endl;
Expand Down Expand Up @@ -657,6 +693,11 @@ int main(int argc, const char **argv)
return 1;
}

if(warningcount > 0)
{
std::cout << "\nWarnings encountered: " << warningcount << std::endl;
}

std::cout << std::endl;
if(errorcount == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/cpu/ColorSpace_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ active_views: []
OCIO_CHECK_THROW_WHAT(config->validate(),
OCIO::Exception,
"Config failed color space validation. The color space 'raw' refers "
"to an interop ID, 'data', which is not defined in this config.");
"to an interop ID, 'data', which is not a color space name or alias.");
}

// Test that the interop id can be found in another color space.
Expand Down