aboutsummaryrefslogtreecommitdiff
path: root/js/lib/drawing/world.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-03 10:58:03 -0700
committerValerio Virgillito2012-05-03 10:58:03 -0700
commitbe1806505f4af86c3b5c15454e67cb8cec696554 (patch)
tree137be320b75d29c295b332d381bd1851241887a6 /js/lib/drawing/world.js
parent30bf02869c93072cdb3a3a8b50cf943917f3b026 (diff)
parent691beb1c39fc0baa683f1fc56cbc519fe58f306d (diff)
downloadninja-be1806505f4af86c3b5c15454e67cb8cec696554.tar.gz
Merge branch 'refs/heads/master' into data-id
Diffstat (limited to 'js/lib/drawing/world.js')
-rwxr-xr-xjs/lib/drawing/world.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 1a391338..7ce23921 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -362,9 +362,9 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
362 362
363 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state 363 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state
364 // in the case of a procedurally built scene an init state is not needed for loading data 364 // in the case of a procedurally built scene an init state is not needed for loading data
365 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" );
365 if (this._useWebGL) { 366 if (this._useWebGL) {
366 rdgeStarted = true; 367 rdgeStarted = true;
367 this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" );
368 RDGE.globals.engine.unregisterCanvas( this._canvas ); 368 RDGE.globals.engine.unregisterCanvas( this._canvas );
369 RDGE.globals.engine.registerCanvas(this._canvas, this); 369 RDGE.globals.engine.registerCanvas(this._canvas, this);
370 RDGE.RDGEStart( this._canvas ); 370 RDGE.RDGEStart( this._canvas );
@@ -758,7 +758,7 @@ World.prototype.exportJSON = function () {
758 // would not be destructive of the data. You would be wrong... 758 // would not be destructive of the data. You would be wrong...
759 // We need to rebuild everything 759 // We need to rebuild everything
760 if (this._useWebGL) { 760 if (this._useWebGL) {
761 if (worldObj.children && (worldObj.children.length === 1)) { 761 if (worldObj.children && (worldObj.children.length >= 1)) {
762 this.rebuildTree(this._geomRoot); 762 this.rebuildTree(this._geomRoot);
763 this.restartRenderLoop(); 763 this.restartRenderLoop();
764 } 764 }
@@ -835,8 +835,11 @@ World.prototype.importJSON = function (jObj) {
835 835
836 // import the objects 836 // import the objects
837 // there should be exactly one child of the parent object 837 // there should be exactly one child of the parent object
838 if (jObj.children && (jObj.children.length === 1)) 838 if (jObj.children)
839 this.importObjectsJSON( jObj.children[0] ); 839 {
840 for (var i=0; i<jObj.children.length; i++)
841 this.importObjectsJSON( jObj.children[i] );
842 }
840 else 843 else
841 throw new Error ("unrecoverable canvas import error - inconsistent root object: " + jObj.children ); 844 throw new Error ("unrecoverable canvas import error - inconsistent root object: " + jObj.children );
842 845