diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs b/IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs index 94062e26..4c683324 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditor.Designer.cs @@ -247,7 +247,7 @@ private void InitializeComponent() this.listBoxAssets.FormattingEnabled = true; this.listBoxAssets.Location = new System.Drawing.Point(6, 40); this.listBoxAssets.Name = "listBoxAssets"; - this.listBoxAssets.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; + this.listBoxAssets.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.listBoxAssets.Size = new System.Drawing.Size(507, 290); this.listBoxAssets.TabIndex = 3; this.listBoxAssets.SelectedIndexChanged += new System.EventHandler(this.listBoxAssets_SelectedIndexChanged); diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditor.cs b/IndustrialPark/ArchiveEditor/ArchiveEditor.cs index e78b3733..9a19c149 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditor.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditor.cs @@ -499,30 +499,27 @@ private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) private void listBoxAssets_SelectedIndexChanged(object sender, EventArgs e) { - if (listBoxAssets.SelectedItems != null) + archive.ClearSelectedAssets(); + foreach (string s in listBoxAssets.SelectedItems) + archive.SelectAsset(GetAssetIDFromName(s), true); + + if (listBoxAssets.SelectedItems.Count == 1) { - archive.ClearSelectedAssets(); - foreach (string s in listBoxAssets.SelectedItems) - archive.SelectAsset(GetAssetIDFromName(s), true); + buttonEditAsset.Enabled = true; - if (listBoxAssets.SelectedItems.Count == 1) + if (archive.GetFromAssetID(CurrentlySelectedAssetIDs()[0]) is IClickableAsset a) { - buttonEditAsset.Enabled = true; - - if (archive.GetFromAssetID(CurrentlySelectedAssetIDs()[0]) is IClickableAsset a) - { - if (a is AssetDYNA dyna) - buttonView.Visible = dyna.IsRenderableClickable; - else - buttonView.Visible = true; - } + if (a is AssetDYNA dyna) + buttonView.Visible = dyna.IsRenderableClickable; else - buttonView.Visible = false; + buttonView.Visible = true; } else - { - buttonEditAsset.Enabled = false; - } + buttonView.Visible = false; + } + else + { + buttonEditAsset.Enabled = false; } } @@ -538,21 +535,43 @@ public void MouseMoveY(SharpCamera camera, int deltaY) public void SetSelectedIndexes(List assetIDs, bool add = false) { - if (!add) + if (assetIDs.Contains(0) && !add) + { listBoxAssets.SelectedIndices.Clear(); + archive.UpdateGizmoPosition(); + return; + } + + if (add) + assetIDs.AddRange(CurrentlySelectedAssetIDs()); + + listBoxAssets.SelectedIndices.Clear(); + + AssetType assetType = AssetType.Null; foreach (uint u in assetIDs) - { - try + if (archive.ContainsAsset(u)) { + assetType = archive.GetFromAssetID(u).AHDR.assetType; comboBoxLayers.SelectedIndex = archive.GetLayerFromAssetID(u); - comboBoxAssetTypes.SelectedItem = archive.GetFromAssetID(u).AHDR.assetType; + break; } - catch + + foreach (uint u in assetIDs) + if (archive.ContainsAsset(u) && archive.GetFromAssetID(u).AHDR.assetType != assetType) { - PopulateAssetList(); + assetType = AssetType.Null; + break; } + comboBoxAssetTypes.SelectedItem = assetType; + PopulateAssetList(assetType); + + foreach (uint u in assetIDs) + { + if (!archive.ContainsAsset(u)) + continue; + for (int i = 0; i < listBoxAssets.Items.Count; i++) if (GetAssetIDFromName(listBoxAssets.Items[i] as string) == u) listBoxAssets.SelectedIndices.Add(i); diff --git a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs index f1dfb50c..da07769b 100644 --- a/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs +++ b/IndustrialPark/ArchiveEditor/ArchiveEditorFunctions.cs @@ -625,20 +625,27 @@ public void OpenInternalEditor(List list) private void OpenInternalEditor(Asset asset) { - for (int i = 0; i < internalEditors.Count; i++) - if (internalEditors[i].GetAssetID() == asset.AHDR.assetID) - internalEditors[i].Close(); + CloseInternalEditor(asset.AHDR.assetID); - if (asset is AssetCAM CAM) - internalEditors.Add(new InternalCamEditor(CAM, this)); - else if (asset is AssetDYNA DYNA) - internalEditors.Add(new InternalDynaEditor(DYNA, this)); - else if (asset is AssetTEXT TEXT) - internalEditors.Add(new InternalTextEditor(TEXT, this)); - else if (asset.AHDR.assetType == AssetType.SND | asset.AHDR.assetType == AssetType.SNDS) - internalEditors.Add(new InternalSoundEditor(asset, this)); - else - internalEditors.Add(new InternalAssetEditor(asset, this)); + switch (asset.AHDR.assetType) + { + case AssetType.CAM: + internalEditors.Add(new InternalCamEditor((AssetCAM)asset, this)); + break; + case AssetType.DYNA: + internalEditors.Add(new InternalDynaEditor((AssetDYNA)asset, this)); + break; + case AssetType.TEXT: + internalEditors.Add(new InternalTextEditor((AssetTEXT)asset, this)); + break; + case AssetType.SND: + case AssetType.SNDS: + internalEditors.Add(new InternalSoundEditor(asset, this)); + break; + default: + internalEditors.Add(new InternalAssetEditor(asset, this)); + break; + } internalEditors.Last().Show(); } diff --git a/IndustrialPark/MainForm/MainForm.cs b/IndustrialPark/MainForm/MainForm.cs index 822c645a..435fe2e5 100644 --- a/IndustrialPark/MainForm/MainForm.cs +++ b/IndustrialPark/MainForm/MainForm.cs @@ -598,8 +598,8 @@ public void ScreenClicked(Rectangle viewRectangle, int X, int Y, bool isMouseDow } else assetID = ArchiveEditorFunctions.GetClickedAssetID(ray); - if (assetID != 0) - Program.MainForm.SetSelectedIndex(assetID); + + Program.MainForm.SetSelectedIndex(assetID); } } }