aboutsummaryrefslogtreecommitdiff
path: root/js/lib/drawing/world.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/drawing/world.js')
-rwxr-xr-xjs/lib/drawing/world.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 0ee66abe..0979cf12 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -751,6 +751,21 @@ World.prototype.exportJSON = function()
751 var strArray = []; 751 var strArray = [];
752 this.exportObjectsJSON( this._geomRoot, worldObj ); 752 this.exportObjectsJSON( this._geomRoot, worldObj );
753 753
754 // You would think that the RDGE export function
755 // would not be destructive of the data. You would be wrong...
756 // We need to rebuild everything
757 if (this._useWebGL)
758 {
759 var root = this._rootNode;
760 root.children = new Array();
761 if (worldObj.children && (worldObj.children.length === 1))
762 {
763 this.init();
764 this._geomRoot = undefined;
765 this.importObjectsJSON( worldObj.children[0] );
766 }
767 }
768
754 // convert the object to a string 769 // convert the object to a string
755 var jStr = JSON.stringify( worldObj ); 770 var jStr = JSON.stringify( worldObj );
756 771
@@ -759,14 +774,6 @@ World.prototype.exportJSON = function()
759 // and pre-JSON versions of fileIO. 774 // and pre-JSON versions of fileIO.
760 // the ending ';' in the version string is necessary 775 // the ending ';' in the version string is necessary
761 jStr = "v1.0;" + jStr; 776 jStr = "v1.0;" + jStr;
762
763 // You would think that the RDGE export function
764 // would not change the data. You would be wrong...
765 // rebuild the tree
766 var root = this._rootNode;
767 root.children = new Array();
768 if (worldObj.children && (worldObj.children.length === 1))
769 this.importObjectsJSON( worldObj.children[0] );
770 777
771 return jStr; 778 return jStr;
772} 779}
@@ -780,13 +787,14 @@ World.prototype.exportObjectsJSON = function( obj, parentObj )
780 parentObj.children.push( jObj ); 787 parentObj.children.push( jObj );
781 788
782 if (obj.getChild()) { 789 if (obj.getChild()) {
783 this.exportObjects( obj.getChild (), jObj ); 790 this.exportObjectsJSON( obj.getChild (), jObj );
784 } 791 }
785 792
786 if (obj.getNext()) 793 if (obj.getNext())
787 this.exportObjects( obj.getNext(), parentObj ); 794 this.exportObjectsJSON( obj.getNext(), parentObj );
788} 795}
789 796
797/*
790World.prototype.export = function() 798World.prototype.export = function()
791{ 799{
792 var exportStr = "GLWorld 1.0\n"; 800 var exportStr = "GLWorld 1.0\n";
@@ -849,6 +857,7 @@ World.prototype.exportObjects = function( obj ) {
849 857
850 return rtnStr; 858 return rtnStr;
851}; 859};
860*/
852 861
853World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { 862World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) {
854 //if (trNode == null) trNode = this._ctrNode; 863 //if (trNode == null) trNode = this._ctrNode;
@@ -893,6 +902,8 @@ World.prototype.importJSON = function( jObj )
893 // render using canvas 2D 902 // render using canvas 2D
894 this.render(); 903 this.render();
895 } 904 }
905 else
906 this.restartRenderLoop();
896} 907}
897 908
898World.prototype.importObjectsJSON = function( jObj, parentGeomObj ) 909World.prototype.importObjectsJSON = function( jObj, parentGeomObj )