Skip to content

Commit

Permalink
get assetsUrl during saving JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Jan 29, 2024
1 parent d46c423 commit 2e579fc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* version: 1.0 */

var STREET = {};
var assetsUrl;
STREET.utils = {};

function getSceneUuidFromURLHash () {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2e579fc

Please sign in to comment.