attempt to fix export [hamburgermenu>share>download button]

This commit is contained in:
Leon van Kammen 2024-12-10 14:36:52 +00:00
parent 9c23a6e2a3
commit e7d282f268
1 changed files with 7 additions and 6 deletions

View File

@ -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<br><br>please wait..')
loader.load(url, (model) => {
exportScene(model,ext,file)
exportScene(model,fileExt,file)
})
},