diff --git a/src/app.ts b/src/app.ts index e347a43af6..caf6cde72d 100644 --- a/src/app.ts +++ b/src/app.ts @@ -59,6 +59,7 @@ export class App { hubChannel?: HubChannel; mediaDevicesManager?: MediaDevicesManager; entryManager?: SceneEntryManager; + messageDispatch?: any; store = new Store(); mediaSearchStore = new MediaSearchStore(); diff --git a/src/bit-systems/scene-loading.ts b/src/bit-systems/scene-loading.ts index 1d9e7b1fc0..3de842f6ad 100644 --- a/src/bit-systems/scene-loading.ts +++ b/src/bit-systems/scene-loading.ts @@ -8,7 +8,6 @@ import { AElement } from "aframe"; import { anyEntityWith } from "../utils/bit-utils"; import { renderAsEntity } from "../utils/jsx-entity"; import { ScenePrefab } from "../prefabs/scene"; -import { remountUI } from "../hub"; import { ExitReason } from "../react-components/room/ExitedRoomScreen"; import { EnvironmentSystem } from "../systems/environment-system"; import { Mesh } from "three"; @@ -68,7 +67,7 @@ function* loadScene(world: HubsWorld, eid: number, signal: AbortSignal, environm } catch (e) { console.error(e); console.error("Failed to load the scene"); - remountUI({ roomUnavailableReason: ExitReason.sceneError }); + APP.messageDispatch?.remountUI({ roomUnavailableReason: ExitReason.sceneError }); APP.entryManager!.exitScene(); } } diff --git a/src/react-components/scene-ui.js b/src/react-components/scene-ui.js index f6dda9d9ac..5e67a7f05b 100644 --- a/src/react-components/scene-ui.js +++ b/src/react-components/scene-ui.js @@ -38,18 +38,11 @@ class SceneUI extends Component { }; state = { - showScreenshot: false + showScreenshot: true }; constructor(props) { super(props); - - // Show screenshot if scene isn't loaded in 5 seconds - setTimeout(() => { - if (!this.props.sceneLoaded) { - this.setState({ showScreenshot: true }); - } - }, 5000); } componentDidMount() { diff --git a/src/scene.js b/src/scene.js index af9da0ba6f..fbca13f952 100644 --- a/src/scene.js +++ b/src/scene.js @@ -77,7 +77,6 @@ const onReady = async () => { mountUI(scene, uiProps); }; - const sceneRoot = document.querySelector("#scene-root"); const sceneModelEntity = document.createElement("a-entity"); const gltfEl = document.createElement("a-entity"); const camera = document.getElementById("camera"); @@ -141,13 +140,6 @@ const onReady = async () => { const modelUrl = sceneInfo.model_url; console.log(`Scene Model URL: ${modelUrl}`); - gltfEl.setAttribute("gltf-model-plus", { src: modelUrl, useCache: false, inflate: true }); - gltfEl.addEventListener("model-loaded", ({ detail: { model } }) => - sceneModelEntity.emit("environment-scene-loaded", model) - ); - sceneModelEntity.appendChild(gltfEl); - sceneRoot.appendChild(sceneModelEntity); - const parentScene = sceneInfo.parent_scene_id && (await fetchReticulumAuthenticated(`/api/v1/scenes/${sceneInfo.parent_scene_id}`)).scenes[0];