Add collision type window. Not editable just yet

This commit is contained in:
KillzXGaming 2019-04-12 19:32:38 -04:00
parent de0fd3f31e
commit 932bab3c75
17 changed files with 424 additions and 6 deletions

Binary file not shown.

View file

@ -12,6 +12,7 @@ using System.Drawing;
using Switch_Toolbox.Library.IO;
using Switch_Toolbox.Library.Forms;
using GL_EditorFramework.EditorDrawables;
using FirstPlugin.Forms;
namespace FirstPlugin
{
@ -59,12 +60,24 @@ namespace FirstPlugin
ContextMenuStrip.Items.Add(new STToolStripItem("Save", Save));
ContextMenuStrip.Items.Add(new STToolStripItem("Export", Export));
ContextMenuStrip.Items.Add(new STToolStripItem("Replace", Replace));
ContextMenuStrip.Items.Add(new STToolStripItem("Open Material Editor", OpenMaterialEditor));
EndiannessToolstrip = new STToolStripItem("Big Endian Mode", SwapEndianess) { Checked = true };
ContextMenuStrip.Items.Add(EndiannessToolstrip);
CanSave = true;
IFileInfo = new IFileInfo();
}
public void OpenMaterialEditor(object sender, EventArgs args)
{
CollisionMaterialEditor editor = new CollisionMaterialEditor();
editor.LoadCollisionValues(kcl, Renderer);
if (editor.ShowDialog() == DialogResult.OK)
{
}
}
public void Load(System.IO.Stream stream)
{
Text = FileName;
@ -386,6 +399,8 @@ namespace FirstPlugin
public class KCLRendering : EditableObject
{
public List<ushort> SelectedTypes = new List<ushort>();
public Vector3 position = new Vector3(0, 0, 0);
protected bool Selected = false;

View file

@ -270,7 +270,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
// ObjPaths.Add(new ObjPathGroup(objPath));
}
}
if (root.ContainsKey("PullPath")) {
/* if (root.ContainsKey("PullPath")) {
foreach (var pullPath in root["PullPath"])
PullPaths.Add(new PullPathGroup(pullPath));
}
@ -291,7 +291,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
foreach (var steerAssistPath in root["SteerAssistPath"]) {
SteerAssistPaths.Add(new SteerAssistPathGroup(steerAssistPath));
}
}
}*/
}

View file

@ -142,9 +142,9 @@ namespace FirstPlugin.Forms
foreach (var bfres in scene.BfresObjects)
{
// viewport.AddDrawable(bfres.BFRESRender);
// treeView1.Nodes.Add(bfres);
// bfres.Checked = true;
viewport.AddDrawable(bfres.BFRESRender);
treeView1.Nodes.Add(bfres);
bfres.Checked = true;
}
IsLoaded = true;

View file

@ -0,0 +1,193 @@
namespace FirstPlugin.Forms
{
partial class CollisionMaterialEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.stListView1 = new Switch_Toolbox.Library.Forms.STListView();
this.olvColumn1 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.olvColumn2 = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.numericUpDownUint1 = new Switch_Toolbox.Library.Forms.NumericUpDownUint();
this.stMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
this.selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.byMaterialToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.contentContainer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.stListView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).BeginInit();
this.stMenuStrip1.SuspendLayout();
this.stPanel1.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stPanel1);
this.contentContainer.Size = new System.Drawing.Size(235, 393);
this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0);
//
// stListView1
//
this.stListView1.AllColumns.Add(this.olvColumn1);
this.stListView1.AllColumns.Add(this.olvColumn2);
this.stListView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.stListView1.CellEditUseWholeCell = false;
this.stListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.olvColumn1,
this.olvColumn2});
this.stListView1.Cursor = System.Windows.Forms.Cursors.Default;
this.stListView1.Location = new System.Drawing.Point(-3, 53);
this.stListView1.Name = "stListView1";
this.stListView1.Size = new System.Drawing.Size(235, 277);
this.stListView1.TabIndex = 0;
this.stListView1.UseCompatibleStateImageBehavior = false;
this.stListView1.View = System.Windows.Forms.View.Details;
this.stListView1.SelectedIndexChanged += new System.EventHandler(this.stListView1_SelectedIndexChanged);
//
// olvColumn1
//
this.olvColumn1.AspectName = "ID";
this.olvColumn1.CellEditUseWholeCell = true;
this.olvColumn1.Text = "ID";
this.olvColumn1.Width = 92;
//
// olvColumn2
//
this.olvColumn2.AspectName = "Type";
this.olvColumn2.Text = "Type";
this.olvColumn2.Width = 131;
//
// numericUpDownUint1
//
this.numericUpDownUint1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownUint1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.numericUpDownUint1.Location = new System.Drawing.Point(2, 27);
this.numericUpDownUint1.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.numericUpDownUint1.Name = "numericUpDownUint1";
this.numericUpDownUint1.Size = new System.Drawing.Size(230, 20);
this.numericUpDownUint1.TabIndex = 1;
//
// stMenuStrip1
//
this.stMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.selectToolStripMenuItem});
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stMenuStrip1.Name = "stMenuStrip1";
this.stMenuStrip1.Size = new System.Drawing.Size(235, 24);
this.stMenuStrip1.TabIndex = 2;
this.stMenuStrip1.Text = "stMenuStrip1";
//
// selectToolStripMenuItem
//
this.selectToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.byMaterialToolStripMenuItem});
this.selectToolStripMenuItem.Name = "selectToolStripMenuItem";
this.selectToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
this.selectToolStripMenuItem.Text = "Select";
//
// byMaterialToolStripMenuItem
//
this.byMaterialToolStripMenuItem.Name = "byMaterialToolStripMenuItem";
this.byMaterialToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.byMaterialToolStripMenuItem.Text = "By Material";
//
// stButton1
//
this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(72, 336);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(77, 26);
this.stButton1.TabIndex = 3;
this.stButton1.Text = "Ok";
this.stButton1.UseVisualStyleBackColor = false;
//
// stButton2
//
this.stButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(155, 336);
this.stButton2.Name = "stButton2";
this.stButton2.Size = new System.Drawing.Size(77, 26);
this.stButton2.TabIndex = 4;
this.stButton2.Text = "Cancel";
this.stButton2.UseVisualStyleBackColor = false;
//
// stPanel1
//
this.stPanel1.Controls.Add(this.stListView1);
this.stPanel1.Controls.Add(this.stButton1);
this.stPanel1.Controls.Add(this.numericUpDownUint1);
this.stPanel1.Controls.Add(this.stButton2);
this.stPanel1.Controls.Add(this.stMenuStrip1);
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(0, 25);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(235, 368);
this.stPanel1.TabIndex = 11;
//
// CollisionMaterialEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(238, 398);
this.MainMenuStrip = this.stMenuStrip1;
this.Name = "CollisionMaterialEditor";
this.Text = "Collision Materials";
this.contentContainer.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.stListView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).EndInit();
this.stMenuStrip1.ResumeLayout(false);
this.stMenuStrip1.PerformLayout();
this.stPanel1.ResumeLayout(false);
this.stPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Switch_Toolbox.Library.Forms.STListView stListView1;
private BrightIdeasSoftware.OLVColumn olvColumn1;
private BrightIdeasSoftware.OLVColumn olvColumn2;
private Switch_Toolbox.Library.Forms.NumericUpDownUint numericUpDownUint1;
private Switch_Toolbox.Library.Forms.STMenuStrip stMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem byMaterialToolStripMenuItem;
private Switch_Toolbox.Library.Forms.STButton stButton1;
private Switch_Toolbox.Library.Forms.STButton stButton2;
private Switch_Toolbox.Library.Forms.STPanel stPanel1;
}
}

