Skip to content

Commit

Permalink
[UsdImaging] Transform subset materialIds to index paths when request…
Browse files Browse the repository at this point in the history
…ing topology

Fixes #1687

(Internal change: 2245892)
  • Loading branch information
tgvarik authored and pixar-oss committed Aug 19, 2022
1 parent ecf74d6 commit e7683b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pxr/usdImaging/usdImaging/delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,18 @@ UsdImagingDelegate::GetMeshTopology(SdfPath const& id)
cachePath,
_time);
if (topology.IsHolding<HdMeshTopology>()) {
return topology.Get<HdMeshTopology>();
HdMeshTopology meshTopology = topology.Get<HdMeshTopology>();
HdGeomSubsets geomSubsets;
for(const HdGeomSubset& subset : meshTopology.GetGeomSubsets()) {
geomSubsets.push_back(HdGeomSubset {
subset.type,
ConvertCachePathToIndexPath(subset.id),
ConvertCachePathToIndexPath(subset.materialId),
subset.indices
});
}
meshTopology.SetGeomSubsets(geomSubsets);
return meshTopology;
}
}

Expand Down
5 changes: 4 additions & 1 deletion pxr/usdImaging/usdImaging/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ PXR_NAMESPACE_OPEN_SCOPE
// Version 16 - InsertRprim/InsertInstancer no longer take an instancer path.
// Version 17 - RequestTrackVariability/RequestUpdateForTime, and UpdateForTime
// no longer automatically called.
// Version 18 - Geom subsets accessed via UsdImagingDelegate::GetMeshTopology()
// will now have correctly prefixed index paths for id and
// materialId.

#define USD_IMAGING_API_VERSION 17
#define USD_IMAGING_API_VERSION 18


PXR_NAMESPACE_CLOSE_SCOPE
Expand Down

0 comments on commit e7683b3

Please sign in to comment.