Skip to content

Commit c440c61

Browse files
Assign source URI to generated OCIO NodeDefs (AcademySoftwareFoundation#2522)
Also Implementations. Without a source URI these can not be distinguished from user created nodes and filtered out when writing.
1 parent 7581aa5 commit c440c61

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

source/MaterialXGenShader/OcioColorManagementSystem.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace OCIO = OCIO_NAMESPACE;
2727
MATERIALX_NAMESPACE_BEGIN
2828

2929
const string OcioColorManagementSystem::IMPL_PREFIX = "IMPL_MXOCIO_";
30+
const string OcioColorManagementSystem::OCIO_SOURCE_URI = "materialx://OcioColorManagementSystem.cpp";
3031
const string ND_PREFIX = "ND_MXOCIO_";
3132

3233
namespace
@@ -162,13 +163,15 @@ NodeDefPtr OcioColorManagementSystemImpl::getNodeDef(const ColorSpaceTransform&
162163
{
163164
nodeDef = document->addNodeDef(nodeDefName, "", functionName);
164165
nodeDef->setNodeGroup("colortransform");
166+
nodeDef->setSourceUri(OcioColorManagementSystem::OCIO_SOURCE_URI);
165167

166168
nodeDef->addInput("in", transform.type.getName());
167169
nodeDef->addOutput("out", transform.type.getName());
168170

169171
auto implementation = document->addImplementation(implName);
170172
implementation->setTarget(_target);
171173
implementation->setNodeDef(nodeDef);
174+
implementation->setSourceUri(OcioColorManagementSystem::OCIO_SOURCE_URI);
172175
}
173176

174177
_implementations.emplace(implName, gpuProcessor);

source/MaterialXGenShader/OcioColorManagementSystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class MX_GENSHADER_API OcioColorManagementSystem : public DefaultColorManagement
5656
/// Prefix common to all implementation names
5757
static const string IMPL_PREFIX;
5858

59+
/// SourceUri common to all OCIO NodeDefs and Implementations:
60+
static const string OCIO_SOURCE_URI;
61+
5962
protected:
6063
/// Returns a nodedef for a given transform
6164
NodeDefPtr getNodeDef(const ColorSpaceTransform& transform) const override;

0 commit comments

Comments
 (0)