Add set markers button to entity world search

This commit is contained in:
Lucas7yoshi 2021-10-21 22:24:24 -04:00
parent 458e9d365e
commit a938d70979
3 changed files with 54 additions and 25 deletions

View File

@ -31,6 +31,8 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WorldSearchForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WorldSearchForm));
this.MainTabControl = new System.Windows.Forms.TabControl(); this.MainTabControl = new System.Windows.Forms.TabControl();
this.EntitySearchTabPage = new System.Windows.Forms.TabPage(); this.EntitySearchTabPage = new System.Windows.Forms.TabPage();
this.EntitySearchSetMarkersButton = new System.Windows.Forms.Button();
this.EntitySearchExportResultsButton = new System.Windows.Forms.Button();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.EntityResultsListView = new System.Windows.Forms.ListView(); this.EntityResultsListView = new System.Windows.Forms.ListView();
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -52,6 +54,7 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.EntitySearchTextBox = new System.Windows.Forms.TextBox(); this.EntitySearchTextBox = new System.Windows.Forms.TextBox();
this.ArchetypeSearchTabPage = new System.Windows.Forms.TabPage(); this.ArchetypeSearchTabPage = new System.Windows.Forms.TabPage();
this.ArchetypeSearchExportResultsButton = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.ArchetypeResultsListView = new System.Windows.Forms.ListView(); this.ArchetypeResultsListView = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@ -70,8 +73,6 @@
this.ArchetypeSearchButton = new System.Windows.Forms.Button(); this.ArchetypeSearchButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.ArchetypeSearchTextBox = new System.Windows.Forms.TextBox(); this.ArchetypeSearchTextBox = new System.Windows.Forms.TextBox();
this.EntitySearchExportResultsButton = new System.Windows.Forms.Button();
this.ArchetypeSearchExportResultsButton = new System.Windows.Forms.Button();
this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.SaveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.MainTabControl.SuspendLayout(); this.MainTabControl.SuspendLayout();
this.EntitySearchTabPage.SuspendLayout(); this.EntitySearchTabPage.SuspendLayout();
@ -103,6 +104,7 @@
// //
// EntitySearchTabPage // EntitySearchTabPage
// //
this.EntitySearchTabPage.Controls.Add(this.EntitySearchSetMarkersButton);
this.EntitySearchTabPage.Controls.Add(this.EntitySearchExportResultsButton); this.EntitySearchTabPage.Controls.Add(this.EntitySearchExportResultsButton);
this.EntitySearchTabPage.Controls.Add(this.splitContainer2); this.EntitySearchTabPage.Controls.Add(this.splitContainer2);
this.EntitySearchTabPage.Controls.Add(this.EntitySearchStatusLabel); this.EntitySearchTabPage.Controls.Add(this.EntitySearchStatusLabel);
@ -120,6 +122,28 @@
this.EntitySearchTabPage.Text = "Entity Search"; this.EntitySearchTabPage.Text = "Entity Search";
this.EntitySearchTabPage.UseVisualStyleBackColor = true; this.EntitySearchTabPage.UseVisualStyleBackColor = true;
// //
// EntitySearchSetMarkersButton
//
this.EntitySearchSetMarkersButton.Enabled = false;
this.EntitySearchSetMarkersButton.Location = new System.Drawing.Point(426, 16);
this.EntitySearchSetMarkersButton.Name = "EntitySearchSetMarkersButton";
this.EntitySearchSetMarkersButton.Size = new System.Drawing.Size(89, 23);
this.EntitySearchSetMarkersButton.TabIndex = 9;
this.EntitySearchSetMarkersButton.Text = "Set markers...";
this.EntitySearchSetMarkersButton.UseVisualStyleBackColor = true;
this.EntitySearchSetMarkersButton.Click += new System.EventHandler(this.EntitySearchSetMarkersButton_Click);
//
// EntitySearchExportResultsButton
//
this.EntitySearchExportResultsButton.Enabled = false;
this.EntitySearchExportResultsButton.Location = new System.Drawing.Point(426, 43);
this.EntitySearchExportResultsButton.Name = "EntitySearchExportResultsButton";
this.EntitySearchExportResultsButton.Size = new System.Drawing.Size(89, 23);
this.EntitySearchExportResultsButton.TabIndex = 6;
this.EntitySearchExportResultsButton.Text = "Export results...";
this.EntitySearchExportResultsButton.UseVisualStyleBackColor = true;
this.EntitySearchExportResultsButton.Click += new System.EventHandler(this.EntitySearchExportResultsButton_Click);
//
// splitContainer2 // splitContainer2
// //
this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -359,6 +383,17 @@
this.ArchetypeSearchTabPage.Text = "Archetype Search"; this.ArchetypeSearchTabPage.Text = "Archetype Search";
this.ArchetypeSearchTabPage.UseVisualStyleBackColor = true; this.ArchetypeSearchTabPage.UseVisualStyleBackColor = true;
// //
// ArchetypeSearchExportResultsButton
//
this.ArchetypeSearchExportResultsButton.Enabled = false;
this.ArchetypeSearchExportResultsButton.Location = new System.Drawing.Point(426, 43);
this.ArchetypeSearchExportResultsButton.Name = "ArchetypeSearchExportResultsButton";
this.ArchetypeSearchExportResultsButton.Size = new System.Drawing.Size(89, 23);
this.ArchetypeSearchExportResultsButton.TabIndex = 5;
this.ArchetypeSearchExportResultsButton.Text = "Export results...";
this.ArchetypeSearchExportResultsButton.UseVisualStyleBackColor = true;
this.ArchetypeSearchExportResultsButton.Click += new System.EventHandler(this.ArchetypeSearchExportResultsButton_Click);
//
// splitContainer1 // splitContainer1
// //
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -560,28 +595,6 @@
this.ArchetypeSearchTextBox.TabIndex = 0; this.ArchetypeSearchTextBox.TabIndex = 0;
this.ArchetypeSearchTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ArchetypeSearchTextBox_KeyPress); this.ArchetypeSearchTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ArchetypeSearchTextBox_KeyPress);
// //
// EntitySearchExportResultsButton
//
this.EntitySearchExportResultsButton.Enabled = false;
this.EntitySearchExportResultsButton.Location = new System.Drawing.Point(426, 43);
this.EntitySearchExportResultsButton.Name = "EntitySearchExportResultsButton";
this.EntitySearchExportResultsButton.Size = new System.Drawing.Size(89, 23);
this.EntitySearchExportResultsButton.TabIndex = 6;
this.EntitySearchExportResultsButton.Text = "Export results...";
this.EntitySearchExportResultsButton.UseVisualStyleBackColor = true;
this.EntitySearchExportResultsButton.Click += new System.EventHandler(this.EntitySearchExportResultsButton_Click);
//
// ArchetypeSearchExportResultsButton
//
this.ArchetypeSearchExportResultsButton.Enabled = false;
this.ArchetypeSearchExportResultsButton.Location = new System.Drawing.Point(426, 43);
this.ArchetypeSearchExportResultsButton.Name = "ArchetypeSearchExportResultsButton";
this.ArchetypeSearchExportResultsButton.Size = new System.Drawing.Size(89, 23);
this.ArchetypeSearchExportResultsButton.TabIndex = 5;
this.ArchetypeSearchExportResultsButton.Text = "Export results...";
this.ArchetypeSearchExportResultsButton.UseVisualStyleBackColor = true;
this.ArchetypeSearchExportResultsButton.Click += new System.EventHandler(this.ArchetypeSearchExportResultsButton_Click);
//
// SaveFileDialog // SaveFileDialog
// //
this.SaveFileDialog.AddExtension = false; this.SaveFileDialog.AddExtension = false;
@ -664,5 +677,6 @@
private System.Windows.Forms.Button EntitySearchExportResultsButton; private System.Windows.Forms.Button EntitySearchExportResultsButton;
private System.Windows.Forms.Button ArchetypeSearchExportResultsButton; private System.Windows.Forms.Button ArchetypeSearchExportResultsButton;
private System.Windows.Forms.SaveFileDialog SaveFileDialog; private System.Windows.Forms.SaveFileDialog SaveFileDialog;
private System.Windows.Forms.Button EntitySearchSetMarkersButton;
} }
} }

