Skip to content

Commit 6284755

Browse files
anwang2009pixar-oss
authored andcommitted
Fix LocalizeAsset bug where assets bigger than 4096 characters are truncated in the output package
(Internal change: 2357794)
1 parent fa8e2b2 commit 6284755

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pxr/usd/usdUtils/localizeAsset.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,16 @@ class UsdUtils_LocalizedAssetBuilder : public UsdUtils_AssetLocalizationPackage
8383
constexpr size_t COPY_BUFFER_SIZE = 4096U;
8484
char buffer[COPY_BUFFER_SIZE];
8585
size_t dataRemaining = sourceAsset->GetSize();
86+
size_t offset = 0;
8687

8788
while (dataRemaining > 0) {
8889
size_t chunkSize = std::min(dataRemaining, COPY_BUFFER_SIZE);
8990

90-
sourceAsset->Read(buffer, chunkSize, 0);
91-
destAsset->Write(buffer, chunkSize, 0);
91+
sourceAsset->Read(buffer, chunkSize, offset);
92+
destAsset->Write(buffer, chunkSize, offset);
9293

9394
dataRemaining -= chunkSize;
95+
offset += chunkSize;
9496
}
9597

9698
return true;

0 commit comments

Comments
 (0)