Forráskód Böngészése

Editor: Added sceneCreated signal. Empty scene by default.

Mr.doob 13 éve
szülő
commit
4311f07156
3 módosított fájl, 16 hozzáadás és 8 törlés
  1. 9 8
      editor/index.html
  2. 6 0
      editor/js/ui/Sidebar.Outliner.js
  3. 1 0
      editor/js/ui/Viewport.js

+ 9 - 8
editor/index.html

@@ -47,6 +47,7 @@
 
 			var signals = {
 
+				sceneCreated: new SIGNALS.Signal(),
 				sceneChanged: new SIGNALS.Signal(),
 				objectAdded: new SIGNALS.Signal(),
 				objectSelected: new SIGNALS.Signal(),
@@ -63,18 +64,18 @@
 			menubar.setHeight( '32px' );
 			document.body.appendChild( menubar.dom );
 
-			var viewport = new Viewport( signals );
-			viewport.setTop( '32px' );
-			viewport.setWidth( '-webkit-calc(100% - 300px)', '-moz-calc(100% - 300px)', 'calc(100% - 300px)' );
-			viewport.setHeight( '-webkit-calc(100% - 32px)', '-moz-calc(100% - 32px)', 'calc(100% - 32px)' );
-			document.body.appendChild( viewport.dom );
-
 			var sidebar = new Sidebar( signals );
 			sidebar.setLeft( '-webkit-calc(100% - 300px)', '-moz-calc(100% - 300px)', 'calc(100% - 300px)' );
 			sidebar.setTop( '32px' );
 			sidebar.setHeight( '-webkit-calc(100% - 32px)', '-moz-calc(100% - 32px)', 'calc(100% - 32px)' );
 			document.body.appendChild( sidebar.dom );
 
+			var viewport = new Viewport( signals );
+			viewport.setTop( '32px' );
+			viewport.setWidth( '-webkit-calc(100% - 300px)', '-moz-calc(100% - 300px)', 'calc(100% - 300px)' );
+			viewport.setHeight( '-webkit-calc(100% - 32px)', '-moz-calc(100% - 32px)', 'calc(100% - 32px)' );
+			document.body.appendChild( viewport.dom );
+
 			document.addEventListener( 'drop', function ( event ) {
 
 				event.preventDefault();
@@ -217,7 +218,7 @@
 
 			}
 
-			//
+			/*
 
 			var geometry = new THREE.SphereGeometry( 75, 25, 15 );
 			var material = new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } );
@@ -226,7 +227,7 @@
 			signals.objectAdded.dispatch( mesh );
 			signals.objectSelected.dispatch( mesh );
 
-			//
+			*/
 
 			var onWindowResize = function ( event ) {
 

+ 6 - 0
editor/js/ui/Sidebar.Outliner.js

@@ -57,6 +57,12 @@ Sidebar.Outliner = function ( signals ) {
 
 	// events
 
+	signals.sceneCreated.add( function ( object ) {
+
+		scene = object;
+
+	} );
+
 	signals.sceneChanged.add( function ( object ) {
 
 		scene = object;

+ 1 - 0
editor/js/ui/Viewport.js

@@ -69,6 +69,7 @@ var Viewport = function ( signals ) {
 	light.position.set( - 1, - 0.5, 0 ).normalize();
 	scene.add( light );
 
+	signals.sceneChanged.dispatch( scene );
 
 	// object picking