diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index 17f5c91..b9fd258 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -177,6 +177,7 @@ this.exportL2DWithFadeLstToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportL2DWithFadeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exportL2DWithClipsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showParentTexture2DToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToSceneHierarchyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dumpTreeViewContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -1611,10 +1612,11 @@ this.exportL2DWithFadeLstToolStripMenuItem, this.exportL2DWithFadeToolStripMenuItem, this.exportL2DWithClipsToolStripMenuItem, + this.showParentTexture2DToolStripMenuItem, this.goToSceneHierarchyToolStripMenuItem, this.showOriginalFileToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(332, 224); + this.contextMenuStrip1.Size = new System.Drawing.Size(332, 246); // // copyToolStripMenuItem // @@ -1677,6 +1679,14 @@ this.exportL2DWithClipsToolStripMenuItem.Visible = false; this.exportL2DWithClipsToolStripMenuItem.Click += new System.EventHandler(this.exportSelectedL2DWithClips_Click); // + // showParentTexture2DToolStripMenuItem + // + this.showParentTexture2DToolStripMenuItem.Name = "showParentTexture2DToolStripMenuItem"; + this.showParentTexture2DToolStripMenuItem.Size = new System.Drawing.Size(331, 22); + this.showParentTexture2DToolStripMenuItem.Text = "Show parent Texture2D asset"; + this.showParentTexture2DToolStripMenuItem.Visible = false; + this.showParentTexture2DToolStripMenuItem.Click += new System.EventHandler(this.showParentTexture2DToolStripMenuItem_Click); + // // goToSceneHierarchyToolStripMenuItem // this.goToSceneHierarchyToolStripMenuItem.Name = "goToSceneHierarchyToolStripMenuItem"; @@ -1953,6 +1963,7 @@ private System.Windows.Forms.ToolStripMenuItem jsonDumpSelectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem jsonDumpFilterToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showAssetDebugInfoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem showParentTexture2DToolStripMenuItem; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 728cc79..f4e8515 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -1668,6 +1668,7 @@ namespace AssetStudioGUI if (e.Button == MouseButtons.Right && assetListView.SelectedIndices.Count > 0) { goToSceneHierarchyToolStripMenuItem.Visible = false; + showParentTexture2DToolStripMenuItem.Visible = false; showOriginalFileToolStripMenuItem.Visible = false; exportAnimatorWithSelectedAnimationClipMenuItem.Visible = false; exportAsLive2DModelToolStripMenuItem.Visible = false; @@ -1689,6 +1690,9 @@ namespace AssetStudioGUI { switch (asset.Asset) { + case Sprite _ when assetListView.SelectedIndices.Count == 1: + showParentTexture2DToolStripMenuItem.Visible = true; + break; case MonoBehaviour m_MonoBehaviour: if (Studio.l2dAssetsManager.ModelDict.Count > 0) { @@ -1884,14 +1888,28 @@ namespace AssetStudioGUI private void goToSceneHierarchyToolStripMenuItem_Click(object sender, EventArgs e) { - var selectAsset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]]; - if (selectAsset.TreeNode != null) + var selectedAsset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]]; + if (selectedAsset.TreeNode != null) { - sceneTreeView.SelectedNode = selectAsset.TreeNode; + sceneTreeView.SelectedNode = selectedAsset.TreeNode; tabControl1.SelectedTab = tabPage1; } } + private void showParentTexture2DToolStripMenuItem_Click(object sender, EventArgs e) + { + var selectedAsset = (AssetItem)assetListView.Items[assetListView.SelectedIndices[0]]; + var spriteConverter = new SpriteConverter((Sprite)selectedAsset.Asset); + var textureAsset = visibleAssets.Find(x => x.Type == ClassIDType.Texture2D && x.m_PathID == spriteConverter.m_Texture2D.m_PathID); + if (textureAsset != null) + { + var listViewItem = assetListView.Items[assetListView.Items.IndexOf(textureAsset)]; + assetListView.SelectedIndices.Clear(); + listViewItem.Selected = true; + listViewItem.EnsureVisible(); + } + } + private static ExportFilter GetExportFilterFromTag(string tag) { switch (tag)