View File

@ -307,6 +307,7 @@ namespace CodeWalker.World
EntitySearchAbortButton.Enabled = true; EntitySearchAbortButton.Enabled = true;
EntitySearchLoadedOnlyCheckBox.Enabled = false; EntitySearchLoadedOnlyCheckBox.Enabled = false;
EntitySearchExportResultsButton.Enabled = false; EntitySearchExportResultsButton.Enabled = false;
EntitySearchSetMarkersButton.Enabled = false;
AbortOperation = false; AbortOperation = false;
EntityResults.Clear(); EntityResults.Clear();
EntityResultsListView.VirtualListSize = 0; EntityResultsListView.VirtualListSize = 0;
@ -412,6 +413,7 @@ namespace CodeWalker.World
EntitySearchAbortButton.Enabled = false; EntitySearchAbortButton.Enabled = false;
EntitySearchLoadedOnlyCheckBox.Enabled = true; EntitySearchLoadedOnlyCheckBox.Enabled = true;
EntitySearchExportResultsButton.Enabled = true; EntitySearchExportResultsButton.Enabled = true;
EntitySearchSetMarkersButton.Enabled = true;
} }
} }
catch { } catch { }
@ -448,6 +450,19 @@ namespace CodeWalker.World
File.WriteAllText(fname, sb.ToString()); File.WriteAllText(fname, sb.ToString());
} }
private void EntitySearchSetMarkersButton_Click(object sender, EventArgs e)
{
var usetextbox = EntityResults.Count < 250;
if (!usetextbox) MessageBox.Show("Markers will not be placed into the markers textbox\nbecause there are too many.", "Too many markers", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Task.Run(() =>
{
foreach (var ent in EntityResults)
{
WorldForm.AddMarker(ent.Position, ent.Name, usetextbox);
}
});
}
private void EntityResultsListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) private void EntityResultsListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
{ {
if (e.ItemIndex < EntityResults.Count) if (e.ItemIndex < EntityResults.Count)

View File

@ -4489,7 +4489,7 @@ namespace CodeWalker
camera.TargetDistance = bl > 1f ? bl : 1f; camera.TargetDistance = bl > 1f ? bl : 1f;
} }
private MapMarker AddMarker(Vector3 pos, string name, bool addtotxtbox = false) public MapMarker AddMarker(Vector3 pos, string name, bool addtotxtbox = false)
{ {
string str = pos.X.ToString() + ", " + pos.Y.ToString() + ", " + pos.Z.ToString(); string str = pos.X.ToString() + ", " + pos.Y.ToString() + ", " + pos.Z.ToString();
if (!string.IsNullOrEmpty(name)) if (!string.IsNullOrEmpty(name))