This other thread talks about how to do this using Three’s GLTFExporter
:
So although this doesn’t answer how to do this with Blender, a possible workflow is you could load the GLTF file into a temporary Three.js scene you use after you’ve exported from Blender, then use GLTFExporter
to create the final GLTF file with only animations and no mesh data.
Once you have that resulting glTF json in the temporary Three.js setup, you can save it as a file by making a new File
or new Blob
, and then using:
/**
* @param {File | Blob} file - The `File` or `Blob` to have the user save.
* @param {string} fileName - The file name to pre-fill in the save file dialog.
*/
export function saveFile(file, fileName) {
const url = URL.createObjectURL(file)
const a = document.createElement('a')
a.href = url
a.download = fileName
document.body.append(a)
a.click()
a.remove()
URL.revokeObjectURL(url)
}
If you’re familiar with Blender plugins, you could possibly write a python pugin that can open a browser with the Threejs code to do this automatically once you’ve got it going manually.