Skip to content

Commit

Permalink
primvar extraction for multiple timestamps fix (#713)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-z authored Nov 14, 2023
1 parent ca748fb commit f42ba0f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pxr/imaging/plugin/hdRpr/primvarUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,21 @@ bool HdRprSamplePrimvar(
VtArray<T>* sampleValuesPtr) {
std::vector<float> sampleTimes(maxSampleCount);
std::vector<VtValue> sampleVtValues(maxSampleCount);

size_t authoredSampleCount = sceneDelegate->SamplePrimvar(id, key, maxSampleCount, sampleTimes.data(), sampleVtValues.data());
if (!authoredSampleCount) {
return false;
}

// for maxSampleCount == 1 and animated scene SamplePrimvar returns 3 frames, and we have to get 2nd one
if (maxSampleCount == 1 && authoredSampleCount > 2) {
std::vector<float> sampleTimesTmp(authoredSampleCount);
std::vector<VtValue> sampleVtValuesTmp(authoredSampleCount);
sceneDelegate->SamplePrimvar(id, key, authoredSampleCount, sampleTimesTmp.data(), sampleVtValuesTmp.data());
sampleTimes[0] = sampleTimesTmp[1];
sampleVtValues[0] = sampleVtValuesTmp[1];
}

if (authoredSampleCount < maxSampleCount) {
sampleTimes.resize(authoredSampleCount);
sampleVtValues.resize(authoredSampleCount);
Expand Down

0 comments on commit f42ba0f

Please sign in to comment.