diff options
author | Jose Antonio Marquez | 2012-03-09 10:13:59 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-03-09 10:13:59 -0800 |
commit | d549383abf18a0dc54a990983fb4296602b66120 (patch) | |
tree | ac107d3823abb846c1afae3d03abce0f6aae2c98 /js/lib/drawing | |
parent | 3bcdfaa322ac53609b66ecedbace1872048fd310 (diff) | |
parent | 7b6e8194b91168abdeb94702eb350d14f147858b (diff) | |
download | ninja-d549383abf18a0dc54a990983fb4296602b66120.tar.gz |
Merge branch 'refs/heads/integration' into FileIO-Integration
Conflicts:
js/document/html-document.js
Diffstat (limited to 'js/lib/drawing')
-rwxr-xr-x | js/lib/drawing/world.js | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index b8bceda6..cffd0083 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -349,7 +349,7 @@ var World = function GLWorld( canvas, use3D ) { | |||
349 | 349 | ||
350 | this.generateUniqueNodeID = function() | 350 | this.generateUniqueNodeID = function() |
351 | { | 351 | { |
352 | var str = String( this._nodeCounter ); | 352 | var str = "" + this._nodeCounter; |
353 | this._nodeCounter++; | 353 | this._nodeCounter++; |
354 | return str; | 354 | return str; |
355 | } | 355 | } |
@@ -727,7 +727,8 @@ World.prototype.getShapeFromPoint = function( offsetX, offsetY ) { | |||
727 | } | 727 | } |
728 | }; | 728 | }; |
729 | 729 | ||
730 | World.prototype.export = function( exportForPublish ) { | 730 | World.prototype.export = function( imagePath ) |
731 | { | ||
731 | var exportStr = "GLWorld 1.0\n"; | 732 | var exportStr = "GLWorld 1.0\n"; |
732 | var id = this.getCanvas().getAttribute( "data-RDGE-id" ); | 733 | var id = this.getCanvas().getAttribute( "data-RDGE-id" ); |
733 | exportStr += "id: " + id + "\n"; | 734 | exportStr += "id: " + id + "\n"; |
@@ -742,9 +743,17 @@ World.prototype.export = function( exportForPublish ) { | |||
742 | // we need 2 export modes: One for save/restore, one for publish. | 743 | // we need 2 export modes: One for save/restore, one for publish. |
743 | // hardcoding for now | 744 | // hardcoding for now |
744 | //var exportForPublish = false; | 745 | //var exportForPublish = false; |
745 | if (!exportForPublish) exportForPublish = false; | 746 | //if (!exportForPublish) exportForPublish = false; |
747 | var exportForPublish = true; | ||
746 | exportStr += "publish: " + exportForPublish + "\n"; | 748 | exportStr += "publish: " + exportForPublish + "\n"; |
747 | 749 | ||
750 | // the relative path for local assets needs to be modified to | ||
751 | // the path specified by argument 'imagePath'. Save that path | ||
752 | // so exporting functions can call newPath = world.cleansePath( oldPath ); | ||
753 | this._imagePath = imagePath.slice(); | ||
754 | var endchar = this._imagePath[this._imagePath.length-1] | ||
755 | if (endchar != '/') this._imagePath += '/'; | ||
756 | |||
748 | if (exportForPublish && this._useWebGL) | 757 | if (exportForPublish && this._useWebGL) |
749 | { | 758 | { |
750 | exportStr += "scenedata: " + this.myScene.exportJSON() + "endscene\n"; | 759 | exportStr += "scenedata: " + this.myScene.exportJSON() + "endscene\n"; |
@@ -928,6 +937,20 @@ World.prototype.importSubObject = function( objStr, parentNode ) { | |||
928 | return trNode; | 937 | return trNode; |
929 | }; | 938 | }; |
930 | 939 | ||
940 | World.prototype.cleansePath = function( url ) | ||
941 | { | ||
942 | //this._imagePath | ||
943 | var searchStr = "assets/"; | ||
944 | var index = url.indexOf( searchStr ); | ||
945 | var rtnPath = url; | ||
946 | if (index >= 0) | ||
947 | { | ||
948 | rtnPath = url.substr( index + searchStr.length ); | ||
949 | rtnPath = this._imagePath + rtnPath; | ||
950 | } | ||
951 | return rtnPath; | ||
952 | } | ||
953 | |||
931 | if (typeof exports === "object") { | 954 | if (typeof exports === "object") { |
932 | exports.World = World; | 955 | exports.World = World; |
933 | } \ No newline at end of file | 956 | } \ No newline at end of file |