1
0
mirror of synced 2024-11-12 10:10:50 +01:00

Add proper material assigning for param animations

This commit is contained in:
KillzXGaming 2019-06-01 19:29:09 -04:00
parent 41bd8f7a8f
commit 5fff7d2dab
10 changed files with 403 additions and 1 deletions

Binary file not shown.

View File

@ -197,7 +197,13 @@ namespace FirstPlugin.Forms
private void btnEditMaterial_Click(object sender, EventArgs e)
{
ParamPatternMaterialEditor editor = new ParamPatternMaterialEditor();
editor.LoadAnim(activeAnimation);
if (editor.ShowDialog() == DialogResult.OK)
{
}
}
private void btnEditSamplers_Click(object sender, EventArgs e)

View File

@ -0,0 +1,178 @@
namespace FirstPlugin.Forms
{
partial class ParamPatternMaterialEditor
{
/// <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.listViewCustom1 = new Switch_Toolbox.Library.Forms.ListViewCustom();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnAdd = new Switch_Toolbox.Library.Forms.STButton();
this.btnRemove = new Switch_Toolbox.Library.Forms.STButton();
this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel();
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.nameTB = new Switch_Toolbox.Library.Forms.STTextBox();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stButton2);
this.contentContainer.Controls.Add(this.stButton1);
this.contentContainer.Controls.Add(this.nameTB);
this.contentContainer.Controls.Add(this.stLabel2);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.btnRemove);
this.contentContainer.Controls.Add(this.btnAdd);
this.contentContainer.Controls.Add(this.listViewCustom1);
this.contentContainer.Size = new System.Drawing.Size(427, 229);
this.contentContainer.Controls.SetChildIndex(this.listViewCustom1, 0);
this.contentContainer.Controls.SetChildIndex(this.btnAdd, 0);
this.contentContainer.Controls.SetChildIndex(this.btnRemove, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0);
this.contentContainer.Controls.SetChildIndex(this.nameTB, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton1, 0);
this.contentContainer.Controls.SetChildIndex(this.stButton2, 0);
//
// listViewCustom1
//
this.listViewCustom1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listViewCustom1.FullRowSelect = true;
this.listViewCustom1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listViewCustom1.Location = new System.Drawing.Point(9, 77);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(183, 143);
this.listViewCustom1.TabIndex = 11;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
this.listViewCustom1.View = System.Windows.Forms.View.Details;
this.listViewCustom1.SelectedIndexChanged += new System.EventHandler(this.listViewCustom1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Width = 173;
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(9, 48);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(57, 23);
this.btnAdd.TabIndex = 12;
this.btnAdd.Text = "Add";
this.btnAdd.UseVisualStyleBackColor = false;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnRemove
//
this.btnRemove.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnRemove.Location = new System.Drawing.Point(72, 48);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(64, 23);
this.btnRemove.TabIndex = 13;
this.btnRemove.Text = "Remove";
this.btnRemove.UseVisualStyleBackColor = false;
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(9, 32);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(52, 13);
this.stLabel1.TabIndex = 14;
this.stLabel1.Text = "Materials:";
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(198, 77);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(38, 13);
this.stLabel2.TabIndex = 15;
this.stLabel2.Text = "Name:";
//
// nameTB
//
this.nameTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.nameTB.Location = new System.Drawing.Point(257, 75);
this.nameTB.Name = "nameTB";
this.nameTB.Size = new System.Drawing.Size(165, 20);
this.nameTB.TabIndex = 16;
this.nameTB.TextChanged += new System.EventHandler(this.nameTB_TextChanged);
//
// stButton1
//
this.stButton1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(343, 197);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 19;
this.stButton1.Text = "Cancel";
this.stButton1.UseVisualStyleBackColor = false;
//
// stButton2
//
this.stButton2.DialogResult = System.Windows.Forms.DialogResult.OK;
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(262, 197);
this.stButton2.Name = "stButton2";
this.stButton2.Size = new System.Drawing.Size(75, 23);
this.stButton2.TabIndex = 20;
this.stButton2.Text = "Ok";
this.stButton2.UseVisualStyleBackColor = false;
//
// TexPatternMaterialEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(433, 234);
this.Name = "TexPatternMaterialEditor";
this.Text = "TexPatternMaterialEditor";
this.contentContainer.ResumeLayout(false);
this.contentContainer.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Switch_Toolbox.Library.Forms.STTextBox nameTB;
private Switch_Toolbox.Library.Forms.STLabel stLabel2;
private Switch_Toolbox.Library.Forms.STLabel stLabel1;
private Switch_Toolbox.Library.Forms.STButton btnRemove;
private Switch_Toolbox.Library.Forms.ListViewCustom listViewCustom1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private Switch_Toolbox.Library.Forms.STButton btnAdd;
private Switch_Toolbox.Library.Forms.STButton stButton2;
private Switch_Toolbox.Library.Forms.STButton stButton1;
}
}

