@@ -86,8 +86,12 @@ Menubar.File = function ( editor ) {
86
86
}
87
87
88
88
var output = geometry . toJSON ( ) ;
89
- output = JSON . stringify ( output , null , '\t' ) ;
90
- output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
89
+ try {
90
+ output = JSON . stringify ( output , null , '\t' ) ;
91
+ output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
92
+ } catch ( oops ) {
93
+ output = JSON . stringify ( output ) ;
94
+ }
91
95
92
96
exportString ( output , 'geometry.json' ) ;
93
97
@@ -111,8 +115,12 @@ Menubar.File = function ( editor ) {
111
115
}
112
116
113
117
var output = object . toJSON ( ) ;
114
- output = JSON . stringify ( output , null , '\t' ) ;
115
- output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
118
+ try {
119
+ output = JSON . stringify ( output , null , '\t' ) ;
120
+ output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
121
+ } catch ( oops ) {
122
+ output = JSON . stringify ( output ) ;
123
+ }
116
124
117
125
exportString ( output , 'model.json' ) ;
118
126
@@ -127,8 +135,12 @@ Menubar.File = function ( editor ) {
127
135
option . onClick ( function ( ) {
128
136
129
137
var output = editor . scene . toJSON ( ) ;
130
- output = JSON . stringify ( output , null , '\t' ) ;
131
- output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
138
+ try {
139
+ output = JSON . stringify ( output , null , '\t' ) ;
140
+ output = output . replace ( / [ \n \t ] + ( [ \d \. e \- \[ \] ] + ) / g, '$1' ) ;
141
+ } catch ( oops ) {
142
+ output = JSON . stringify ( output ) ;
143
+ }
132
144
133
145
exportString ( output , 'scene.json' ) ;
134
146
0 commit comments