From e7d282f268019282dedc5a437c41d4089567a149 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Tue, 10 Dec 2024 14:36:52 +0000 Subject: [PATCH] attempt to fix export [hamburgermenu>share>download button] --- src/3rd/js/plugin/frontend/frontend.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/3rd/js/plugin/frontend/frontend.js b/src/3rd/js/plugin/frontend/frontend.js index 748940a..033c94e 100644 --- a/src/3rd/js/plugin/frontend/frontend.js +++ b/src/3rd/js/plugin/frontend/frontend.js @@ -260,9 +260,9 @@ window.frontend = (opts) => new Proxy({ .then( () => { // setup exporters let defaultExporter = THREE.GLTFExporter - xrf.loaders['gltf'].exporter = defaultExporter - xrf.loaders['glb'].exporter = defaultExporter - const exporter = new THREE.GLTFExporter() + if( !xrf.loaders['gltf'].exporter ) xrf.loaders['gltf'].exporter = defaultExporter + if( !xrf.loaders['glb'].exporter ) xrf.loaders['glb'].exporter = defaultExporter + const exporter = new xrf.loaders[ext]() exporter.parse( model.scene, function ( glb ) { download(glb, `${file}`) }, // ready @@ -280,12 +280,13 @@ window.frontend = (opts) => new Proxy({ // load original scene and overwrite with updates let url = document.location.search.replace(/\?/,'') - let {urlObj,dir,file,hash,ext} = xrf.navigator.origin = xrf.URI.parse(url) - const Loader = xrf.loaders[ext] + let {urlObj,dir,file,hash,fileExt} = xrf.navigator.origin = xrf.URI.parse(url) + debugger + const Loader = xrf.loaders[fileExt] loader = new Loader().setPath( dir ) notify('exporting scene

please wait..') loader.load(url, (model) => { - exportScene(model,ext,file) + exportScene(model,fileExt,file) }) },