Browse Source

Editor: Loading external states.

Mr.doob 10 years ago
parent
commit
1842993471
1 changed files with 21 additions and 0 deletions
  1. 21 0
      editor/index.html

+ 21 - 0
editor/index.html

@@ -237,6 +237,27 @@
 
 			onWindowResize();
 
+			//
+
+			var hash = window.location.hash;
+
+			if ( hash.substr( 1, 4 ) === 'app=' ) {
+
+				if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
+
+					var loader = new THREE.XHRLoader();
+					loader.crossOrigin = '';
+					loader.load( hash.substr( 5 ), function ( text ) {
+
+						var json = JSON.parse( text );
+						editor.fromJSON( json );
+
+					} );
+
+				}
+
+			}
+
 		</script>
 	</body>
 </html>