View File

@ -0,0 +1,88 @@
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 Bfres.Structs;
using Switch_Toolbox.Library.Forms;
using Switch_Toolbox.Library.Animations;
namespace FirstPlugin.Forms
{
public partial class ParamPatternMaterialEditor : STForm
{
public ParamPatternMaterialEditor()
{
InitializeComponent();
CanResize = false;
btnRemove.Enabled = false;
}
MaterialAnimation activeAnim;
public void LoadAnim(MaterialAnimation anim)
{
activeAnim = anim;
foreach (var material in anim.Materials)
{
listViewCustom1.Items.Add(material.Text);
}
}
private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewCustom1.SelectedItems.Count > 0)
{
btnRemove.Enabled = true;
int index = listViewCustom1.SelectedIndices[0];
nameTB.Text = activeAnim.Materials[index].Text;
}
else
{
btnRemove.Enabled = false;
}
}
private void btnRemove_Click(object sender, EventArgs e)
{
if (listViewCustom1.SelectedItems.Count > 0)
{
int index = listViewCustom1.SelectedIndices[0];
string Name = activeAnim.Materials[index].Text;
var result = MessageBox.Show($"Are you sure you want to delete material {Name}? This cannot be undone!",
"", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (result == DialogResult.Yes)
{
activeAnim.Materials.RemoveAt(index);
listViewCustom1.Items.RemoveAt(index);
}
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
activeAnim.Materials.Add(new MaterialAnimation.Material() { Text = "NewMaterial"});
listViewCustom1.Items.Add("NewMaterial");
}
private void nameTB_TextChanged(object sender, EventArgs e)
{
if (listViewCustom1.SelectedItems.Count > 0)
{
int index = listViewCustom1.SelectedIndices[0];
activeAnim.Materials[index].Text = nameTB.Text;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -272,6 +272,12 @@
<Compile Include="GUI\AAMP\AampEditor.Designer.cs">
<DependentUpon>AampEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\BFRES\ParamAnim\ParamPatternMaterialEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\BFRES\ParamAnim\ParamPatternMaterialEditor.Designer.cs">
<DependentUpon>ParamPatternMaterialEditor.cs</DependentUpon>
</Compile>
<Compile Include="YAML\YamlAamp.cs" />
<Compile Include="GUI\BCRES\BfresEditor.cs">
<SubType>UserControl</SubType>
@ -984,6 +990,9 @@
<EmbeddedResource Include="GUI\BFRES\Materials\VolatileFlagEditor.resx">
<DependentUpon>VolatileFlagEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFRES\ParamAnim\ParamPatternMaterialEditor.resx">
<DependentUpon>ParamPatternMaterialEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFRES\Shape\CopyUVChannelDialog.resx">
<DependentUpon>CopyUVChannelDialog.cs</DependentUpon>
</EmbeddedResource>

View File

@ -1 +1 @@
257ba835e60e5df185147b3c27d6feb25ebe1d95
047c65264269a34c41a754cfab4e34dee3b8889d

View File

@ -331,3 +331,4 @@ C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Rele
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.BcresSamplerEditorSimple.resources
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.OdysseyCostumeSelector.resources
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.MaterialPresetDialog.resources
C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.ParamPatternMaterialEditor.resources