elation.require(['engine.things.generic', 'utils.template'], function() {
  elation.template.add('janusweb.edit.object', 
      '<Object id=^{id}^ js_id=^{js_id}^ locked=^false^ pos=^{pos.x} {pos.y} {pos.z}^ vel=^{vel.x} {vel.y} {vel.z}^ accel=^{accel.x} {accel.y} {accel.z}^ xdir=^{xdir}^ ydir=^{ydir}^ zdir=^{zdir}^ scale=^{scale.x} {scale.y} {scale.z}^ col=^{col.0} {col.1} {col.2}^ lighting=^{lighting}^ visible=^{visible}^ />');

  elation.component.add('engine.things.janusbase', function() {
    this.postinit = function() {
      elation.engine.things.janusbase.extendclass.postinit.call(this);
      this.defineProperties({
        js_id: { type: 'string' },
        room: { type: 'object' },
      });
    }
    this.setProperties = function(props) {
      var n = this.properties.room.parseNode(props);
      var rebuild = false;

      if (n.pos) this.properties.position.fromArray(n.pos);
      if (n.scale) this.properties.scale.fromArray(n.scale);
      if (n.orientation) this.properties.orientation.copy(n.orientation);
  
      if (n.id && n.id != this.properties.render.model) {
        this.properties.render.model = n.id;
        rebuild = true;
      }
      var curcol = this.properties.col;
      if (n.col && (n.col[0] != curcol[0] || n.col[1] != curcol[1] || n.col[2] != curcol[2])) {
        this.properties.col = n.col;
        rebuild = true;
      }
      if (rebuild) {
        this.set('visible', true, true);
      }
      if (n.accel) this.properties.acceleration.fromArray(n.accel.split(' ').map(parseFloat));
      if (n.vel) this.objects.dynamics.setVelocity(this.properties.velocity.fromArray(n.vel.split(' ').map(parseFloat)));
      this.refresh();
    } 
    this.summarizeXML = function() {
      //'<Object id=^{id}^ js_id=^{js_id}^ locked=^false^ pos=^{pos.x} {pos.y} {pos.z}^ vel=^{vel.x} {vel.y} {vel.z}^ accel=^{accel.x} {accel.y} {accel.z}^ xdir=^{xdir}^ ydir=^{ydir}^ zdir=^{zdir}^ scale=^{scale.x} {scale.y} {scale.z}^ col=^{color}^ lighting=^{lighting}^ visible=^{visible}^ />');

      var xml = elation.template.get('janusweb.edit.object', {
        id: this.properties.render.model,
        js_id: this.properties.js_id,
        pos: this.properties.position,
        vel: this.properties.velocity,
        accel: this.properties.acceleration,
        scale: this.properties.scale,
        col: this.properties.col,
        lighting: this.properties.lighting,
        visible: this.properties.visible,
      });
      return xml;
    }
    
  }, elation.engine.things.generic);
});

@@ -362,26 +362,8 @@
 %7Bcol
-.0%7D %7Bcol.1%7D %7Bcol.2
 %7D%5E l
@@ -2021,58 +2021,272 @@
 var 
-xml = elation.template.get('janusweb.edit.object',
+matrix = new THREE.Matrix4().makeRotationFromQuaternion(this.properties.orientation);%0A      var xdir = new THREE.Vector3(),%0A          ydir = new THREE.Vector3(),%0A          zdir = new THREE.Vector3();%0A      matrix.extractBasis(xdir, ydir, zdir);%0A%0A      var objdef =
  %7B%0A 
@@ -2521,24 +2521,144 @@
 ties.scale,%0A
+        xdir: xdir.toArray().join(' '),%0A        ydir: ydir.toArray().join(' '),%0A        zdir: zdir.toArray().join(' '),%0A
         col:
@@ -2765,23 +2765,93 @@
 isible,%0A
-
       %7D
+;%0A%0A      var xml = elation.template.get('janusweb.edit.object', objdef
 );%0A     

Fix for color and rotation in edit mode