-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTFExporter: Fix JSON chunk padding issue. #13542
Conversation
We only use this method once — could we just call |
So why does even the current |
😅 Oops. Let's remove that and just do padding when we're writing a bufferView or GLB chunk. |
OK, I'll update, |
Yeah you're right :D I guess it was some duplicated use somewhere on the code that didn't need padding and it was removed after all :) |
Probably we misunderstood each other.
If we pad with 0, JSON.parse( jsonChunk ) will fail when loading. So padding in |
Hm I see what you mean :/ ...hoping we can still solve this with a smaller change to function getPaddedArrayBuffer( arrayBuffer, paddingByte ) {
paddingByte = paddingByte || 0;
var paddedLength = getPaddedBufferSize( arrayBuffer.byteLength );
if (paddedLength !== arrayBuffer.byteLength ) {
var paddedBuffer = new ArrayBuffer( paddedLength );
new Uint8Array( paddedBuffer )
.set( [ paddingByte, paddingByte, paddingByte ], paddedLength - 3 )
.set( new Uint8Array( arrayBuffer ) );
return paddedBuffer;
}
return arrayBuffer;
} EDIT: Sigh. |
That's the one I mentioned
|
Came to think adding that option would be better. We don't need two padding functions. I'll update. |
…te strings" This reverts commit 0359d57.
Updated.
Just in case, |
Thanks! |
This PR fixes padding logic in
stringToArrayBuffer()
ofGLTFExporter
for multi-byte strings. The current logic doesn't take account of the possibility that.name
can be multi-byte strings.