Skip to content

Commit

Permalink
Fix scene page
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshaughnessy committed Nov 15, 2022
1 parent 9f80371 commit 5f165e6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class App {
hubChannel?: HubChannel;
mediaDevicesManager?: MediaDevicesManager;
entryManager?: SceneEntryManager;
messageDispatch?: any;

store = new Store();
mediaSearchStore = new MediaSearchStore();
Expand Down
3 changes: 1 addition & 2 deletions src/bit-systems/scene-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
}
}
Expand Down
9 changes: 1 addition & 8 deletions src/react-components/scene-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 0 additions & 8 deletions src/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 5f165e6

Please sign in to comment.