Browse Source

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

Mr.doob 9 years ago
parent
commit
96ceac439e
1 changed files with 18 additions and 6 deletions
  1. 18 6
      editor/js/Menubar.File.js

+ 18 - 6
editor/js/Menubar.File.js

@@ -86,8 +86,12 @@ Menubar.File = function ( editor ) {
 		}
 		}
 
 
 		var output = geometry.toJSON();
 		var output = geometry.toJSON();
-		output = JSON.stringify( output, null, '\t' );
-		output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		try {
+			output = JSON.stringify( output, null, '\t' );
+			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		} catch ( oops ) {
+			output = JSON.stringify( output );
+		}
 
 
 		exportString( output, 'geometry.json' );
 		exportString( output, 'geometry.json' );
 
 
@@ -111,8 +115,12 @@ Menubar.File = function ( editor ) {
 		}
 		}
 
 
 		var output = object.toJSON();
 		var output = object.toJSON();
-		output = JSON.stringify( output, null, '\t' );
-		output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		try {
+			output = JSON.stringify( output, null, '\t' );
+			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		} catch ( oops ) {
+			output = JSON.stringify( output );
+		}
 
 
 		exportString( output, 'model.json' );
 		exportString( output, 'model.json' );
 
 
@@ -127,8 +135,12 @@ Menubar.File = function ( editor ) {
 	option.onClick( function () {
 	option.onClick( function () {
 
 
 		var output = editor.scene.toJSON();
 		var output = editor.scene.toJSON();
-		output = JSON.stringify( output, null, '\t' );
-		output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		try {
+			output = JSON.stringify( output, null, '\t' );
+			output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
+		} catch ( oops ) {
+			output = JSON.stringify( output );
+		}
 
 
 		exportString( output, 'scene.json' );
 		exportString( output, 'scene.json' );