diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index a1e5aef8..c3d1e065 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 3dd3eb60..42cb77cc 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index e76fb543..599eb22f 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs b/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs index 434a96f8..8c779069 100644 --- a/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs +++ b/Switch_FileFormatsMain/FileFormats/Texture/NUTEXB.cs @@ -52,7 +52,7 @@ namespace FirstPlugin } } - public bool LimitFileSize { get; set; } + public bool LimitFileSize { get; set; } = true; public enum NUTEXImageFormat : byte { diff --git a/Switch_FileFormatsMain/GL/BFRES_Render.cs b/Switch_FileFormatsMain/GL/BFRES_Render.cs index 83b457b6..0a7d09a8 100644 --- a/Switch_FileFormatsMain/GL/BFRES_Render.cs +++ b/Switch_FileFormatsMain/GL/BFRES_Render.cs @@ -275,7 +275,7 @@ namespace FirstPlugin if (models.Count > 0) { - if (models[0].materials.Count > 0) + if (models[0].shapes.Count > 0) { if( models[0].shapes[0].GetMaterial().shaderassign.ShaderModel == "uking_mat") shader = BotwShaderProgram; diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 3d8580af..714ff4a1 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll index 7f221021..9215bffe 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll differ diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb index 961857c1..405ae716 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 74c040b6..739e2e06 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs index b748c17c..7ad2e46b 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.Designer.cs @@ -30,6 +30,7 @@ { this.components = new System.ComponentModel.Container(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); + this.activeEditorChkBox = new Switch_Toolbox.Library.Forms.STCheckBox(); this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom(); this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel(); this.searchLbl = new Switch_Toolbox.Library.Forms.STLabel(); @@ -42,7 +43,6 @@ this.sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.splitter1 = new System.Windows.Forms.Splitter(); - this.importToActiveWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contentContainer.SuspendLayout(); this.stPanel1.SuspendLayout(); this.stPanel3.SuspendLayout(); @@ -62,6 +62,7 @@ // // stPanel1 // + this.stPanel1.Controls.Add(this.activeEditorChkBox); this.stPanel1.Controls.Add(this.treeViewCustom1); this.stPanel1.Controls.Add(this.stPanel3); this.stPanel1.Controls.Add(this.stContextMenuStrip1); @@ -72,6 +73,17 @@ this.stPanel1.TabIndex = 11; this.stPanel1.Resize += new System.EventHandler(this.stPanel1_Resize); // + // activeEditorChkBox + // + this.activeEditorChkBox.AutoSize = true; + this.activeEditorChkBox.Location = new System.Drawing.Point(93, 4); + this.activeEditorChkBox.Name = "activeEditorChkBox"; + this.activeEditorChkBox.Size = new System.Drawing.Size(144, 17); + this.activeEditorChkBox.TabIndex = 3; + this.activeEditorChkBox.Text = "Add Files to Active Editor"; + this.activeEditorChkBox.UseVisualStyleBackColor = true; + this.activeEditorChkBox.CheckedChanged += new System.EventHandler(this.activeEditorChkBox_CheckedChanged); + // // treeViewCustom1 // this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -142,8 +154,7 @@ // this.stContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, - this.viewToolStripMenuItem, - this.importToActiveWindowToolStripMenuItem}); + this.viewToolStripMenuItem}); this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0); this.stContextMenuStrip1.Name = "stContextMenuStrip1"; this.stContextMenuStrip1.Size = new System.Drawing.Size(314, 24); @@ -161,7 +172,7 @@ // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.openToolStripMenuItem.Text = "Add File"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // @@ -176,7 +187,7 @@ // sortToolStripMenuItem // this.sortToolStripMenuItem.Name = "sortToolStripMenuItem"; - this.sortToolStripMenuItem.Size = new System.Drawing.Size(95, 22); + this.sortToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.sortToolStripMenuItem.Text = "Sort"; this.sortToolStripMenuItem.Click += new System.EventHandler(this.sortToolStripMenuItem_Click); // @@ -198,14 +209,6 @@ this.splitter1.LocationChanged += new System.EventHandler(this.splitter1_LocationChanged); this.splitter1.Resize += new System.EventHandler(this.splitter1_Resize); // - // importToActiveWindowToolStripMenuItem - // - this.importToActiveWindowToolStripMenuItem.Checked = true; - this.importToActiveWindowToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.importToActiveWindowToolStripMenuItem.Name = "importToActiveWindowToolStripMenuItem"; - this.importToActiveWindowToolStripMenuItem.Size = new System.Drawing.Size(152, 20); - this.importToActiveWindowToolStripMenuItem.Text = "Import to Active Window"; - // // ObjectEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -241,6 +244,6 @@ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem sortToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem importToActiveWindowToolStripMenuItem; + private STCheckBox activeEditorChkBox; } } \ No newline at end of file diff --git a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs index e551ef93..f513b5df 100644 --- a/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs +++ b/Switch_Toolbox_Library/Forms/Editors/ObjectEditor.cs @@ -17,6 +17,19 @@ namespace Switch_Toolbox.Library.Forms { public partial class ObjectEditor : STForm { + public bool AddFilesToActiveEditor + { + get + { + return activeEditorChkBox.Checked; + } + set + { + activeEditorChkBox.Checked = value; + Runtime.AddFilesToActiveObjectEditor = value; + } + } + public static ObjectEditor Instance { get { return _instance != null ? _instance : (_instance = new ObjectEditor()); } @@ -33,6 +46,8 @@ namespace Switch_Toolbox.Library.Forms searchLbl.BackColor = stTextBox1.BackColor; treeViewCustom1.BackColor = FormThemes.BaseTheme.ObjectEditorBackColor; + + AddFilesToActiveEditor = Runtime.AddFilesToActiveObjectEditor; } public Viewport GetViewport() => viewport; @@ -350,5 +365,10 @@ namespace Switch_Toolbox.Library.Forms { Runtime.ObjectEditor.ListPanelWidth = stPanel1.Width; } + + private void activeEditorChkBox_CheckedChanged(object sender, EventArgs e) + { + AddFilesToActiveEditor = activeEditorChkBox.Checked; + } } } diff --git a/Switch_Toolbox_Library/Runtime.cs b/Switch_Toolbox_Library/Runtime.cs index e4908568..1cc017dc 100644 --- a/Switch_Toolbox_Library/Runtime.cs +++ b/Switch_Toolbox_Library/Runtime.cs @@ -70,6 +70,8 @@ namespace Switch_Toolbox.Library public static bool MaximizeMdiWindow = true; + public static bool AddFilesToActiveObjectEditor = true; + public static GridSettings gridSettings = new GridSettings(); public class GridSettings { diff --git a/Toolbox/Config.cs b/Toolbox/Config.cs index d7520d71..fe7a71ab 100644 --- a/Toolbox/Config.cs +++ b/Toolbox/Config.cs @@ -141,6 +141,9 @@ namespace Toolbox case "MaxCameraSpeed": float.TryParse(node.InnerText, out Runtime.MaxCameraSpeed); break; + case "AddFilesToActiveObjectEditor": + bool.TryParse(node.InnerText, out Runtime.AddFilesToActiveObjectEditor); + break; } } } @@ -252,6 +255,7 @@ namespace Toolbox parentNode.AppendChild(objlistSettingsNode); objlistSettingsNode.AppendChild(createNode(doc, "thumbnailSize", Runtime.thumbnailSize.ToString())); objlistSettingsNode.AppendChild(createNode(doc, "ListPanelWidth", Runtime.ObjectEditor.ListPanelWidth.ToString())); + objlistSettingsNode.AppendChild(createNode(doc, "AddFilesToActiveObjectEditor", Runtime.AddFilesToActiveObjectEditor.ToString())); } private static void AppendRenderSettings(XmlDocument doc, XmlNode parentNode) { diff --git a/Toolbox/MainForm.cs b/Toolbox/MainForm.cs index 34e8475c..108ab171 100644 --- a/Toolbox/MainForm.cs +++ b/Toolbox/MainForm.cs @@ -230,16 +230,45 @@ namespace Toolbox var node = (TreeNode)file; //ObjectEditor is for treenode types. Editors will be on the right side, treenodes on the left - SetFormatSettings((IFileFormat)node); - ObjectEditor editor = new ObjectEditor(); - if (InActiveEditor) + //Check for active object editors + ObjectEditor editor = (ObjectEditor)LibraryGUI.Instance.GetActiveForm(); + + bool IsEditorActive = editor != null; + + //Create one if none are active + if (!IsEditorActive) { - editor = (ObjectEditor)LibraryGUI.Instance.GetActiveForm(); + editor = new ObjectEditor(); } + bool useActiveEditor = false; + //If any are active and we want it to be a new tab then create an instance of one + if (InActiveEditor || editor.AddFilesToActiveEditor) + { + useActiveEditor = true; + } + + if (!useActiveEditor || !IsEditorActive) + { + editor = new ObjectEditor(); + AddObjectEditorFile(node, editor, true); + + editor.Text = CheckTabDupes(node.Text); + editor.Show(); + } + else + { + AddObjectEditorFile(node, editor, false); + } + + SetFormatSettings(GetActiveIFileFormat()); + } + + private void AddObjectEditorFile(TreeNode file, ObjectEditor editor, bool ClearFiles) + { TabDupeIndex = 0; editor.MdiParent = this; @@ -247,24 +276,16 @@ namespace Toolbox editor.treeViewCustom1.Invoke((Action)delegate () { editor.treeViewCustom1.BeginUpdate(); // No visual updates until we say - editor.treeViewCustom1.Nodes.Clear(); // Remove existing nodes - editor.treeViewCustom1.Nodes.Add(node); // Add the new nodes + if (ClearFiles) + editor.treeViewCustom1.Nodes.Clear(); // Remove existing nodes + editor.treeViewCustom1.Nodes.Add(file); // Add the new nodes editor.treeViewCustom1.EndUpdate(); // Allow the treeview to update visually }); - if (file is TreeNodeFile) { ((TreeNodeFile)file).OnAfterAdded(); } - - if (!InActiveEditor) - { - editor.Text = CheckTabDupes(node.Text); - editor.Show(); - } - - SetFormatSettings(GetActiveIFileFormat()); } #endregion