From 8246fdd182cb61a3a89e22686c096c469a9c048c Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Thu, 21 Nov 2024 11:46:33 -0500 Subject: [PATCH 1/2] 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; } From 43d41c956e10b49e7c62c26b765ab877bd95f7f7 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Mon, 25 Nov 2024 09:44:31 -0500 Subject: [PATCH 2/2] Addressed code review feedback. --- lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp index 8fb6914ab..a658add68 100644 --- a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp +++ b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp @@ -162,7 +162,7 @@ class PathInterfaceSceneIndex : public Fvp::PathInterfaceSceneIndexBase instanceSelection = {instancerPath, prototypeIndex, {instanceSchema.GetInstanceIndex()->GetTypedValue(0)}}; } - // SdfPath components cannot be numeric, as happens with point instance selections. + // SdfPath components cannot be numeric. This happens with point instance selections. auto targetChildPath = ((iComponent == lastComponentIndex) && lastComponentIsNumeric) ? SdfPath() : primPath.AppendChild(TfToken(secondSegment.components()[iComponent].string())); auto actualChildPaths = GetInputSceneIndex()->GetChildPrimPaths(primPath);