From 60aef1b8ed68c765a0de991272f6d8d43fe071e3 Mon Sep 17 00:00:00 2001 From: VaDiM Date: Wed, 6 Dec 2023 18:15:10 +0300 Subject: [PATCH] [GUI] Add option to not build a tree structure --- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 14 ++++++++++++++ AssetStudioGUI/AssetStudioGUIForm.cs | 7 +++++++ AssetStudioGUI/Properties/Settings.Designer.cs | 12 ++++++++++++ AssetStudioGUI/Properties/Settings.settings | 3 +++ AssetStudioGUI/Studio.cs | 15 +++++++++++---- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index 0d396be..38adb76 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -41,6 +41,7 @@ this.displayAll = new System.Windows.Forms.ToolStripMenuItem(); this.enablePreview = new System.Windows.Forms.ToolStripMenuItem(); this.displayInfo = new System.Windows.Forms.ToolStripMenuItem(); + this.buildTreeStructureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem14 = new System.Windows.Forms.ToolStripMenuItem(); this.specifyUnityVersion = new System.Windows.Forms.ToolStripTextBox(); this.showExpOpt = new System.Windows.Forms.ToolStripMenuItem(); @@ -233,6 +234,7 @@ this.displayAll, this.enablePreview, this.displayInfo, + this.buildTreeStructureToolStripMenuItem, this.toolStripMenuItem14, this.showExpOpt}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; @@ -273,6 +275,17 @@ "t, audio bitrate, etc."; this.displayInfo.CheckedChanged += new System.EventHandler(this.displayAssetInfo_Check); // + // buildTreeStructureToolStripMenuItem + // + this.buildTreeStructureToolStripMenuItem.Checked = true; + this.buildTreeStructureToolStripMenuItem.CheckOnClick = true; + this.buildTreeStructureToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.buildTreeStructureToolStripMenuItem.Name = "buildTreeStructureToolStripMenuItem"; + this.buildTreeStructureToolStripMenuItem.Size = new System.Drawing.Size(207, 22); + this.buildTreeStructureToolStripMenuItem.Text = "Build tree structure"; + this.buildTreeStructureToolStripMenuItem.ToolTipText = "You can disable tree structure building if you don\'t use the Scene Hierarchy tab"; + this.buildTreeStructureToolStripMenuItem.CheckedChanged += new System.EventHandler(this.buildTreeStructureToolStripMenuItem_CheckedChanged); + // // toolStripMenuItem14 // this.toolStripMenuItem14.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1430,6 +1443,7 @@ private System.Windows.Forms.ListView assetListView; private System.Windows.Forms.ToolStripMenuItem showConsoleToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem writeLogToFileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem buildTreeStructureToolStripMenuItem; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 7a3a004..4f52ae1 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -130,6 +130,7 @@ namespace AssetStudioGUI displayInfo.Checked = Properties.Settings.Default.displayInfo; enablePreview.Checked = Properties.Settings.Default.enablePreview; showConsoleToolStripMenuItem.Checked = Properties.Settings.Default.showConsole; + buildTreeStructureToolStripMenuItem.Checked = Properties.Settings.Default.buildTreeStructure; FMODinit(); listSearchFilterMode.SelectedIndex = 0; @@ -2037,6 +2038,12 @@ namespace AssetStudioGUI Logger.Verbose("Closing AssetStudio"); } + private void buildTreeStructureToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + { + Properties.Settings.Default.buildTreeStructure = buildTreeStructureToolStripMenuItem.Checked; + Properties.Settings.Default.Save(); + } + #region FMOD private void FMODinit() { diff --git a/AssetStudioGUI/Properties/Settings.Designer.cs b/AssetStudioGUI/Properties/Settings.Designer.cs index 60303fb..ba4564d 100644 --- a/AssetStudioGUI/Properties/Settings.Designer.cs +++ b/AssetStudioGUI/Properties/Settings.Designer.cs @@ -334,5 +334,17 @@ namespace AssetStudioGUI.Properties { this["useFileLogger"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool buildTreeStructure { + get { + return ((bool)(this["buildTreeStructure"])); + } + set { + this["buildTreeStructure"] = value; + } + } } } diff --git a/AssetStudioGUI/Properties/Settings.settings b/AssetStudioGUI/Properties/Settings.settings index eed8233..203d1ad 100644 --- a/AssetStudioGUI/Properties/Settings.settings +++ b/AssetStudioGUI/Properties/Settings.settings @@ -80,5 +80,8 @@ False + + True + \ No newline at end of file diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index 02e6ee0..bf98efa 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -158,7 +158,8 @@ namespace AssetStudioGUI var objectCount = assetsManager.assetsFileList.Sum(x => x.Objects.Count); var objectAssetItemDic = new Dictionary(objectCount); var containers = new List<(PPtr, string)>(); - int i = 0; + allContainers.Clear(); + var i = 0; Progress.Reset(); foreach (var assetsFile in assetsManager.assetsFileList) { @@ -270,8 +271,7 @@ namespace AssetStudioGUI Progress.Report(++i, objectCount); } } - allContainers.Clear(); - foreach ((var pptr, var container) in containers) + foreach (var (pptr, container) in containers) { if (pptr.TryGet(out var obj)) { @@ -287,12 +287,19 @@ namespace AssetStudioGUI visibleAssets = exportableAssets; + if (!Properties.Settings.Default.buildTreeStructure) + { + Logger.Info("Building tree structure step is skipped"); + objectAssetItemDic.Clear(); + return (productName, new List()); + } + Logger.Info("Building tree structure..."); var treeNodeCollection = new List(); var treeNodeDictionary = new Dictionary(); var assetsFileCount = assetsManager.assetsFileList.Count; - int j = 0; + var j = 0; Progress.Reset(); foreach (var assetsFile in assetsManager.assetsFileList) {