diff --git a/editor/js/Menubar.File.js b/editor/js/Menubar.File.js index 30c4a693a3d97111259a9dbb19eb80cd086d022f..7b448c9479f284931e637dbc7d126f03f792d972 100644 --- a/editor/js/Menubar.File.js +++ b/editor/js/Menubar.File.js @@ -88,10 +88,14 @@ Menubar.File = function ( editor ) { var output = geometry.toJSON(); try { + output = JSON.stringify( output, null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); + } catch ( e ) { + output = JSON.stringify( output ); + } exportString( output, 'geometry.json' ); @@ -118,10 +122,14 @@ Menubar.File = function ( editor ) { var output = object.toJSON(); try { + output = JSON.stringify( output, null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); + } catch ( e ) { + output = JSON.stringify( output ); + } exportString( output, 'model.json' ); @@ -139,10 +147,14 @@ Menubar.File = function ( editor ) { var output = editor.scene.toJSON(); try { + output = JSON.stringify( output, null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); + } catch ( e ) { + output = JSON.stringify( output ); + } exportString( output, 'scene.json' ); @@ -294,12 +306,12 @@ Menubar.File = function ( editor ) { link.download = filename || 'data.json'; link.target = '_blank'; - var event = document.createEvent("MouseEvents"); + var event = document.createEvent( 'MouseEvents' ); event.initMouseEvent( - "click", true, false, window, 0, 0, 0, 0, 0 - , false, false, false, false, 0, null + 'click', true, false, window, 0, 0, 0, 0, 0, + false, false, false, false, 0, null ); - link.dispatchEvent(event); + link.dispatchEvent( event ); }; diff --git a/examples/js/renderers/CanvasRenderer.js b/examples/js/renderers/CanvasRenderer.js index 71d575071e43e40b568f5417570a6bf831fc07a1..b5e7f93e8284afe89928330c702ead7b759e9c18 100644 --- a/examples/js/renderers/CanvasRenderer.js +++ b/examples/js/renderers/CanvasRenderer.js @@ -116,7 +116,7 @@ THREE.CanvasRenderer = function ( parameters ) { if ( _context.setLineDash === undefined ) { - _context.setLineDash = function () {} + _context.setLineDash = function () {}; } @@ -821,7 +821,7 @@ THREE.CanvasRenderer = function ( parameters ) { return { canvas: undefined, version: texture.version - } + }; } @@ -832,7 +832,7 @@ THREE.CanvasRenderer = function ( parameters ) { return { canvas: undefined, version: 0 - } + }; } @@ -866,7 +866,7 @@ THREE.CanvasRenderer = function ( parameters ) { return { canvas: _context.createPattern( canvas, repeat ), version: texture.version - } + }; } diff --git a/src/audio/Audio.js b/src/audio/Audio.js index 9e53aa463a6b69e69f6b50677da8e05fc0f24e3e..521bb69ea9065234fcba75785c2a769b5670b2b9 100644 --- a/src/audio/Audio.js +++ b/src/audio/Audio.js @@ -62,11 +62,13 @@ THREE.Audio.prototype.setBuffer = function ( audioBuffer ) { var scope = this; - audioBuffer.onReady(function(buffer) { + audioBuffer.onReady( function( buffer ) { + scope.source.buffer = buffer; scope.sourceType = 'buffer'; if ( scope.autoplay ) scope.play(); - }); + + } ); return this; diff --git a/src/audio/AudioBuffer.js b/src/audio/AudioBuffer.js index 53fb940ffa950d604307f0a562872d6e730c860e..c280ec69950ece12b774231026986de42c34513d 100644 --- a/src/audio/AudioBuffer.js +++ b/src/audio/AudioBuffer.js @@ -26,7 +26,7 @@ THREE.AudioBuffer.prototype.load = function ( file ) { for ( var i = 0; i < scope.readyCallbacks.length; i ++ ) { - scope.readyCallbacks[i](scope.buffer); + scope.readyCallbacks[ i ]( scope.buffer ); } diff --git a/src/audio/AudioListener.js b/src/audio/AudioListener.js index 50142a985eca8e91a38789f5725e5ff8f1bef53e..e342f7d047cef20c823bc6b974ddb8dc71018084 100644 --- a/src/audio/AudioListener.js +++ b/src/audio/AudioListener.js @@ -37,7 +37,7 @@ THREE.AudioListener.prototype.removeFilter = function ( ) { } -} +}; THREE.AudioListener.prototype.setFilter = function ( value ) { diff --git a/src/audio/PositionalAudio.js b/src/audio/PositionalAudio.js index b26de9e2692d5609c49d9f42cba6ea27c8bfd00f..e8cf04250c21da48a019af4dec2e9251fc5c2600 100644 --- a/src/audio/PositionalAudio.js +++ b/src/audio/PositionalAudio.js @@ -20,7 +20,6 @@ THREE.PositionalAudio.prototype.getOutput = function () { }; - THREE.PositionalAudio.prototype.setRefDistance = function ( value ) { this.panner.refDistance = value; @@ -69,7 +68,6 @@ THREE.PositionalAudio.prototype.getMaxDistance = function () { }; - THREE.PositionalAudio.prototype.updateMatrixWorld = ( function () { var position = new THREE.Vector3(); diff --git a/src/cameras/OrthographicCamera.js b/src/cameras/OrthographicCamera.js index a8461fc47be5874c5eeff75bfc4bfccef0fbb567..00175cf29974211cc732181d37720edbb2878c56 100644 --- a/src/cameras/OrthographicCamera.js +++ b/src/cameras/OrthographicCamera.js @@ -37,20 +37,20 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () { }; THREE.OrthographicCamera.prototype.copy = function ( source ) { - + THREE.Camera.prototype.copy.call( this, source ); - + this.left = source.left; this.right = source.right; this.top = source.top; this.bottom = source.bottom; this.near = source.near; this.far = source.far; - + this.zoom = source.zoom; - + return this; - + }; THREE.OrthographicCamera.prototype.toJSON = function ( meta ) { diff --git a/src/cameras/PerspectiveCamera.js b/src/cameras/PerspectiveCamera.js index a7fe40165e9a39070b6b90638c0ed99c598b64d1..1d9411f59b3eecbf80b750b43468d8628acae58f 100644 --- a/src/cameras/PerspectiveCamera.js +++ b/src/cameras/PerspectiveCamera.js @@ -123,18 +123,18 @@ THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () { }; THREE.PerspectiveCamera.prototype.copy = function ( source ) { - + THREE.Camera.prototype.copy.call( this, source ); - + this.fov = source.fov; this.aspect = source.aspect; this.near = source.near; this.far = source.far; - + this.zoom = source.zoom; - + return this; - + }; THREE.PerspectiveCamera.prototype.toJSON = function ( meta ) { diff --git a/src/core/BufferGeometry.js b/src/core/BufferGeometry.js index f98a6e409fb6a33bc79eaa53baaa6e2b184cdf25..f4117b643e315b3236cd36a550d1314ead59e910 100644 --- a/src/core/BufferGeometry.js +++ b/src/core/BufferGeometry.js @@ -436,16 +436,16 @@ THREE.BufferGeometry.prototype = { if ( geometry.uvsNeedUpdate ) { - var attribute = this.attributes.uv; + var attribute = this.attributes.uv; - if ( attribute !== undefined ) { + if ( attribute !== undefined ) { - attribute.copyVector2sArray( geometry.uvs ); - attribute.needsUpdate = true; + attribute.copyVector2sArray( geometry.uvs ); + attribute.needsUpdate = true; - } + } - geometry.uvsNeedUpdate = false; + geometry.uvsNeedUpdate = false; } @@ -710,11 +710,11 @@ THREE.BufferGeometry.prototype = { // reset existing normals to zero - var normals = attributes.normal.array; + var array = attributes.normal.array; - for ( var i = 0, il = normals.length; i < il; i ++ ) { + for ( var i = 0, il = array.length; i < il; i ++ ) { - normals[ i ] = 0; + array[ i ] = 0; } @@ -826,7 +826,7 @@ THREE.BufferGeometry.prototype = { computeOffsets: function ( size ) { - console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.'); + console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' ); }, diff --git a/src/core/Geometry.js b/src/core/Geometry.js index 334578c30ffa83e47b82e5e42cb89d933f5cf9bf..7ba9977a7334eab29aa71decddef31f8970c6f72 100644 --- a/src/core/Geometry.js +++ b/src/core/Geometry.js @@ -226,7 +226,7 @@ THREE.Geometry.prototype = { var tempUVs = []; var tempUVs2 = []; - for ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2) { + for ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2 ) { scope.vertices.push( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );