I'm having trouble customizing a mesh and exporting it using the gltfExporter from Threejs. Despite my efforts, the export still includes all morph/shape keys, which I want to remove from the final exported mesh.
Attempts to clone the scene/mesh have been unsuccessful.
function exportModel() {
var exporter = new THREE.GLTFExporter();
if (!gltfExportEnabled) gltfExporterConfig.binary = false;
var finalRenderModel = mainScene.children[2];
// Remove Morph Targets
if (!!removeExportMorphs) {
// finalRenderModel.children[0].children[1].morphTargetDictionary = [];
// finalRenderModel.children[0].children[1].morphTargetInfluences = [];
}
exporter.parse([finalRenderModel], function(gltf) {
if (!!gltfExportEnabled) generateDownload([gltf], exportFileName + ".glb");
}, gltfExporterConfig);
}
var generateDownload = (function() {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function(data, name) {
var blob = new Blob(data, { type: "octet/stream" }),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = name;
a.click();
window.URL.revokeObjectURL(url);
};
}());
The exported mesh retains all morphs/shape keys or fails to export altogether.