Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileTransforms with absolute paths should work with configs from OCIOZ archive files #2111

Open
doug-walker opened this issue Jan 3, 2025 · 0 comments
Assignees

Comments

@doug-walker
Copy link
Collaborator

When an OCIOZ archive file is used as the config, FileTransforms are loaded from the .ocioz file. Currently, if an absolute path is used with a FileTransform, it won't work since it won't exist in the archive (OCIO restricts what it archives to only support paths that are relative to the working directory).

However, an application sometimes needs to load LUT files that are not part of the config (e.g., the user simply wants to apply a stand-alone LUT file). Currently the only way to do this is to create the Processor using a config that is different from the .ocioz file. This complicates the situation for applications since they would need to have different code paths based on whether the config is an archive or not. However, the intent for archives is that they be usable the same as a normal config.

The proposal is that FileTransforms that use absolute paths should be loaded directly from the file system and not via the .ocioz file. This should apply to all ConfigIOProxy workflows, not only OCIOZ archives.

Here is a test that may be added at line 438 in tests/cpu/OCIOZArchive_tests.cpp that demonstrates the problem:

        {
            const std::string filePath = OCIO::GetTestFilesDir() + "/matrix_example4x4.ctf";
            OCIO::FileTransformRcPtr transform = OCIO::FileTransform::Create();
            transform->setSrc(filePath.c_str());
            OCIO::ConstProcessorRcPtr processor = cfg->getProcessor(transform);
            OCIO::ConstTransformRcPtr tr = processor->createGroupTransform()->getTransform(0);
            auto mtx = OCIO::DynamicPtrCast<const OCIO::MatrixTransform>(tr);
            OCIO_REQUIRE_ASSERT(mtx);
            mtx->getMatrix(mat);
            OCIO_CHECK_EQUAL(mat[0], 3.24);
        }
cozdas added a commit to autodesk-forks/OpenColorIO that referenced this issue Jan 9, 2025
- Do not use config proxy for absolute paths while computing file hash or loading LUT data.
- Added the unit test provided in the ticket.

Signed-off-by: cuneyt.ozdas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants