From 8246fdd182cb61a3a89e22686c096c469a9c048c Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Thu, 21 Nov 2024 11:46:33 -0500 Subject: [PATCH] Avoid attempting to add a numeric component to an SdfPath. --- lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp index 31fb2b08a..8fb6914ab 100644 --- a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp +++ b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp @@ -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; }