From 3374542b7a18b1d634807555a85e2e55d6bfcba1 Mon Sep 17 00:00:00 2001 From: netpro2k Date: Tue, 21 Sep 2021 21:01:15 -0700 Subject: [PATCH] Apply environment-settings on scene page --- src/components/gltf-model-plus.js | 3 ++- src/scene.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/gltf-model-plus.js b/src/components/gltf-model-plus.js index 43c34fd3c3..0d621a6216 100644 --- a/src/components/gltf-model-plus.js +++ b/src/components/gltf-model-plus.js @@ -58,7 +58,8 @@ const extractZipFile = promisifyWorker(new SketchfabZipWorker()); function defaultInflator(el, componentName, componentData) { if (!AFRAME.components[componentName]) { - throw new Error(`Inflator failed. "${componentName}" component does not exist.`); + console.warn(`Inflator failed. "${componentName}" component does not exist.`); + return; } if (AFRAME.components[componentName].multiple && Array.isArray(componentData)) { for (let i = 0; i < componentData.length; i++) { diff --git a/src/scene.js b/src/scene.js index 975cc3e9ae..cbbe3572e8 100644 --- a/src/scene.js +++ b/src/scene.js @@ -31,6 +31,7 @@ import { disableiOSZoom } from "./utils/disable-ios-zoom"; import "./systems/scene-systems"; import "./gltf-component-mappings"; +import { EnvironmentSystem } from "./systems/environment-system"; import { App } from "./App"; @@ -105,6 +106,8 @@ const onReady = async () => { }); }); + const envSystem = new EnvironmentSystem(scene); + sceneModelEntity.addEventListener("environment-scene-loaded", () => { remountUI({ sceneLoaded: true }); const previewCamera = gltfEl.object3D.getObjectByName("scene-preview-camera"); @@ -119,6 +122,9 @@ const onReady = async () => { } camera.setAttribute("scene-preview-camera", ""); + + const environmentEl = sceneModelEntity.childNodes[0]; + envSystem.updateEnvironment(environmentEl); }); const res = await fetchReticulumAuthenticated(`/api/v1/scenes/${sceneId}`);