From 2e579fcae797d516d7c9b64492c0e25d68118d5c Mon Sep 17 00:00:00 2001 From: Alexander Goryushkin Date: Mon, 29 Jan 2024 15:00:19 -0300 Subject: [PATCH] get assetsUrl during saving JSON --- src/json-utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/json-utils.js b/src/json-utils.js index e3e09c8fb..d49e4de5f 100644 --- a/src/json-utils.js +++ b/src/json-utils.js @@ -2,6 +2,7 @@ /* version: 1.0 */ var STREET = {}; +var assetsUrl; STREET.utils = {}; function getSceneUuidFromURLHash () { @@ -43,6 +44,9 @@ function convertDOMElToObject (entity) { const referenceEntities = document.querySelector('#reference-layers'); const sceneEntities = [entity, environmentElement, referenceEntities]; + // get assets url address + assetsUrl = document.querySelector('street-assets').getAttribute('url'); + for (const entry of sceneEntities) { const entityData = getElementData(entry); if (entityData) { @@ -137,10 +141,10 @@ function toPropString (propData) { return Object.entries(propData) .map(([key, value]) => { if (key == 'src') { - if (value.id && value.src.includes('assets.3dstreet.app')) { + if (value.id && value.src.includes(assetsUrl)) { // asset came from 3dstreet return `${key}: #${value.id}`; - } else if (value.src && !value.src.includes('assets.3dstreet.app')) { + } else if (value.src && !value.src.includes(assetsUrl)) { // asset came from external sources return `${key}: ${value.src}`; } else {