Browse Source

Handle multiple scenes

Josh Engebretson 10 years ago
parent
commit
95bf74ff74
1 changed files with 16 additions and 4 deletions
  1. 16 4
      Script/AtomicEditor/ui/frames/inspector/InspectorFrame.ts

+ 16 - 4
Script/AtomicEditor/ui/frames/inspector/InspectorFrame.ts

@@ -47,17 +47,20 @@ class InspectorFrame extends ScriptWidget {
 
     handleActiveSceneEditorChanged(event: EditorEvents.ActiveSceneEditorChangeEvent) {
 
+        if (this.sceneEditor == event.sceneEditor) {
+            return;
+        }
+
         if (this.scene)
             this.unsubscribeFromEvents(this.scene);
 
+        this.closeSelectionInspector();
+
         this.sceneEditor = null;
         this.scene = null;
 
         if (!event.sceneEditor)
-        {
-            this.closeSelectionInspector();
-            return;
-        }
+          return;
 
         this.sceneEditor = event.sceneEditor;
         this.scene = event.sceneEditor.scene;
@@ -66,6 +69,15 @@ class InspectorFrame extends ScriptWidget {
 
             this.subscribeToEvent(this.scene, "SceneNodeSelected", (event: Editor.SceneNodeSelectedEvent) => this.handleSceneNodeSelected(event));
 
+            // add the current selection
+            var selection = this.sceneEditor.selection;
+
+            for (var i = 0; i < selection.getSelectedNodeCount(); i++) {
+
+                this.handleSceneNodeSelected( { node: selection.getSelectedNode(i),  scene: this.scene, selected: true} );
+
+            }
+
         }
 
     }