Skip to content

Commit

Permalink
Merge pull request #1048 from Autodesk/chenh/MAYA-108707/replace-fixe…
Browse files Browse the repository at this point in the history
…d-string-prefix-with-node-id

MAYA-108707 Making shader reuse safer
  • Loading branch information
Krystian Ligenza authored Jan 8, 2021
2 parents 6f9cf2a + 9175bca commit 337196b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/mayaUsd/render/vp2RenderDelegate/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ TF_DEFINE_PRIVATE_TOKENS(
);
// clang-format on

//! Prefix of VP2-specific simplified node path to enable reuse of shader effects among material
//! networks which have the same node identifiers and relationships but different node paths.
const std::string kNodePathPrefix = "node";

//! Helper utility function to test whether a node is a UsdShade primvar reader.
bool _IsUsdPrimvarReader(const HdMaterialNode& node)
{
Expand Down Expand Up @@ -725,7 +721,7 @@ void HdVP2Material::_ApplyVP2Fixes(HdMaterialNetwork& outNet, const HdMaterialNe
tmpNet.nodes.push_back(node);

HdMaterialNode& outNode = tmpNet.nodes.back();
outNode.path = SdfPath(kNodePathPrefix + std::to_string(++nodeCounter));
outNode.path = SdfPath(outNode.identifier.GetString() + std::to_string(++nodeCounter));

_nodePathMap[node.path] = outNode.path;
}
Expand Down Expand Up @@ -791,7 +787,8 @@ void HdVP2Material::_ApplyVP2Fixes(HdMaterialNetwork& outNet, const HdMaterialNe
continue;
}

const SdfPath passThroughPath(kNodePathPrefix + std::to_string(++nodeCounter));
const SdfPath passThroughPath(
passThroughId.GetString() + std::to_string(++nodeCounter));

const HdMaterialNode passThroughNode = { passThroughPath, passThroughId, {} };
outNet.nodes.push_back(passThroughNode);
Expand Down

0 comments on commit 337196b

Please sign in to comment.