diff --git a/Switch_Toolbox_Library/Config.cs b/Switch_Toolbox_Library/Config.cs index 63e6da8b..f3cdf4a0 100644 --- a/Switch_Toolbox_Library/Config.cs +++ b/Switch_Toolbox_Library/Config.cs @@ -324,6 +324,12 @@ namespace Toolbox.Library case "ShowCloseDialog": bool.TryParse(node.InnerText, out Runtime.ShowCloseDialog); break; + case "displayGrid": + bool.TryParse(node.InnerText, out Runtime.displayGrid); + break; + case "displayAxisLines": + bool.TryParse(node.InnerText, out Runtime.displayAxisLines); + break; } } @@ -587,8 +593,11 @@ namespace Toolbox.Library renderSettingsNode.AppendChild(createNode(doc, "MaxCameraSpeed", Runtime.MaxCameraSpeed.ToString())); renderSettingsNode.AppendChild(createNode(doc, "FrameCamera", Runtime.FrameCamera.ToString())); renderSettingsNode.AppendChild(createNode(doc, "cameraMovement", Runtime.cameraMovement.ToString())); + renderSettingsNode.AppendChild(createNode(doc, "displayAxisLines", Runtime.displayAxisLines.ToString())); + renderSettingsNode.AppendChild(createNode(doc, "displayGrid", Runtime.displayGrid.ToString())); + } - + private static void AppendResourceTableSettings(XmlDocument doc, XmlNode parentNode) { XmlNode resourceTableNode = doc.CreateElement("ResourceTables"); diff --git a/Switch_Toolbox_Library/Rendering/DrawableFloor.cs b/Switch_Toolbox_Library/Rendering/DrawableFloor.cs index e5d96c2e..159b9a36 100644 --- a/Switch_Toolbox_Library/Rendering/DrawableFloor.cs +++ b/Switch_Toolbox_Library/Rendering/DrawableFloor.cs @@ -74,7 +74,7 @@ namespace Toolbox.Library.Rendering public override void Draw(GL_ControlModern control, Pass pass) { - if (pass == Pass.TRANSPARENT || gridShaderProgram == null) + if (!Runtime.displayGrid || pass == Pass.TRANSPARENT || gridShaderProgram == null) return; bool buffersWereInitialized = vbo_position != 0; diff --git a/Switch_Toolbox_Library/Rendering/DrawableXyzLines.cs b/Switch_Toolbox_Library/Rendering/DrawableXyzLines.cs index 0c32e252..0b137a12 100644 --- a/Switch_Toolbox_Library/Rendering/DrawableXyzLines.cs +++ b/Switch_Toolbox_Library/Rendering/DrawableXyzLines.cs @@ -86,7 +86,7 @@ namespace Toolbox.Library.Rendering public override void Draw(GL_ControlModern control, Pass pass) { - if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT) + if (!Runtime.displayAxisLines || !Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT) return; bool buffersWereInitialized = vbo_position != 0; diff --git a/Switch_Toolbox_Library/Runtime.cs b/Switch_Toolbox_Library/Runtime.cs index f6eda5b5..636b7487 100644 --- a/Switch_Toolbox_Library/Runtime.cs +++ b/Switch_Toolbox_Library/Runtime.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Drawing; +using GL_EditorFramework.EditorDrawables; using GL_EditorFramework.Interfaces; -using GL_EditorFramework.EditorDrawables; +using System; +using System.Collections.Generic; +using System.Drawing; using System.Windows.Forms; namespace Toolbox.Library @@ -295,6 +292,9 @@ namespace Toolbox.Library public static bool renderBones = true; public static bool renderFog = true; + public static bool displayAxisLines = true; + public static bool displayGrid = true; + public static bool FrameCamera = false; public static float bonePointSize = 0.2f; diff --git a/Toolbox/GUI/Settings.Designer.cs b/Toolbox/GUI/Settings.Designer.cs index fcde9f30..502ad53e 100644 --- a/Toolbox/GUI/Settings.Designer.cs +++ b/Toolbox/GUI/Settings.Designer.cs @@ -122,6 +122,8 @@ this.stLabel17 = new Toolbox.Library.Forms.STLabel(); this.chkBotwFileTable = new Toolbox.Library.Forms.STCheckBox(); this.btnReset = new Toolbox.Library.Forms.STButton(); + this.chkViewportGrid = new Toolbox.Library.Forms.STCheckBox(); + this.chkViewportAxisLines = new Toolbox.Library.Forms.STCheckBox(); this.contentContainer.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cameraMaxSpeedUD)).BeginInit(); @@ -169,7 +171,7 @@ // chkBoxSpecular // this.chkBoxSpecular.AutoSize = true; - this.chkBoxSpecular.Location = new System.Drawing.Point(6, 114); + this.chkBoxSpecular.Location = new System.Drawing.Point(10, 160); this.chkBoxSpecular.Name = "chkBoxSpecular"; this.chkBoxSpecular.Size = new System.Drawing.Size(104, 17); this.chkBoxSpecular.TabIndex = 3; @@ -179,7 +181,7 @@ // chkBoxNormalMap // this.chkBoxNormalMap.AutoSize = true; - this.chkBoxNormalMap.Location = new System.Drawing.Point(6, 91); + this.chkBoxNormalMap.Location = new System.Drawing.Point(10, 137); this.chkBoxNormalMap.Name = "chkBoxNormalMap"; this.chkBoxNormalMap.Size = new System.Drawing.Size(124, 17); this.chkBoxNormalMap.TabIndex = 2; @@ -199,6 +201,8 @@ // // panel2 // + this.panel2.Controls.Add(this.chkViewportAxisLines); + this.panel2.Controls.Add(this.chkViewportGrid); this.panel2.Controls.Add(this.uvChannelRB3); this.panel2.Controls.Add(this.uvChannelRB2); this.panel2.Controls.Add(this.uvChannelRB); @@ -483,7 +487,7 @@ // chkBoxEnablePBR // this.chkBoxEnablePBR.AutoSize = true; - this.chkBoxEnablePBR.Location = new System.Drawing.Point(6, 137); + this.chkBoxEnablePBR.Location = new System.Drawing.Point(10, 183); this.chkBoxEnablePBR.Name = "chkBoxEnablePBR"; this.chkBoxEnablePBR.Size = new System.Drawing.Size(84, 17); this.chkBoxEnablePBR.TabIndex = 17; @@ -665,7 +669,7 @@ // chkBoxStereoscopy // this.chkBoxStereoscopy.AutoSize = true; - this.chkBoxStereoscopy.Location = new System.Drawing.Point(6, 68); + this.chkBoxStereoscopy.Location = new System.Drawing.Point(10, 114); this.chkBoxStereoscopy.Name = "chkBoxStereoscopy"; this.chkBoxStereoscopy.Size = new System.Drawing.Size(121, 17); this.chkBoxStereoscopy.TabIndex = 4; @@ -1318,6 +1322,28 @@ this.btnReset.UseVisualStyleBackColor = true; this.btnReset.Click += new System.EventHandler(this.btnReset_Click); // + // chkViewportGrid + // + this.chkViewportGrid.AutoSize = true; + this.chkViewportGrid.Location = new System.Drawing.Point(10, 68); + this.chkViewportGrid.Name = "chkViewportGrid"; + this.chkViewportGrid.Size = new System.Drawing.Size(125, 17); + this.chkViewportGrid.TabIndex = 35; + this.chkViewportGrid.Text = "Enable Viewport Grid"; + this.chkViewportGrid.UseVisualStyleBackColor = true; + this.chkViewportGrid.CheckedChanged += new System.EventHandler(this.chkViewportGrid_CheckedChanged); + // + // chkViewportAxisLines + // + this.chkViewportAxisLines.AutoSize = true; + this.chkViewportAxisLines.Location = new System.Drawing.Point(10, 91); + this.chkViewportAxisLines.Name = "chkViewportAxisLines"; + this.chkViewportAxisLines.Size = new System.Drawing.Size(153, 17); + this.chkViewportAxisLines.TabIndex = 36; + this.chkViewportAxisLines.Text = "Enable Viewport Axis Lines"; + this.chkViewportAxisLines.UseVisualStyleBackColor = true; + this.chkViewportAxisLines.CheckedChanged += new System.EventHandler(this.chkViewportAxisLines_CheckedChanged); + // // Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1457,5 +1483,7 @@ private Library.Forms.STLabel stLabel18; private Library.Forms.STTextBox pathPokemonSwShTB; private Library.Forms.STButton btnReset; + private Library.Forms.STCheckBox chkViewportAxisLines; + private Library.Forms.STCheckBox chkViewportGrid; } } \ No newline at end of file diff --git a/Toolbox/GUI/Settings.cs b/Toolbox/GUI/Settings.cs index ec845613..ef475e14 100644 --- a/Toolbox/GUI/Settings.cs +++ b/Toolbox/GUI/Settings.cs @@ -89,6 +89,8 @@ namespace Toolbox chkTpFileTable.Checked = Runtime.ResourceTables.TpTable; chkFrameCamera.Checked = Runtime.FrameCamera; chkAlwaysCompressOnSave.Checked = Runtime.AlwaysCompressOnSave; + chkViewportGrid.Checked = Runtime.displayGrid; + chkViewportAxisLines.Checked = Runtime.displayAxisLines; displayBoundingBoxeChk.Checked = Runtime.renderBoundingBoxes; @@ -705,5 +707,17 @@ namespace Toolbox Environment.Exit(0); } } + + private void chkViewportGrid_CheckedChanged(object sender, EventArgs e) + { + Runtime.displayGrid = chkViewportGrid.Checked; + UpdateViewportSettings(); + } + + private void chkViewportAxisLines_CheckedChanged(object sender, EventArgs e) + { + Runtime.displayAxisLines = chkViewportAxisLines.Checked; + UpdateViewportSettings(); + } } }