Add UI to configure material animation bind

This commit is contained in:
KillzXGaming 2023-07-31 18:32:36 -04:00
parent f567160ec8
commit 55a9c5181b
2 changed files with 52 additions and 4 deletions

View file

@ -57,6 +57,7 @@
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
this.stButton1 = new Toolbox.Library.Forms.STButton();
this.stLabel4 = new Toolbox.Library.Forms.STLabel();
this.chkBindAnim = new Toolbox.Library.Forms.STCheckBox();
this.stTabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
@ -262,7 +263,7 @@
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(366, 35);
this.stLabel1.Location = new System.Drawing.Point(366, 56);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(67, 13);
this.stLabel1.TabIndex = 44;
@ -271,7 +272,7 @@
// btnViotileFlags
//
this.btnViotileFlags.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnViotileFlags.Location = new System.Drawing.Point(439, 32);
this.btnViotileFlags.Location = new System.Drawing.Point(439, 53);
this.btnViotileFlags.Name = "btnViotileFlags";
this.btnViotileFlags.Size = new System.Drawing.Size(75, 23);
this.btnViotileFlags.TabIndex = 45;
@ -319,7 +320,7 @@
// stButton1
//
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(439, 74);
this.stButton1.Location = new System.Drawing.Point(439, 82);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 51;
@ -329,16 +330,30 @@
// stLabel4
//
this.stLabel4.AutoSize = true;
this.stLabel4.Location = new System.Drawing.Point(366, 77);
this.stLabel4.Location = new System.Drawing.Point(366, 85);
this.stLabel4.Name = "stLabel4";
this.stLabel4.Size = new System.Drawing.Size(42, 13);
this.stLabel4.TabIndex = 50;
this.stLabel4.Text = "Presets";
//
// chkBindAnim
//
this.chkBindAnim.AutoSize = true;
this.chkBindAnim.Checked = true;
this.chkBindAnim.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkBindAnim.Location = new System.Drawing.Point(361, 28);
this.chkBindAnim.Name = "chkBindAnim";
this.chkBindAnim.Size = new System.Drawing.Size(134, 17);
this.chkBindAnim.TabIndex = 52;
this.chkBindAnim.Text = "Bind Param Animations";
this.chkBindAnim.UseVisualStyleBackColor = true;
this.chkBindAnim.CheckedChanged += new System.EventHandler(this.chkBindAnim_CheckedChanged);
//
// FMATEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkBindAnim);
this.Controls.Add(this.stButton1);
this.Controls.Add(this.stLabel4);
this.Controls.Add(this.btnAttributeInputEditor);
@ -398,5 +413,6 @@
private Toolbox.Library.Forms.STLabel stLabel3;
private Toolbox.Library.Forms.STButton stButton1;
private Toolbox.Library.Forms.STLabel stLabel4;
private Toolbox.Library.Forms.STCheckBox chkBindAnim;
}
}

View file

@ -19,6 +19,7 @@ namespace FirstPlugin.Forms
public FMAT material;
public string SelectedMatParam = "";
bool init = false;
public FMATEditor()
{
@ -41,6 +42,24 @@ namespace FirstPlugin.Forms
public void LoadMaterial(FMAT mat)
{
init = false;
chkBindAnim.Checked = false;
if (mat.Material != null)
{
var shaderAssignV10 = mat.Material.ShaderAssign as MaterialParserV10.ShaderAssignV10;
if (shaderAssignV10 != null)
{
chkBindAnim.Visible = true;
chkBindAnim.Checked = shaderAssignV10.IsAnimationBinded;
}
else
chkBindAnim.Visible = false;
}
else
chkBindAnim.Visible = false;
if (mat.MaterialU != null)
{
TabPage tabPage = null;
@ -75,7 +94,10 @@ namespace FirstPlugin.Forms
chkboxVisible.Bind(material, "Enabled");
FillForm();
init = true;
}
private UVEditor.ActiveTexture LoadTextureUvMap(STGenericMatTexture texmap, STGenericTexture genericTexture)
{
Vector2 scale = new Vector2(1);
@ -296,5 +318,15 @@ namespace FirstPlugin.Forms
}
}
private void chkBindAnim_CheckedChanged(object sender, EventArgs e)
{
if (!init || material.Material == null)
return;
var shaderAssignV10 = material.Material.ShaderAssign as MaterialParserV10.ShaderAssignV10;
if (shaderAssignV10 != null)
shaderAssignV10.IsAnimationBinded = chkBindAnim.Checked;
}
}
}