diff --git a/editor/js/Menubar.File.js b/editor/js/Menubar.File.js index b7e03c9e2c5e5c415bde401fd91214ec0f80112b..6b532069df06e3e34e6c34017f2582c0e8a4ae00 100644 --- a/editor/js/Menubar.File.js +++ b/editor/js/Menubar.File.js @@ -86,8 +86,12 @@ Menubar.File = function ( editor ) { } 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' ); @@ -111,8 +115,12 @@ Menubar.File = function ( editor ) { } 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' ); @@ -127,8 +135,12 @@ Menubar.File = function ( editor ) { option.onClick( function () { 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' );