Option to add active files to editor instead of new tab. Fix crash from no objects.
This commit is contained in:
parent
210afaae71
commit
8cc5e13ace
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -52,7 +52,7 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public bool LimitFileSize { get; set; }
|
||||
public bool LimitFileSize { get; set; } = true;
|
||||
|
||||
public enum NUTEXImageFormat : byte
|
||||
{
|
||||
|
@ -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;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user