Skip to content

Commit f29bb6c

Browse files
blevinpixar-oss
authored andcommitted
usdImaging: Do not emit a primvar role data source if role is
empty, which is commonly the case. (Internal change: 2392202) (Internal change: 2392280)
1 parent 0c7c52b commit f29bb6c

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

pxr/usdImaging/usdImaging/dataSourcePrimvars.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,18 +149,19 @@ UsdImagingDataSourcePrimvars::Get(const TfToken & name)
149149
}
150150

151151
return UsdImagingDataSourcePrimvar::New(
152-
_sceneIndexPath, name, _stageGlobals,
153-
/* value = */ std::move(valueQuery),
154-
/* indices = */ UsdAttributeQuery(usdPrimvar.GetIndicesAttr()),
155-
HdPrimvarSchema::BuildInterpolationDataSource(
156-
UsdImagingUsdToHdInterpolationToken(
157-
usdPrimvar.GetInterpolation())),
158-
HdPrimvarSchema::BuildRoleDataSource(primvarRole),
159-
colorSpace.IsEmpty()
160-
? nullptr
161-
: HdRetainedTypedSampledDataSource<TfToken>::New(colorSpace),
162-
_ElementSizeToDataSource(usdPrimvar.GetElementSize()));
163-
152+
_sceneIndexPath, name, _stageGlobals,
153+
/* value = */ std::move(valueQuery),
154+
/* indices = */ UsdAttributeQuery(usdPrimvar.GetIndicesAttr()),
155+
HdPrimvarSchema::BuildInterpolationDataSource(
156+
UsdImagingUsdToHdInterpolationToken(
157+
usdPrimvar.GetInterpolation())),
158+
primvarRole.IsEmpty()
159+
? nullptr
160+
: HdPrimvarSchema::BuildRoleDataSource(primvarRole),
161+
colorSpace.IsEmpty()
162+
? nullptr
163+
: HdRetainedTypedSampledDataSource<TfToken>::New(colorSpace),
164+
_ElementSizeToDataSource(usdPrimvar.GetElementSize()));
164165
}
165166

166167
if (UsdRelationship rel = _usdPrim.GetRelationship(propName)) {

pxr/usdImaging/usdImaging/testenv/testUsdImagingStageSceneIndexContents/baseline/basic.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@
151151
vertex
152152
[primvarValue]
153153
[(0, 1), (0.4, 1), (0, 0), (0.4, 0)]
154-
[role]
155-
156154
[points]
157155
[interpolation]
158156
vertex

0 commit comments

Comments
 (0)