Skip to content
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

Issue with Transform #136

Open
PaulLockett opened this issue Mar 14, 2022 · 1 comment
Open

Issue with Transform #136

PaulLockett opened this issue Mar 14, 2022 · 1 comment

Comments

@PaulLockett
Copy link

I run this and get this error:

you can see the code and find the .gltf file here: link

I want to be able to export my new 3d design after using this tool to manipulate it. I think the -T transform function will let me do that.

~/NFTShowcaseAnimation$ npx gltfjsx first_try.gltf -t -T
prune: Removed types... Primitive (14), Buffer (4)
 Parse  transforming first_try-transformed.glb
Error: GLB must have 0–1 buffers.
    at n.writeJSON (/home/runner/NFTShowcaseAnimation/node_modules/@gltf-transform/core/dist/core.js:1:76233)
    at n.writeBinary (/home/runner/NFTShowcaseAnimation/node_modules/@gltf-transform/core/dist/core.js:1:77483)
    at n.r.Yt (/home/runner/NFTShowcaseAnimation/node_modules/@gltf-transform/core/dist/core.js:1:79620)
    at n.r.write (/home/runner/NFTShowcaseAnimation/node_modules/@gltf-transform/core/dist/core.js:1:78505)
    at transform (/home/runner/NFTShowcaseAnimation/node_modules/@react-three/gltfjsx/src/utils/transform.js:30:6)
    at async WriteStream.<anonymous> (/home/runner/NFTShowcaseAnimation/node_modules/@react-three/gltfjsx/src/gltfjsx.js:43:11)
@donmccurdy
Copy link
Member

I can't access the replit (password protected), but this error might happen if the .gltf file has multiple .bin resources — does that sound right? Some consolidation to pack those into a .glb.

A quick workaround might be to drop the file into https://gltf.report/, open the script tab, and run the script below:

const buffers = document.getRoot().listBuffers();
const mainBuffer = buffers[0];

document.getRoot().listAccessors().forEach((accessor) => {
	accessor.setBuffer(buffers[0]);
});

buffers.forEach((buffer, index) => {
	if (index > 0) buffer.dispose();
});

console.log('... ✅ Done');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants