Skip to content

Commit

Permalink
Avoid attempting to add a numeric component to an SdfPath.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppt-adsk committed Nov 21, 2024
1 parent ca1e641 commit 8246fdd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,11 @@ class PathInterfaceSceneIndex : public Fvp::PathInterfaceSceneIndexBase
instanceSelection = {instancerPath, prototypeIndex, {instanceSchema.GetInstanceIndex()->GetTypedValue(0)}};
}

auto targetChildPath = primPath.AppendChild(TfToken(secondSegment.components()[iComponent].string()));
// SdfPath components cannot be numeric, as happens with point instance selections.
auto targetChildPath = ((iComponent == lastComponentIndex) && lastComponentIsNumeric) ? SdfPath() :
primPath.AppendChild(TfToken(secondSegment.components()[iComponent].string()));
auto actualChildPaths = GetInputSceneIndex()->GetChildPrimPaths(primPath);
if (std::find(actualChildPaths.begin(), actualChildPaths.end(), targetChildPath) != actualChildPaths.end()) {
if (!targetChildPath.IsEmpty() && std::find(actualChildPaths.begin(), actualChildPaths.end(), targetChildPath) != actualChildPaths.end()) {
// Append if the new path is valid
primPath = targetChildPath;
}
Expand Down

0 comments on commit 8246fdd

Please sign in to comment.