Browse Source

Some prefab inspector improvements

Josh Engebretson 10 years ago
parent
commit
9c90dc5165

+ 0 - 2
Script/AtomicEditor/ui/HierarchyFrame.ts

@@ -33,8 +33,6 @@ class HierarchyFrame extends Atomic.UIWidget {
 
         });
 
-
-
     }
 
     recursiveAddNode(parentID: number, node: Atomic.Node) {

+ 37 - 1
Script/AtomicEditor/ui/inspector/ComponentInspector.ts

@@ -31,12 +31,40 @@ class ComponentInspector extends Atomic.UISection {
 
     }
 
+    addPrefabUI(layout:Atomic.UILayout) {
+
+      // expand prefab
+      this.value = 1;
+
+      var fd = new Atomic.UIFontDescription();
+      fd.id = "Vera";
+      fd.size = 11;
+
+      var selectButton = new Atomic.UIButton();
+      selectButton.text = "Select Prefab";
+      selectButton.fontDescription = fd;
+
+      selectButton.onClick = () => {
+
+          var node = (<Atomic.PrefabComponent> this.component).getPrefabNode();
+
+          this.sendEvent("EditorActiveNodeChange", { node: node });
+
+          return true;
+
+      }
+
+      layout.addChild(selectButton);
+
+
+    }
 
     inspect(component: Atomic.Component) {
 
         this.component = component;
         this.text = component.getTypeName();
-        // don't example by default
+
+        // don't expand by default
         this.value = 0;
 
         var fd = new Atomic.UIFontDescription();
@@ -101,6 +129,12 @@ class ComponentInspector extends Atomic.UISection {
 
         }
 
+        if (component.getTypeName() == "PrefabComponent") {
+
+          this.addPrefabUI(attrsVerticalLayout);
+
+        }
+
         var deleteButton = new Atomic.UIButton();
         deleteButton.text = "Delete Component";
         deleteButton.fontDescription = fd;
@@ -109,6 +143,8 @@ class ComponentInspector extends Atomic.UISection {
 
             var node = this.component.node;
             this.component.remove();
+
+            // refresh entire inspector, fix this...
             this.sendEvent("EditorActiveNodeChange", { node: node });
 
             return true;