From 5ed8a120ebc514a04557f0e58b3706ec9ee57235 Mon Sep 17 00:00:00 2001 From: DipokalLab Date: Wed, 13 May 2026 15:40:49 +0900 Subject: [PATCH] fix: update export glb --- src/three/Space.tsx | 21 +++++++++++++++------ src/ui/App.tsx | 4 ++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/three/Space.tsx b/src/three/Space.tsx index 18bf4bb..94c99c6 100644 --- a/src/three/Space.tsx +++ b/src/three/Space.tsx @@ -43,6 +43,7 @@ function Building({ e.stopPropagation(); }} rotation={[-Math.PI / 2, 0, 0]} + userData={{ exportToGLB: true }} > @@ -353,7 +354,14 @@ function Roads({ area }: { area: any }) { const lineGeometry: any = new THREE.BufferGeometry().setFromPoints(points); - return ; + return ( + + ); })} ); @@ -391,15 +399,16 @@ export function Export() { }; const exportGLB = () => { - const sceneClone = scene.clone(true); - sceneClone.traverse((child) => { - if (child.userData && child.userData.skipExport === true) child.parent?.remove(child); - if ((child as any).isHtml === true) child.parent?.remove(child); + const exportRoot = new THREE.Group(); + scene.traverse((child) => { + if (child.userData?.exportToGLB === true) { + exportRoot.add(child.clone(true)); + } }); const exporter = new GLTFExporter(); const options = { binary: true, embedImages: true }; exporter.parse( - sceneClone, + exportRoot, (result) => { if (result instanceof ArrayBuffer) { const blob = new Blob([result], { type: "model/gltf-binary" }); diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 254c20b..90766aa 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -203,7 +203,7 @@ function App() { GLB Download - {isFleetLogin ? ( + {/* {isFleetLogin ? ( @@ -214,7 +214,7 @@ function App() { > Fleet Login - )} + )} */}