1
0
mirror of synced 2024-11-30 18:24:39 +01:00

More fixes to viewport toggle.

This commit is contained in:
KillzXGaming 2019-04-25 17:13:59 -04:00
parent 91694c2fcb
commit 812fe2e6b5
13 changed files with 33 additions and 33 deletions

Binary file not shown.

View File

@ -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));

View File

@ -303,7 +303,7 @@ namespace FirstPlugin
bool IsLoaded = false;
public override void OnClick(TreeView treeView)
{
if (Runtime.UseViewport)
if (Runtime.UseOpenGL)
{
if (viewport == null)
{

View File

@ -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)

View File

@ -71,7 +71,7 @@ namespace FirstPlugin.Forms
FillForm();
if (Runtime.UseViewport)
if (Runtime.UseOpenGL)
{
LoadUVEditor();
}

View File

@ -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)

View File

@ -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

View File

@ -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()));

View File

@ -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);