diff --git a/editor/js/Menubar.File.js b/editor/js/Menubar.File.js index cf3b7588dbe01ec5471395f30aa470934dd8da13..675584f303d9ce1bd1b6a6d849e3bc94fc6fdd43 100644 --- a/editor/js/Menubar.File.js +++ b/editor/js/Menubar.File.js @@ -218,6 +218,8 @@ Menubar.File = function ( editor ) { output.metadata.type = 'App'; delete output.history; + var vr = output.project.vr; + output = JSON.stringify( output, null, '\t' ); output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' ); @@ -234,6 +236,17 @@ Menubar.File = function ( editor ) { var loader = new THREE.XHRLoader( manager ); loader.load( 'js/libs/app/index.html', function ( content ) { + var includes = []; + + if ( vr ) { + + includes.push( '' ); + includes.push( '' ); + + } + + content = content.replace( '', includes.join( '\n\t\t' ) ); + zip.file( 'index.html', content ); } ); @@ -248,17 +261,21 @@ Menubar.File = function ( editor ) { } ); - loader.load( '../examples/js/controls/VRControls.js', function ( content ) { + if ( vr ) { - zip.file( 'js/VRControls.js', content ); + loader.load( '../examples/js/controls/VRControls.js', function ( content ) { - } ); + zip.file( 'js/VRControls.js', content ); - loader.load( '../examples/js/effects/VREffect.js', function ( content ) { + } ); - zip.file( 'js/VREffect.js', content ); + loader.load( '../examples/js/effects/VREffect.js', function ( content ) { - } ); + zip.file( 'js/VREffect.js', content ); + + } ); + + } } ); options.add( option ); diff --git a/editor/js/Storage.js b/editor/js/Storage.js index f6c4a9f6983d8d255acc8eed666e0846f6503ee6..42a9cee983177c26a6b0b7db9b707ad044728a72 100644 --- a/editor/js/Storage.js +++ b/editor/js/Storage.js @@ -80,6 +80,8 @@ var Storage = function () { clear: function () { + if ( database === undefined ) return; + var transaction = database.transaction( [ 'states' ], 'readwrite' ); var objectStore = transaction.objectStore( 'states' ); var request = objectStore.clear(); diff --git a/editor/js/libs/app/index.html b/editor/js/libs/app/index.html index 812c71a1596dbfb01f89068a44312575244ec67c..98d594d5c75d259198dacbd63adf25b4f2df2590 100644 --- a/editor/js/libs/app/index.html +++ b/editor/js/libs/app/index.html @@ -30,8 +30,7 @@ - - +