repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 4cfb634145562bdbf7411f52b959c35bf4a4fdc3:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 4cfb634145562bdbf7411f52b959c35bf4a4fdc3
Author: James Baicoianu 
Date:   Tue Mar 10 23:23:01 2020 -0700

    Object edit sync improvemnts / autosync

diff --git a/scripts/room.js b/scripts/room.js
index 69bc6fa8ab629edd3a78247c95e125f11e039527..
index ..ba1055f01642ea115c3f7aa70868be93657ac9fe 100644
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -902,7 +902,7 @@ elation.require([
       var waslocked = this.locked;
       //this.locked = true;
       this.applyingEdits = true;
-      var skip = ['sync'];
+      var skip = ['sync', 'autosync'];
       keys.forEach(elation.bind(this, function(k) {
         var newobjs = edit[k];
         if (!elation.utils.isArray(newobjs)) newobjs = [newobjs];
@@ -1024,6 +1024,10 @@ elation.require([
         delete objectargs.class;
       }

+      if (objectargs.autosync) {
+        objectargs.sync = true;
+      }
+
       switch (realtype) {
         case 'janusobject':
           elation.utils.merge({ 
@@ -1503,7 +1507,7 @@ elation.require([
           if (!this.appliedchanges[thing.js_id]) {
             this.changes[thing.js_id] = proxy;
           }
-          proxy.sync = false;
+          proxy.sync = proxy.autosync;
         }
       }
     }
@@ -1782,6 +1786,7 @@ elation.require([
     this.getChanges = function() {
       var changeids = Object.keys(this.changes);
       var changestr = '';
+      let ignoreattributes = ['tagName', 'parts', 'extendclass', 'obj', 'objcount', 'sync', 'autosync'];
       if (changeids.length > 0) {
         var xmldoc = document.implementation.createDocument(null, 'edit', null);
         var editroot = xmldoc.documentElement;
@@ -1806,6 +1811,9 @@ elation.require([
             var attrs = Object.keys(change);
             for (var i = 0; i < attrs.length; i++) {
               var k = attrs[i];
+
+              if (ignoreattributes.indexOf(k) != -1) continue;
+
               var val = change[k];
               if (val instanceof THREE.Vector2 ||
                   val instanceof THREE.Quaternion ||

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