mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 12:33:12 +00:00
Allow viewport to be completely disabled for potato PCs.
This commit is contained in:
parent
021b34afba
commit
c7ee9ed16b
15 changed files with 75 additions and 42 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -290,8 +290,9 @@ namespace FirstPlugin
|
|||
foreach (var mdl in BFRESRender.models)
|
||||
drawables.Add(mdl.Skeleton);
|
||||
}
|
||||
bfresEditor.LoadViewport(drawables, toolstrips);
|
||||
|
||||
if (Runtime.UseViewport)
|
||||
bfresEditor.LoadViewport(drawables, toolstrips);
|
||||
|
||||
if (!IsLoaded)
|
||||
{
|
||||
|
|
|
@ -302,22 +302,25 @@ namespace FirstPlugin
|
|||
bool IsLoaded = false;
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
if (viewport == null)
|
||||
if (Runtime.UseViewport)
|
||||
{
|
||||
viewport = new Viewport();
|
||||
viewport.Dock = DockStyle.Fill;
|
||||
if (viewport == null)
|
||||
{
|
||||
viewport = new Viewport();
|
||||
viewport.Dock = DockStyle.Fill;
|
||||
}
|
||||
LibraryGUI.Instance.LoadEditor(viewport);
|
||||
|
||||
viewport.Text = Text;
|
||||
|
||||
if (!IsLoaded)
|
||||
{
|
||||
viewport.AddDrawable(Renderer);
|
||||
viewport.LoadObjects();
|
||||
}
|
||||
|
||||
IsLoaded = true;
|
||||
}
|
||||
LibraryGUI.Instance.LoadEditor(viewport);
|
||||
|
||||
viewport.Text = Text;
|
||||
|
||||
if (!IsLoaded)
|
||||
{
|
||||
viewport.AddDrawable(Renderer);
|
||||
viewport.LoadObjects();
|
||||
}
|
||||
|
||||
IsLoaded = true;
|
||||
}
|
||||
|
||||
public MarioKart.MK7.KCL kcl = null;
|
||||
|
|
|
@ -20,7 +20,10 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
get
|
||||
{
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (!Runtime.UseViewport)
|
||||
return null;
|
||||
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
return editor.GetViewport();
|
||||
}
|
||||
set
|
||||
|
@ -50,13 +53,14 @@ namespace FirstPlugin.Forms
|
|||
stTabControl2.myBackColor = FormThemes.BaseTheme.FormBackColor;
|
||||
|
||||
|
||||
if (viewport == null)
|
||||
if (viewport == null && Runtime.UseViewport)
|
||||
{
|
||||
viewport = new Viewport();
|
||||
viewport.Dock = DockStyle.Fill;
|
||||
}
|
||||
|
||||
stPanel5.Controls.Add(viewport);
|
||||
if (Runtime.UseViewport)
|
||||
stPanel5.Controls.Add(viewport);
|
||||
|
||||
OnLoadedTab();
|
||||
|
||||
|
@ -93,7 +97,7 @@ namespace FirstPlugin.Forms
|
|||
|
||||
public void UpdateViewport()
|
||||
{
|
||||
if (viewport != null)
|
||||
if (viewport != null && Runtime.UseViewport)
|
||||
viewport.UpdateViewport();
|
||||
}
|
||||
|
||||
|
@ -103,6 +107,9 @@ namespace FirstPlugin.Forms
|
|||
|
||||
public void LoadViewport(List<AbstractGlDrawable> drawables, List<ToolStripMenuItem> customContextMenus = null)
|
||||
{
|
||||
if (!Runtime.UseViewport)
|
||||
return;
|
||||
|
||||
Drawables = drawables;
|
||||
|
||||
if (customContextMenus != null)
|
||||
|
@ -114,6 +121,9 @@ namespace FirstPlugin.Forms
|
|||
|
||||
public void AddDrawable(AbstractGlDrawable draw)
|
||||
{
|
||||
if (!Runtime.UseViewport)
|
||||
return;
|
||||
|
||||
Drawables.Add(draw);
|
||||
|
||||
if (!viewport.scene.staticObjects.Contains(draw) &&
|
||||
|
@ -125,6 +135,9 @@ namespace FirstPlugin.Forms
|
|||
|
||||
public void RemoveDrawable(AbstractGlDrawable draw)
|
||||
{
|
||||
if (!Runtime.UseViewport)
|
||||
return;
|
||||
|
||||
Drawables.Remove(draw);
|
||||
viewport.RemoveDrawable(draw);
|
||||
}
|
||||
|
@ -137,7 +150,7 @@ namespace FirstPlugin.Forms
|
|||
public void OnLoadedTab()
|
||||
{
|
||||
//If a model was loaded we don't need to load the drawables again
|
||||
if (IsLoaded || Drawables == null)
|
||||
if (IsLoaded || Drawables == null || !Runtime.UseViewport)
|
||||
return;
|
||||
|
||||
foreach (var draw in Drawables)
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.samplerEditor1 = new Forms.SamplerEditor();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.uvEditor1 = new Switch_Toolbox.Library.Forms.UVEditor();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.shaderParamEditor1 = new Forms.ShaderParamEditor();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
|
@ -151,7 +150,6 @@
|
|||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.uvEditor1);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
|
@ -160,16 +158,6 @@
|
|||
this.tabPage1.Text = "UV View";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// uvEditor1
|
||||
//
|
||||
this.uvEditor1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uvEditor1.Location = new System.Drawing.Point(3, 3);
|
||||
this.uvEditor1.Name = "uvEditor1";
|
||||
this.uvEditor1.Size = new System.Drawing.Size(524, 504);
|
||||
this.uvEditor1.TabIndex = 0;
|
||||
this.uvEditor1.Load += new System.EventHandler(this.uvEditor1_Load);
|
||||
this.uvEditor1.Click += new System.EventHandler(this.uvEditor1_Click);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.shaderParamEditor1);
|
||||
|
@ -394,7 +382,6 @@
|
|||
private RenderInfoEditor renderInfoEditor1;
|
||||
private ShaderOptionsEditor shaderOptionsEditor1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private Switch_Toolbox.Library.Forms.UVEditor uvEditor1;
|
||||
private Switch_Toolbox.Library.Forms.STLabel stLabel1;
|
||||
private Switch_Toolbox.Library.Forms.STButton btnViotileFlags;
|
||||
private Switch_Toolbox.Library.Forms.STButton btnSamplerInputEditor;
|
||||
|
|
|
@ -36,6 +36,9 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
UVEditor uvEditor1 = null;
|
||||
|
||||
public void LoadMaterial(FMAT mat)
|
||||
{
|
||||
if (mat.MaterialU != null)
|
||||
|
@ -68,6 +71,21 @@ namespace FirstPlugin.Forms
|
|||
|
||||
FillForm();
|
||||
|
||||
if (Runtime.UseViewport)
|
||||
{
|
||||
LoadUVEditor();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadUVEditor()
|
||||
{
|
||||
uvEditor1 = new UVEditor();
|
||||
|
||||
this.uvEditor1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uvEditor1.Load += new System.EventHandler(this.uvEditor1_Load);
|
||||
this.uvEditor1.Click += new System.EventHandler(this.uvEditor1_Click);
|
||||
this.tabPage1.Controls.Add(this.uvEditor1);
|
||||
|
||||
uvEditor1.ActiveObjects.Clear();
|
||||
uvEditor1.Textures.Clear();
|
||||
|
||||
|
@ -105,6 +123,7 @@ namespace FirstPlugin.Forms
|
|||
uvEditor1.ActiveMaterial = material;
|
||||
uvEditor1.Refresh();
|
||||
}
|
||||
|
||||
private UVEditor.ActiveTexture LoadTextureUvMap(STGenericMatTexture texmap, STGenericTexture genericTexture)
|
||||
{
|
||||
Vector2 scale = new Vector2(1);
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -104,6 +104,8 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
public static bool renderFloorLines = true;
|
||||
|
||||
public static bool UseViewport = true;
|
||||
|
||||
//Viewport Background
|
||||
public static BackgroundStyle backgroundStyle = BackgroundStyle.Gradient;
|
||||
public static bool renderBackGround = true;
|
||||
|
|
|
@ -167,6 +167,9 @@ namespace Toolbox
|
|||
case "renderBoundingBoxes":
|
||||
bool.TryParse(node.InnerText, out Runtime.renderBoundingBoxes);
|
||||
break;
|
||||
case "UseViewport":
|
||||
bool.TryParse(node.InnerText, out Runtime.UseViewport);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,6 +277,8 @@ namespace Toolbox
|
|||
XmlNode mainSettingsNode = doc.CreateElement("MAINFORM");
|
||||
parentNode.AppendChild(mainSettingsNode);
|
||||
|
||||
|
||||
mainSettingsNode.AppendChild(createNode(doc, "UseViewport", Runtime.UseViewport.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()));
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -72,9 +72,6 @@ namespace Toolbox
|
|||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
//Create an instance of this to help load open gl data easier and quicker after boot
|
||||
var viewport = new Viewport(false);
|
||||
|
||||
VersionCheck version = new VersionCheck();
|
||||
Runtime.ProgramVersion = version.ProgramVersion;
|
||||
Runtime.CommitInfo = version.CommitInfo;
|
||||
|
@ -86,14 +83,20 @@ namespace Toolbox
|
|||
|
||||
Application.Idle += Application_Idle;
|
||||
|
||||
if (OpenTK.Graphics.GraphicsContext.CurrentContext != null)
|
||||
if (Runtime.UseViewport)
|
||||
{
|
||||
Runtime.OpenTKInitialized = true;
|
||||
//Create an instance of this to help load open gl data easier and quicker after boot
|
||||
var viewport = new Viewport(false);
|
||||
|
||||
Runtime.renderer = GL.GetString(StringName.Renderer);
|
||||
Runtime.openGLVersion = GL.GetString(StringName.Version);
|
||||
Runtime.GLSLVersion = GL.GetString(StringName.ShadingLanguageVersion);
|
||||
ParseGLVersion();
|
||||
if (OpenTK.Graphics.GraphicsContext.CurrentContext != null)
|
||||
{
|
||||
Runtime.OpenTKInitialized = true;
|
||||
|
||||
Runtime.renderer = GL.GetString(StringName.Renderer);
|
||||
Runtime.openGLVersion = GL.GetString(StringName.Version);
|
||||
Runtime.GLSLVersion = GL.GetString(StringName.ShadingLanguageVersion);
|
||||
ParseGLVersion();
|
||||
}
|
||||
}
|
||||
|
||||
LoadPLugins();
|
||||
|
|
Loading…
Reference in a new issue