diff --git a/lib/mayaHydra/mayaPlugin/renderOverride.cpp b/lib/mayaHydra/mayaPlugin/renderOverride.cpp index 39dbcf38d8..60f5d4ac6e 100644 --- a/lib/mayaHydra/mayaPlugin/renderOverride.cpp +++ b/lib/mayaHydra/mayaPlugin/renderOverride.cpp @@ -508,7 +508,10 @@ class UsdPickHandler : public MtohRenderOverride::PickHandlerBase { (pickedMayaPath + std::to_string(instanceNdx)) : // Not an instance: adjust picked path for selection kind. - [&]() { + // As per https://stackoverflow.com/questions/46114214 + // structured bindings cannot be captured by a lambda in C++ 17, + // so pass in pickedUsdPath as a lambda argument. + [&pickedMayaPath, ®istration](const SdfPath& pickedUsdPath) { auto snKind = GetSelectionKind(); if (snKind.IsEmpty()) { return pickedMayaPath; @@ -528,7 +531,7 @@ class UsdPickHandler : public MtohRenderOverride::PickHandlerBase { const auto usdPath = prim ? prim.GetPath() : pickedUsdPath; return usdPathToUfePath(registration, usdPath); - }(); + }(pickedUsdPath); auto si = Ufe::Hierarchy::createItem(snMayaPath); if (!si) {