|
|
@@ -1,8 +1,8 @@
|
|
|
|
|
|
|
|
|
-import ScriptWidget = require("../ScriptWidget");
|
|
|
+import InspectorWidget = require("./InspectorWidget");
|
|
|
|
|
|
-class ModelInspector extends ScriptWidget {
|
|
|
+class ModelInspector extends InspectorWidget {
|
|
|
|
|
|
constructor() {
|
|
|
|
|
|
@@ -16,72 +16,66 @@ class ModelInspector extends ScriptWidget {
|
|
|
|
|
|
}
|
|
|
|
|
|
- inspect(asset: ToolCore.Asset) {
|
|
|
-
|
|
|
- var fd = new Atomic.UIFontDescription();
|
|
|
- fd.id = "Vera";
|
|
|
- fd.size = 11;
|
|
|
-
|
|
|
- var nlp = new Atomic.UILayoutParams();
|
|
|
- nlp.width = 320;
|
|
|
+ onApply() {
|
|
|
|
|
|
- var assetLayout = new Atomic.UILayout();
|
|
|
- assetLayout.spacing = 4;
|
|
|
+ this.importer.scale = Number(this.scaleEdit.text);
|
|
|
+ this.importer.startTime = Number(this.startTimeEdit.text);
|
|
|
+ this.importer.endTime = Number(this.endTimeEdit.text);
|
|
|
|
|
|
- assetLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION_GRAVITY;
|
|
|
- assetLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION_LEFT_TOP;
|
|
|
- assetLayout.layoutParams = nlp;
|
|
|
- assetLayout.axis = Atomic.UI_AXIS_Y;
|
|
|
-
|
|
|
- // node attr layout
|
|
|
+ this.importer.importAnimations = this.importAnimationBox.value ? true : false;
|
|
|
|
|
|
- var modelSection = new Atomic.UISection();
|
|
|
- modelSection.text = "Model Import";
|
|
|
- modelSection.value = 1;
|
|
|
- //modelSection.textAlign = Atomic.UI_TEXT_ALIGN_LEFT;
|
|
|
- //modelSection.skinBg = "InspectorTextLabel";
|
|
|
- assetLayout.addChild(modelSection);
|
|
|
+ this.importer.import(this.asset.guid);
|
|
|
+ this.asset.save();
|
|
|
|
|
|
- var attrsVerticalLayout = new Atomic.UILayout(Atomic.UI_AXIS_Y);
|
|
|
- attrsVerticalLayout.spacing = 3;
|
|
|
- attrsVerticalLayout.layoutPosition = Atomic.UI_LAYOUT_POSITION_LEFT_TOP;
|
|
|
- attrsVerticalLayout.layoutSize = Atomic.UI_LAYOUT_SIZE_AVAILABLE;
|
|
|
+ }
|
|
|
|
|
|
- modelSection.contentRoot.addChild(attrsVerticalLayout);
|
|
|
+ inspect(asset: ToolCore.Asset) {
|
|
|
|
|
|
- var attrLayout = new Atomic.UILayout();
|
|
|
+ this.asset = asset;
|
|
|
+ this.importer = <ToolCore.ModelImporter> asset.importer;
|
|
|
|
|
|
- attrLayout.layoutDistribution = Atomic.UI_LAYOUT_DISTRIBUTION_GRAVITY;
|
|
|
+ // node attr layout
|
|
|
+ var rootLayout = this.rootLayout;
|
|
|
|
|
|
- var name = new Atomic.UITextField();
|
|
|
- name.textAlign = Atomic.UI_TEXT_ALIGN_LEFT;
|
|
|
- name.skinBg = "InspectorTextAttrName";
|
|
|
- name.text = "Scale";
|
|
|
- name.fontDescription = fd;
|
|
|
- attrLayout.addChild(name);
|
|
|
+ // Model Section
|
|
|
+ var modelSection = this.createSection("Model", 1);
|
|
|
+ var modelVerticalLayout = this.createVerticalAttrLayout();
|
|
|
+ rootLayout.addChild(modelSection);
|
|
|
+ modelSection.contentRoot.addChild(modelVerticalLayout);
|
|
|
|
|
|
- var scaleEdit = new Atomic.UIEditField();
|
|
|
- scaleEdit.textAlign = Atomic.UI_TEXT_ALIGN_LEFT;
|
|
|
- scaleEdit.skinBg = "TBAttrEditorField";;
|
|
|
- scaleEdit.fontDescription = fd;
|
|
|
- var lp = new Atomic.UILayoutParams();
|
|
|
- lp.width = 180;
|
|
|
- scaleEdit.layoutParams = lp;
|
|
|
+ this.scaleEdit = this.createAttrEditField("Scale", modelVerticalLayout);
|
|
|
+ this.scaleEdit.text = this.importer.scale.toString();
|
|
|
|
|
|
- var importer = <ToolCore.ModelImporter> asset.importer;
|
|
|
+ // Animations Section
|
|
|
+ var animationSection = this.createSection("Animation", 1);
|
|
|
+ var animVerticalLayout = this.createVerticalAttrLayout();
|
|
|
+ rootLayout.addChild(animationSection);
|
|
|
+ animationSection.contentRoot.addChild(animVerticalLayout);
|
|
|
|
|
|
- scaleEdit.text = importer.scale.toString();
|
|
|
+ this.importAnimationBox = this.createAttrCheckBox("Import Animations", animVerticalLayout);
|
|
|
+ this.importAnimationBox.value = this.importer.importAnimations ? 1 : 0;
|
|
|
|
|
|
- attrLayout.addChild(scaleEdit);
|
|
|
+ this.startTimeEdit = this.createAttrEditField("Start Time", animVerticalLayout);
|
|
|
+ this.startTimeEdit.text = this.importer.startTime.toString();
|
|
|
|
|
|
- attrsVerticalLayout.addChild(attrLayout);
|
|
|
+ this.endTimeEdit = this.createAttrEditField("End Time", animVerticalLayout);
|
|
|
+ this.endTimeEdit.text = this.importer.endTime.toString();
|
|
|
|
|
|
- this.addChild(assetLayout);
|
|
|
+ // apply button
|
|
|
+ rootLayout.addChild(this.createApplyButton());
|
|
|
|
|
|
}
|
|
|
|
|
|
- bindings:Array<DataBinding> = new Array();
|
|
|
+ // model
|
|
|
+ scaleEdit:Atomic.UIEditField;
|
|
|
+
|
|
|
+ // animation
|
|
|
+ startTimeEdit:Atomic.UIEditField;
|
|
|
+ endTimeEdit:Atomic.UIEditField;
|
|
|
+ importAnimationBox:Atomic.UICheckBox;
|
|
|
|
|
|
+ asset:ToolCore.Asset;
|
|
|
+ importer:ToolCore.ModelImporter;
|
|
|
|
|
|
}
|
|
|
|