From df5d9f90d4e9cf4ae22b8426e77e92e758853cfc Mon Sep 17 00:00:00 2001 From: Perfare Date: Tue, 7 Apr 2020 08:55:51 +0800 Subject: [PATCH] Add copy function to assetListView --- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 13 +++++++++++-- AssetStudioGUI/AssetStudioGUIForm.cs | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index 6d39539..7fbf1fd 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -111,6 +111,7 @@ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportSelectedAssetsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportAnimatorwithselectedAnimationClipMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -545,7 +546,6 @@ this.assetListView.FullRowSelect = true; this.assetListView.GridLines = true; this.assetListView.HideSelection = false; - this.assetListView.LabelEdit = true; this.assetListView.Location = new System.Drawing.Point(0, 21); this.assetListView.Name = "assetListView"; this.assetListView.Size = new System.Drawing.Size(472, 587); @@ -910,12 +910,20 @@ // this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.copyToolStripMenuItem, this.exportSelectedAssetsToolStripMenuItem, this.exportAnimatorwithselectedAnimationClipMenuItem, this.goToSceneHierarchyToolStripMenuItem, this.showOriginalFileToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(327, 92); + this.contextMenuStrip1.Size = new System.Drawing.Size(327, 114); + // + // copyToolStripMenuItem + // + this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; + this.copyToolStripMenuItem.Size = new System.Drawing.Size(326, 22); + this.copyToolStripMenuItem.Text = "Copy"; + this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click); // // exportSelectedAssetsToolStripMenuItem // @@ -1080,6 +1088,7 @@ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9; private System.Windows.Forms.ColumnHeader columnHeaderContainer; private System.Windows.Forms.ColumnHeader columnHeaderPathID; + private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 4b6981b..af5c26d 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -29,6 +29,7 @@ namespace AssetStudioGUI private AssetItem lastSelectedItem; private AssetItem lastLoadedAsset; private Bitmap imageTexture; + private string tempClipboard; private FMOD.System system; private FMOD.Sound sound; @@ -1198,10 +1199,16 @@ namespace AssetStudioGUI } } + tempClipboard = assetListView.HitTest(new Point(e.X, e.Y)).SubItem.Text; contextMenuStrip1.Show(assetListView, e.X, e.Y); } } + private void copyToolStripMenuItem_Click(object sender, EventArgs e) + { + Clipboard.SetDataObject(tempClipboard); + } + private void exportSelectedAssetsToolStripMenuItem_Click(object sender, EventArgs e) { ExportAssets(2, ExportType.Convert);