|
|
@@ -125,6 +125,11 @@ class ComponentInspector extends Atomic.UISection {
|
|
|
this.addModelUI(attrsVerticalLayout, component.typeName);
|
|
|
}
|
|
|
|
|
|
+ if (component.typeName == "SoundSource" || component.typeName == "SoundSource3D") {
|
|
|
+ this.addSoundSourceUI(attrsVerticalLayout, component.typeName);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
var deleteButton = new Atomic.UIButton();
|
|
|
deleteButton.text = "Delete Component";
|
|
|
deleteButton.fontDescription = fd;
|
|
|
@@ -197,7 +202,7 @@ class ComponentInspector extends Atomic.UISection {
|
|
|
|
|
|
}
|
|
|
|
|
|
- addModelUI(layout: Atomic.UILayout, typeName:string) {
|
|
|
+ addModelUI(layout: Atomic.UILayout, typeName: string) {
|
|
|
|
|
|
var staticModel = <Atomic.StaticModel> this.component;
|
|
|
var cacheModel = staticModel.model;
|
|
|
@@ -371,6 +376,51 @@ class ComponentInspector extends Atomic.UISection {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ addSoundSourceUI(layout: Atomic.UILayout, typeName: string) {
|
|
|
+
|
|
|
+ var sndSource = <Atomic.SoundSource> this.component;
|
|
|
+
|
|
|
+ var o = InspectorUtils.createAttrEditFieldWithSelectButton("Sound", layout);
|
|
|
+ var field = o.editField;
|
|
|
+ field.readOnly = true;
|
|
|
+ field.text = sndSource.sound ? sndSource.sound.name : "";
|
|
|
+
|
|
|
+ var select = o.selectButton;
|
|
|
+
|
|
|
+ select.onClick = () => {
|
|
|
+
|
|
|
+ EditorUI.getModelOps().showResourceSelection("Select Sound", "AudioImporter", function(asset: ToolCore.Asset) {
|
|
|
+
|
|
|
+ sndSource.sound = <Atomic.Sound> Atomic.cache.getResource("Sound", asset.path);
|
|
|
+ if (sndSource.sound)
|
|
|
+ field.text = sndSource.sound.name;
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // handle dropping of component on field
|
|
|
+ field.subscribeToEvent(field, "DragEnded", (ev: Atomic.DragEndedEvent) => {
|
|
|
+
|
|
|
+ if (ev.target == field) {
|
|
|
+
|
|
|
+ var importer = this.acceptAssetDrag("AudioImporter", ev);
|
|
|
+
|
|
|
+ if (importer) {
|
|
|
+
|
|
|
+ sndSource.sound = <Atomic.Sound> Atomic.cache.getResource("Sound", importer.asset.path);
|
|
|
+ if (sndSource.sound)
|
|
|
+ field.text = sndSource.sound.name;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
addLightCascadeParametersUI(layout: Atomic.UILayout) {
|
|
|
|
|
|
var light = <Atomic.Light> this.component;
|