diff --git a/pxr/imaging/hd/materialNetwork2Interface.cpp b/pxr/imaging/hd/materialNetwork2Interface.cpp index 33664ed1de..cf83b660a3 100644 --- a/pxr/imaging/hd/materialNetwork2Interface.cpp +++ b/pxr/imaging/hd/materialNetwork2Interface.cpp @@ -88,8 +88,9 @@ HdMaterialNetwork2Interface::GetMaterialConfigKeys() const VtValue HdMaterialNetwork2Interface::GetMaterialConfigValue(const TfToken& key) const { - if (auto result = _materialNetwork->config.GetValueAtPath(key.GetString())){ - return *result; + const auto it = _materialNetwork->config.find(key.GetString()); + if (it != _materialNetwork->config.end()) { + return it->second; } return VtValue(); } diff --git a/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp b/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp index a57ffa521b..39536e61e6 100644 --- a/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp +++ b/pxr/usdImaging/usdImaging/dataSourceMaterial.cpp @@ -802,9 +802,8 @@ _BuildMaterial( } // Collect any 'config' on the Material prim - // Collect in to a VtDictionary to take advantage of SetValueAtPath for - // nested namespaces in the attribute names. - VtDictionary configDict; + TfTokenVector names; + std::vector values; for (const auto& prop : usdMat.GetPrim().GetPropertiesInNamespace( UsdImagingTokens->configPrefix)) { const auto& attr = prop.As(); @@ -812,15 +811,14 @@ _BuildMaterial( continue; } - std::string name = attr.GetName().GetString(); + const std::string name = attr.GetName().GetString(); std::pair result = SdfPath::StripPrefixNamespace(name, UsdImagingTokens->configPrefix); - name = result.first; + names.push_back(TfToken(result.first)); VtValue value; attr.Get(&value); - - configDict.SetValueAtPath(name, value); + values.push_back(HdCreateTypedRetainedDataSource(value)); } HdContainerDataSourceHandle nodesDs = @@ -830,7 +828,8 @@ _BuildMaterial( nodeValues.data()); HdContainerDataSourceHandle configDefaultContext = - HdUtils::ConvertVtDictionaryToContainerDS(configDict); + HdRetainedContainerDataSource::New( + names.size(), names.data(), values.data()); return HdMaterialNetworkSchema::Builder() .SetNodes(nodesDs) diff --git a/pxr/usdImaging/usdImaging/materialAdapter.cpp b/pxr/usdImaging/usdImaging/materialAdapter.cpp index 267e77967e..de7ab4196c 100644 --- a/pxr/usdImaging/usdImaging/materialAdapter.cpp +++ b/pxr/usdImaging/usdImaging/materialAdapter.cpp @@ -396,7 +396,7 @@ UsdImagingMaterialAdapter::GetMaterialResource(UsdPrim const &prim, VtValue value; attr.Get(&value); - configDict.SetValueAtPath(name, value); + configDict.insert({name, value}); } networkMap.config = configDict;