diff --git a/pxr/imaging/plugin/hdRpr/primvarUtil.h b/pxr/imaging/plugin/hdRpr/primvarUtil.h index fb0b5b21c..8ede329cf 100644 --- a/pxr/imaging/plugin/hdRpr/primvarUtil.h +++ b/pxr/imaging/plugin/hdRpr/primvarUtil.h @@ -88,12 +88,21 @@ bool HdRprSamplePrimvar( VtArray* sampleValuesPtr) { std::vector sampleTimes(maxSampleCount); std::vector 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 sampleTimesTmp(authoredSampleCount); + std::vector 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);