Possibility to specify name for .bin files emmited from partition command? #412
-
Currently the partition command just names the Alternatively, is there a way to specify what i would like to name the bin file? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If You may need to use the scripting API to have more control of the bin file name, something like: import { NodeIO } from '@gltf-transform/core';
import { KHRONOS_EXTENSIONS } from '@gltf-transform/extensions';
import { partition } from '@gltf-transform/functions';
const io = new NodeIO().registerExtensions( KHRONOS_EXTENSIONS );
const document = io.read('./input.glb');
// Partition.
await document.transform( partition( { meshes: true } ) );
// Rename buffer(s).
let index = 0;
for (const buffer of document.getRoot().listBuffers()) {
buffer.setURI(`my_buffer_${index++}.bin`);
}
io.write('./output.glb', document); |
Beta Was this translation helpful? Give feedback.
If
mesh.getName()
is returning undefined, it's likely that GLTFExporter has not saved the name of the geometry in a location that's useful to thepartitiion()
function. glTF has "Mesh" and "Primitive" concepts, but neither is really a 1:1 counterpart to THREE.BufferGeometry.You may need to use the scripting API to have more control of the bin file name, something like: