repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 27df11895f171ce08894fa8c00d993a7cfbd9b08:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 27df11895f171ce08894fa8c00d993a7cfbd9b08
Author: James Baicoianu 
Date:   Tue Aug 4 01:00:03 2020 -0700

    Expose room objects in editor and inventory

diff --git a/media/assets/webui/apps/editor/editor.js b/media/assets/webui/apps/editor/editor.js
index e6f9def1e89489613431838252d2b7d160b15d82..
index ..e85162a57cad83eaaebdbc033fdf2fe21be5b6ce 100644
--- a/media/assets/webui/apps/editor/editor.js
+++ b/media/assets/webui/apps/editor/editor.js
@@ -1127,9 +1127,8 @@ console.log('change color', obj.col, vec);
       var hashidx = urls[i].indexOf('#');
       let url = urls[i];
       let trimmedurl = (hashidx == -1 ? urls[i] : urls[i].substring(0, hashidx)).trim();
-      //let type = 'Object';
+      let type = 'Object';
       let objargs = {
-        //id: id,
         js_id: player.userid + '-' + trimmedurl + '-' + window.uniqueId(),
         //cull_face: 'none',
         sync: true,
@@ -1143,12 +1142,12 @@ console.log('change color', obj.col, vec);
           var scheme = trimmedurl.substr(0, schemeidx);
           if (scheme == 'janus') {
             let newobjargs = trimmedurl.substr(schemeidx+1).split('/'),
-                type = newobjargs.shift();
+                objtype = newobjargs.shift();
             for (let j = 0; j < newobjargs.length; j++) {
               let parts = newobjargs[j].split('=');
               objargs[parts[0]] = decodeURIComponent(parts[1]);
             }
-            newobject = room.createObject(type, objargs);
+            newobject = room.createObject(objtype, objargs);
             objects.push(newobject);
             if (objects[0]) {
               this.editObject(objects[0], true);
@@ -1158,7 +1157,7 @@ console.log('change color', obj.col, vec);
         if (!newobject) {
           this.detectMimeTypeForURL(url).then(mimetype => {
             if (!mimetype) mimetype = 'application/octet-stream';
-            if (id.match(/\.(png|gif|jpg|jpeg)/i) || mimetype.match(/^image\//)) {
+            if (trimmedurl.match(/\.(png|gif|jpg|jpeg)/i) || mimetype.match(/^image\//)) {
               type = 'image';
             } else if (mimetype.match(/^audio\//)) {
               type = 'sound';
@@ -1187,6 +1186,8 @@ console.log('change color', obj.col, vec);
               });
               objargs.websurface_id = objargs.js_id;
               objargs.id = 'plane';
+            } else {
+              objargs.id = trimmedurl;
             }
             if (typeof EventBridge != 'undefined') {
               // if EventBridge is defined, we're (probably) running inside of High Fidelity, so just spawn this object

-----END OF PAGE-----