Closed KevinJW closed 11 months ago
Possible option for fixing FileFormat handlers
diff --git a/src/OpenColorIO/fileformats/FileFormatCCC.cpp b/src/OpenColorIO/fileformats/FileFormatCCC.cpp
index 3670c57b..bad7723e 100755
--- a/src/OpenColorIO/fileformats/FileFormatCCC.cpp
+++ b/src/OpenColorIO/fileformats/FileFormatCCC.cpp
@@ -217,7 +217,7 @@ void LocalFileFormat::buildFileOps(OpRcPtrVec & ops,
{
// Use 0 for empty string.
int cccindex=0;
- if (StringToInt(&cccindex, cccid.c_str(), true))
+ if (cccid.empty() || StringToInt(&cccindex, cccid.c_str(), true))
{
int maxindex = ((int)cachedFile->m_transformVec.size())-1;
if (cccindex<0 || cccindex>maxindex)
diff --git a/src/OpenColorIO/fileformats/FileFormatCDL.cpp b/src/OpenColorIO/fileformats/FileFormatCDL.cpp
index 3a687a1c..a2ff5e95 100755
--- a/src/OpenColorIO/fileformats/FileFormatCDL.cpp
+++ b/src/OpenColorIO/fileformats/FileFormatCDL.cpp
@@ -247,7 +247,7 @@ LocalFileFormat::buildFileOps(OpRcPtrVec & ops,
{
// Use 0 for empty string.
int cccindex=0;
- if (StringToInt(&cccindex, cccid.c_str(), true))
+ if (cccid.empty() || StringToInt(&cccindex, cccid.c_str(), true))
{
int maxindex = ((int)cachedFile->m_transformVec.size())-1;
if (cccindex<0 || cccindex>maxindex)
Investigating a change in behaviour seen when trying to migrate a config from v1 to v2 being unable to load a ColorCorrection file, generating the error message when running
ociocheck
:Points of note:
Expected:
Based on historical behaviour in v1 we should continue to try decode the file based on the contents of the file and not the file extension. we should also follow the v2 documentation accepting the file as master.cdl and default to using the first (only) colour correction found in the file, without needing users to add an explicit cccid to the config.
This should work for files named .ccc as well as .cdl
As a thought experiment I'm unclear if this should be considered as several bugs:
Reproduction files...
minimal.ocio:
master.cdl: