diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index c80a2f43..d6efe44a 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 e2067d84..f147abcd 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 7027e729..af2fa6af 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/BFRES/BFRES.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs index 1b6e1c4e..c0d5cac4 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs @@ -503,14 +503,9 @@ namespace FirstPlugin drawables.Add(BFRESRender.models[m].Skeleton); } - if (Runtime.UseViewport) + if (Runtime.UseOpenGL) bfresEditor.LoadViewport(drawables, toolstrips); - if (!IsLoaded) - { - bfresEditor.OnLoadedTab(); - } - if (SelectedSection is BFRES) { STPropertyGrid editor = (STPropertyGrid)bfresEditor.GetActiveEditor(typeof(STPropertyGrid)); diff --git a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs index 85f0df12..6dc1c164 100644 --- a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs +++ b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs @@ -303,7 +303,7 @@ namespace FirstPlugin bool IsLoaded = false; public override void OnClick(TreeView treeView) { - if (Runtime.UseViewport) + if (Runtime.UseOpenGL) { if (viewport == null) { diff --git a/Switch_FileFormatsMain/GUI/BFRES/BfresEditor.cs b/Switch_FileFormatsMain/GUI/BFRES/BfresEditor.cs index 47b00b04..b5e91d5a 100644 --- a/Switch_FileFormatsMain/GUI/BFRES/BfresEditor.cs +++ b/Switch_FileFormatsMain/GUI/BFRES/BfresEditor.cs @@ -33,18 +33,20 @@ namespace FirstPlugin.Forms private void SetupViewport() { - if (DisplayViewport == true && Runtime.UseViewport) + if (DisplayViewport == true && Runtime.UseOpenGL) { stPanel5.Controls.Add(viewport); splitContainer1.Panel1Collapsed = false; toggleViewportToolStripBtn.Image = Properties.Resources.ViewportIcon; + + if (viewport != null) + OnLoadedTab(); } else { stPanel5.Controls.Clear(); splitContainer1.Panel1Collapsed = true; toggleViewportToolStripBtn.Image = Properties.Resources.ViewportIconDisable; - OnLoadedTab(); } } @@ -52,7 +54,7 @@ namespace FirstPlugin.Forms { get { - if (!Runtime.UseViewport || !DisplayViewport) + if (!Runtime.UseOpenGL || !DisplayViewport) return null; var editor = LibraryGUI.Instance.GetObjectEditor(); @@ -83,21 +85,24 @@ namespace FirstPlugin.Forms stTabControl2.myBackColor = FormThemes.BaseTheme.FormBackColor; - if (viewport == null && Runtime.UseViewport) + //Always create an instance of the viewport unless opengl is disabled + if (viewport == null && Runtime.UseOpenGL) { viewport = new Viewport(); viewport.Dock = DockStyle.Fill; } - if (Runtime.UseViewport && Runtime.DisplayViewport) + //If the option is enabled by settings, and it has models display the viewport + if (Runtime.UseOpenGL && Runtime.DisplayViewport && HasModels) + { stPanel5.Controls.Add(viewport); - else - splitContainer1.Panel1Collapsed = true; - - OnLoadedTab(); - - if (HasModels && Runtime.DisplayViewport) DisplayViewport = true; + } + else + { + DisplayViewport = false; + splitContainer1.Panel1Collapsed = true; + } } public UserControl GetActiveEditor(Type type) @@ -131,7 +136,7 @@ namespace FirstPlugin.Forms public void UpdateViewport() { - if (viewport != null && Runtime.UseViewport) + if (viewport != null && Runtime.UseOpenGL && Runtime.DisplayViewport) viewport.UpdateViewport(); } @@ -143,7 +148,7 @@ namespace FirstPlugin.Forms { Drawables = drawables; - if (!Runtime.UseViewport || !DisplayViewport) + if (!Runtime.UseOpenGL || !DisplayViewport) return; if (customContextMenus != null) @@ -159,7 +164,7 @@ namespace FirstPlugin.Forms { Drawables.Add(draw); - if (!Runtime.UseViewport || !Runtime.DisplayViewport) + if (!Runtime.UseOpenGL || !Runtime.DisplayViewport) return; if (!viewport.scene.staticObjects.Contains(draw) && @@ -173,7 +178,7 @@ namespace FirstPlugin.Forms { Drawables.Remove(draw); - if (!Runtime.UseViewport || !Runtime.DisplayViewport) + if (!Runtime.UseOpenGL || !Runtime.DisplayViewport) return; viewport.RemoveDrawable(draw); @@ -184,10 +189,10 @@ namespace FirstPlugin.Forms animationPanel.ClosePanel(); } - public void OnLoadedTab() + private void OnLoadedTab() { //If a model was loaded we don't need to load the drawables again - if (IsLoaded || Drawables == null || !Runtime.UseViewport) + if (IsLoaded || Drawables == null || !Runtime.UseOpenGL || !Runtime.DisplayViewport) return; foreach (var draw in Drawables) diff --git a/Switch_FileFormatsMain/GUI/BFRES/Materials/BfresMaterialEditor.cs b/Switch_FileFormatsMain/GUI/BFRES/Materials/BfresMaterialEditor.cs index e9dd671a..1b241517 100644 --- a/Switch_FileFormatsMain/GUI/BFRES/Materials/BfresMaterialEditor.cs +++ b/Switch_FileFormatsMain/GUI/BFRES/Materials/BfresMaterialEditor.cs @@ -71,7 +71,7 @@ namespace FirstPlugin.Forms FillForm(); - if (Runtime.UseViewport) + if (Runtime.UseOpenGL) { LoadUVEditor(); } diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index fd6805c2..718167b4 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/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index c9d7e733..c733b9b8 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/Generics/GenericTexture.cs b/Switch_Toolbox_Library/Generics/GenericTexture.cs index efa7c38c..3936d8a3 100644 --- a/Switch_Toolbox_Library/Generics/GenericTexture.cs +++ b/Switch_Toolbox_Library/Generics/GenericTexture.cs @@ -271,7 +271,7 @@ namespace Switch_Toolbox.Library public void DisposeRenderable() { - if (RenderableTex != null && Runtime.UseViewport) + if (RenderableTex != null && Runtime.UseOpenGL) { RenderableTex.Dispose(); RenderableTex = null; @@ -344,7 +344,7 @@ namespace Switch_Toolbox.Library return DDSCompressor.DecompressBC5(data, (int)Width, (int)Height, false); else { - if (Runtime.UseViewport) + if (Runtime.UseOpenGL) { Runtime.OpenTKInitialized = true; LoadOpenGLTexture(); @@ -618,7 +618,7 @@ namespace Switch_Toolbox.Library } public void LoadOpenGLTexture() { - if (!Runtime.UseViewport) + if (!Runtime.UseOpenGL) return; if (RenderableTex == null) diff --git a/Switch_Toolbox_Library/Runtime.cs b/Switch_Toolbox_Library/Runtime.cs index 6fb7a029..2416d38f 100644 --- a/Switch_Toolbox_Library/Runtime.cs +++ b/Switch_Toolbox_Library/Runtime.cs @@ -105,7 +105,7 @@ namespace Switch_Toolbox.Library public static bool renderFloorLines = true; - public static bool UseViewport = true; //Removes all acess to viewport + public static bool UseOpenGL = true; //Removes all acess to opengl functionality. Useful for old PCs public static bool DisplayViewport = true; //Only displays it in editors if true //Viewport Background diff --git a/Toolbox/Config.cs b/Toolbox/Config.cs index f2171c38..614f31f6 100644 --- a/Toolbox/Config.cs +++ b/Toolbox/Config.cs @@ -167,8 +167,8 @@ namespace Toolbox case "renderBoundingBoxes": bool.TryParse(node.InnerText, out Runtime.renderBoundingBoxes); break; - case "UseViewport": - bool.TryParse(node.InnerText, out Runtime.UseViewport); + case "UseOpenGL": + bool.TryParse(node.InnerText, out Runtime.UseOpenGL); break; case "DisplayViewport": bool.TryParse(node.InnerText, out Runtime.DisplayViewport); @@ -282,7 +282,7 @@ namespace Toolbox mainSettingsNode.AppendChild(createNode(doc, "DisplayViewport", Runtime.DisplayViewport.ToString())); - mainSettingsNode.AppendChild(createNode(doc, "UseViewport", Runtime.UseViewport.ToString())); + mainSettingsNode.AppendChild(createNode(doc, "UseOpenGL", Runtime.UseOpenGL.ToString())); mainSettingsNode.AppendChild(createNode(doc, "UseDebugDomainExceptionHandler", Runtime.UseDebugDomainExceptionHandler.ToString())); mainSettingsNode.AppendChild(createNode(doc, "OpenStartupWindow", Runtime.OpenStartupWindow.ToString())); mainSettingsNode.AppendChild(createNode(doc, "EnableVersionCheck", Runtime.EnableVersionCheck.ToString())); diff --git a/Toolbox/MainForm.cs b/Toolbox/MainForm.cs index 6a4a05c3..bb61735b 100644 --- a/Toolbox/MainForm.cs +++ b/Toolbox/MainForm.cs @@ -83,7 +83,7 @@ namespace Toolbox Application.Idle += Application_Idle; - if (Runtime.UseViewport) + if (Runtime.UseOpenGL) { //Create an instance of this to help load open gl data easier and quicker after boot var viewport = new Viewport(false);