Closed javagl closed 1 year ago
It should already prefix with the base name of the output file. E.g. if I run
node bin/gltf-pipeline.js -i ./specs/data/2.0/box-textured-embedded/box-textured-embedded.gltf -o ~/Desktop/box.gltf --separate
I get three files:
If you're calling processGltf
or equivalent programmatically you'll need to pass in options.name
for it to get prefixed.
pass in
options.name
for it to get prefixed.
That was the missing piece.
When resources (like external buffer- or image references) are created via the
options.separate
flag, then their names are assigned automatically. This is happening aroundwriteResources.getName
. The names are somewhat generic - something likebuffer0.bin
. One could consider prefixing these names with the base name of the input file, to disambiguate them. For example, when processing aDuck.glb
, the files could be namedDuck_buffer0.bin
.(The use case is that one might to batch-process multiple files in one directory, and write the results into one directory. When the input files
Duck.glb
andTriangle.glb
both generate abuffer.bin
, then the user has no obvious way to handle this: TheseparateResources
do contain the names likebuffer0.bin
as the key, but this cannot be changed at the client side - at least not without manually doing some hackygltf.buffers[i].uri = myNewName
).