View file

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FirstPlugin;
using Switch_Toolbox.Library.Forms;
namespace FirstPlugin.Forms
{
public partial class CollisionMaterialEditor : STForm
{
public CollisionMaterialEditor()
{
InitializeComponent();
}
public KCL.GameSet GameMaterialSet = KCL.GameSet.MarioKart8D;
public class CollisionMaterial
{
public ushort ID { get; set; }
public string Type { get; set; }
}
KCL.KCLRendering Render;
public void LoadCollisionValues(MarioKart.MK7.KCL kcl, KCL.KCLRendering renderer)
{
Render = renderer;
List<CollisionMaterial> Materials = new List<CollisionMaterial>();
foreach (var model in kcl.Models)
{
foreach (var plane in model.Planes)
{
string type = "Unknown";
switch (GameMaterialSet)
{
case KCL.GameSet.MarioKart8D:
type = ((KCL.CollisionType_MK8D)plane.CollisionType).ToString();
break;
case KCL.GameSet.MarioOdyssey:
type = ((KCL.CollisionType_MarioOdssey)plane.CollisionType).ToString();
break;
}
Materials.Add(new CollisionMaterial()
{
ID = plane.CollisionType,
Type = type,
});
}
stListView1.SetObjects(Materials);
}
stListView1.SetTheme();
}
private void stListView1_SelectedIndexChanged(object sender, EventArgs e)
{
Render.SelectedTypes.Clear();
foreach (var collision in stListView1.SelectedObjects)
{
var coll = (CollisionMaterial)collision;
Render.SelectedTypes.Add(coll.ID);
}
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="stMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -365,6 +365,12 @@
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\PathPointNode.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\ProbeLightingEntryWrapper.cs" />
<Compile Include="GUI\Byaml\CourseMuunt\Wrappers\ProbeLightingWrapper.cs" />
<Compile Include="GUI\KCL\CollisionMaterialEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\KCL\CollisionMaterialEditor.Designer.cs">
<DependentUpon>CollisionMaterialEditor.cs</DependentUpon>
</Compile>
<Compile Include="MarioCostumeEditor.cs" />
<Compile Include="GUI\AAMP\AampV1Editor.cs">
<SubType>UserControl</SubType>
@ -1003,6 +1009,9 @@
<EmbeddedResource Include="GUI\Editors\VisibiltyAnimEditor.resx">
<DependentUpon>VisibiltyAnimEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\KCL\CollisionMaterialEditor.resx">
<DependentUpon>CollisionMaterialEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\KeySelection.resx" />
<EmbeddedResource Include="GUI\Byaml\ByamlEditor.resx">
<DependentUpon>ByamlEditor.cs</DependentUpon>

View file

@ -1 +1 @@
a9478050cb84dea301afe57fdf9fb71912dcaa20
cc9e257c523db2c7ef86dbf7768c79a58b3e9716

View file

@ -319,3 +319,4 @@ C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Toolbox\bin\Release\Lib\Plugins
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Toolbox\bin\Release\Lib\Plugins\FirstPlugin.Plg.dll
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Toolbox\bin\Release\Lib\Plugins\FirstPlugin.Plg.pdb
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\Switch_FileFormatsMain.csproj.CopyComplete
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.CollisionMaterialEditor.resources