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

MAYA-108707 Making shader reuse safer #1048

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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