Browse Source

InspectorWidget section cleanup

Josh Engebretson 10 years ago
parent
commit
662d356f82

+ 6 - 2
Data/AtomicEditor/Resources/EditorData/AtomicEditor/typescript/ui/inspector/InspectorWidget.ts

@@ -42,7 +42,7 @@ class InspectorWidget extends ScriptWidget {
       return nameField;
     }
 
-    createSection(text:string, expanded:number):Atomic.UISection {
+    createSection(parent:Atomic.UIWidget, text:string, expanded:number):Atomic.UILayout {
 
       var section = new Atomic.UISection();
 
@@ -50,7 +50,11 @@ class InspectorWidget extends ScriptWidget {
       section.value = expanded;
       section.fontDescription = this.attrFontDesc;
 
-      return section;
+      var layout = this.createVerticalAttrLayout();
+      parent.addChild(section);
+      section.contentRoot.addChild(layout);
+
+      return layout;
 
     }
 

+ 6 - 12
Data/AtomicEditor/Resources/EditorData/AtomicEditor/typescript/ui/inspector/ModelInspector.ts

@@ -38,27 +38,21 @@ class ModelInspector extends InspectorWidget {
         var rootLayout = this.rootLayout;
 
         // Model Section
-        var modelSection = this.createSection("Model", 1);
-        var modelVerticalLayout = this.createVerticalAttrLayout();
-        rootLayout.addChild(modelSection);
-        modelSection.contentRoot.addChild(modelVerticalLayout);
+        var modelLayout = this.createSection(rootLayout, "Model", 1);
 
-        this.scaleEdit = this.createAttrEditField("Scale", modelVerticalLayout);
+        this.scaleEdit = this.createAttrEditField("Scale", modelLayout);
         this.scaleEdit.text = this.importer.scale.toString();
 
         // Animations Section
-        var animationSection = this.createSection("Animation", 1);
-        var animVerticalLayout = this.createVerticalAttrLayout();
-        rootLayout.addChild(animationSection);
-        animationSection.contentRoot.addChild(animVerticalLayout);
+        var animationLayout = this.createSection(rootLayout, "Animation", 1);
 
-        this.importAnimationBox = this.createAttrCheckBox("Import Animations", animVerticalLayout);
+        this.importAnimationBox = this.createAttrCheckBox("Import Animations", animationLayout);
         this.importAnimationBox.value = this.importer.importAnimations ? 1 : 0;
 
-        this.startTimeEdit = this.createAttrEditField("Start Time", animVerticalLayout);
+        this.startTimeEdit = this.createAttrEditField("Start Time", animationLayout);
         this.startTimeEdit.text = this.importer.startTime.toString();
 
-        this.endTimeEdit = this.createAttrEditField("End Time", animVerticalLayout);
+        this.endTimeEdit = this.createAttrEditField("End Time", animationLayout);
         this.endTimeEdit.text = this.importer.endTime.toString();
 
         // apply button