From 3e7f95a900c77d39dd2c1b533f5c8e3301411871 Mon Sep 17 00:00:00 2001 From: Doug Walker Date: Fri, 3 Oct 2025 00:57:29 -0400 Subject: [PATCH 1/2] Fix ociocheck Signed-off-by: Doug Walker --- src/apps/ociocheck/main.cpp | 67 ++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/src/apps/ociocheck/main.cpp b/src/apps/ociocheck/main.cpp index 5c66a7eba..554545efd 100644 --- a/src/apps/ociocheck/main.cpp +++ b/src/apps/ociocheck/main.cpp @@ -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. @@ -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", @@ -70,15 +70,15 @@ 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; @@ -86,21 +86,21 @@ bool isValidInteropID(const std::string& id) } 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; } @@ -108,6 +108,7 @@ int main(int argc, const char **argv) { bool help = false; int errorcount = 0; + int warningcount = 0; std::string inputconfig; std::string outputconfig; @@ -357,6 +358,7 @@ int main(int argc, const char **argv) if(!cs) { std::cout << "WARNING: NOT DEFINED (" << role << ")" << std::endl; + warningcount += 1; } } } @@ -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; igetColorSpace(config->getColorSpaceNameByIndex( @@ -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; @@ -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; + } } { @@ -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; igetNamedTransform( 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; @@ -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; + } } { @@ -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) { From e18938a7a06d3b022f75fbffac7cf8d67f7f3d33 Mon Sep 17 00:00:00 2001 From: Doug Walker Date: Fri, 17 Oct 2025 17:19:16 -0400 Subject: [PATCH 2/2] Minor improvements Signed-off-by: Doug Walker --- src/OpenColorIO/Config.cpp | 2 +- src/OpenColorIO/ViewingRules.cpp | 2 +- src/apps/ociocheck/main.cpp | 6 +++--- tests/cpu/ColorSpace_tests.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/OpenColorIO/Config.cpp b/src/OpenColorIO/Config.cpp index 7072c50df..2ac057244 100644 --- a/src/OpenColorIO/Config.cpp +++ b/src/OpenColorIO/Config.cpp @@ -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()); } diff --git a/src/OpenColorIO/ViewingRules.cpp b/src/OpenColorIO/ViewingRules.cpp index bbe27172c..2db7d1e49 100644 --- a/src/OpenColorIO/ViewingRules.cpp +++ b/src/OpenColorIO/ViewingRules.cpp @@ -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) diff --git a/src/apps/ociocheck/main.cpp b/src/apps/ociocheck/main.cpp index 554545efd..5a0c24524 100644 --- a/src/apps/ociocheck/main.cpp +++ b/src/apps/ociocheck/main.cpp @@ -641,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; } } @@ -654,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; diff --git a/tests/cpu/ColorSpace_tests.cpp b/tests/cpu/ColorSpace_tests.cpp index 6bdbaa77a..09819632e 100644 --- a/tests/cpu/ColorSpace_tests.cpp +++ b/tests/cpu/ColorSpace_tests.cpp @@ -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.