mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Fix font scaling on title bar
This commit is contained in:
parent
e4e58a3bfb
commit
8b052bf4b4
10 changed files with 136 additions and 13 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -180,6 +180,131 @@ namespace Bfres.Structs
|
|||
}
|
||||
}
|
||||
|
||||
public override void NextFrame(Viewport viewport)
|
||||
{
|
||||
if (Frame > FrameCount) return;
|
||||
|
||||
//Loop through each drawable bfres in the active viewport to display the anim
|
||||
foreach (var drawable in viewport.scene.staticObjects)
|
||||
{
|
||||
if (drawable is BFRESRender)
|
||||
LoadMaterialAnimation(((BFRESRender)drawable).models);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadMaterialAnimation(List<FMDL> models)
|
||||
{
|
||||
//Loop through each FMDL's materials until it matches the material anim
|
||||
foreach (var model in models)
|
||||
{
|
||||
foreach (Material matAnim in Materials)
|
||||
{
|
||||
if (model.materials.ContainsKey(matAnim.Text))
|
||||
EditMaterial(model.materials[matAnim.Text], matAnim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EditMaterial(FMAT material, Material matAnim)
|
||||
{
|
||||
SetShaderParamAnimation(material, matAnim);
|
||||
}
|
||||
|
||||
private void SetShaderParamAnimation(FMAT material, Material matAnim)
|
||||
{
|
||||
if (matAnim.Params.Count == 0)
|
||||
return;
|
||||
|
||||
Console.WriteLine("Playing anim " + Frame);
|
||||
|
||||
//Loop through param list for shader param anims
|
||||
//These store a list of values with offsets to the value
|
||||
//Then we'll update the active texture
|
||||
foreach (FSHU.BfresParamAnim paramAnim in matAnim.Params)
|
||||
{
|
||||
if (material.matparam.ContainsKey(paramAnim.Text))
|
||||
{
|
||||
//First we get the active param that we want to alter
|
||||
BfresShaderParam prm = material.matparam[paramAnim.Text];
|
||||
BfresShaderParam animatedprm = new BfresShaderParam();
|
||||
if (!material.animatedMatParams.ContainsKey(prm.Name))
|
||||
material.animatedMatParams.Add(prm.Name, animatedprm);
|
||||
animatedprm.Name = prm.Name;
|
||||
animatedprm.ValueUint = prm.ValueUint;
|
||||
animatedprm.ValueBool = prm.ValueBool;
|
||||
animatedprm.ValueFloat = prm.ValueFloat;
|
||||
animatedprm.ValueSrt2D = prm.ValueSrt2D;
|
||||
animatedprm.ValueSrt3D = prm.ValueSrt3D;
|
||||
animatedprm.ValueTexSrt = prm.ValueTexSrt;
|
||||
animatedprm.ValueTexSrtEx = prm.ValueTexSrtEx;
|
||||
|
||||
foreach (var group in paramAnim.Values)
|
||||
{
|
||||
//The offset determines the value starting from 0.
|
||||
int index = 0;
|
||||
if (prm.ValueFloat != null)
|
||||
{
|
||||
if (group.AnimDataOffset != 0)
|
||||
index = (int)group.AnimDataOffset / sizeof(float);
|
||||
|
||||
animatedprm.ValueFloat[index] = group.GetValue(Frame);
|
||||
}
|
||||
if (prm.ValueInt != null)
|
||||
{
|
||||
|
||||
}
|
||||
if (prm.ValueUint != null)
|
||||
{
|
||||
|
||||
}
|
||||
if (prm.ValueBool != null)
|
||||
{
|
||||
|
||||
}
|
||||
if (prm.Type == Syroot.NintenTools.NSW.Bfres.ShaderParamType.Srt3D)
|
||||
{
|
||||
if (group.AnimDataOffset == 0) prm.ValueSrt3D.Scaling.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 4) prm.ValueSrt3D.Scaling.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 8) prm.ValueSrt3D.Scaling.Z = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 12) prm.ValueSrt3D.Rotation.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 16) prm.ValueSrt3D.Rotation.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 20) prm.ValueSrt3D.Rotation.Z = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 24) prm.ValueSrt3D.Translation.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 28) prm.ValueSrt3D.Translation.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 32) prm.ValueSrt3D.Translation.Z = group.GetValue(Frame);
|
||||
}
|
||||
if (prm.Type == Syroot.NintenTools.NSW.Bfres.ShaderParamType.Srt2D)
|
||||
{
|
||||
if (group.AnimDataOffset == 0) prm.ValueSrt2D.Scaling.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 4) prm.ValueSrt2D.Scaling.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 8) prm.ValueSrt2D.Rotation = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 12) prm.ValueSrt2D.Translation.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 16) prm.ValueSrt2D.Translation.X = group.GetValue(Frame);
|
||||
}
|
||||
if (prm.Type == Syroot.NintenTools.NSW.Bfres.ShaderParamType.TexSrt)
|
||||
{
|
||||
if (group.AnimDataOffset == 0) prm.ValueTexSrt.Mode = (Syroot.NintenTools.NSW.Bfres.TexSrtMode)(uint)group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 4) prm.ValueTexSrt.Scaling.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 8) prm.ValueTexSrt.Scaling.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 12) prm.ValueTexSrt.Rotation = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 16) prm.ValueTexSrt.Translation.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 20) prm.ValueTexSrt.Translation.Y = group.GetValue(Frame);
|
||||
}
|
||||
if (prm.Type == Syroot.NintenTools.NSW.Bfres.ShaderParamType.TexSrtEx)
|
||||
{
|
||||
if (group.AnimDataOffset == 0) prm.ValueTexSrtEx.Mode = (Syroot.NintenTools.NSW.Bfres.TexSrtMode)(uint)group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 4) prm.ValueTexSrtEx.Scaling.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 8) prm.ValueTexSrtEx.Scaling.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 12) prm.ValueTexSrtEx.Rotation = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 16) prm.ValueTexSrtEx.Translation.X = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 20) prm.ValueTexSrtEx.Translation.Y = group.GetValue(Frame);
|
||||
if (group.AnimDataOffset == 24) prm.ValueTexSrtEx.MatrixPointer = (uint)group.GetValue(Frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MaterialAnimEntry : Material
|
||||
{
|
||||
public ShaderParamMatAnim materialAnimData;
|
||||
|
|
|
@ -83,16 +83,18 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
if (IsKeyed(paramAnim, Frame))
|
||||
{
|
||||
var item1 = new ListViewItem($"{Frame}");
|
||||
/* var item1 = new ListViewItem($"{Frame}");
|
||||
listViewCustom1.Items.Add(item1);
|
||||
|
||||
foreach (var track in paramAnim.Values)
|
||||
{
|
||||
var keyFrame = track.GetKeyFrame(Frame);
|
||||
|
||||
if (track.AnimDataOffset == (uint)TexSRT.Mode)
|
||||
item1.SubItems.Add(((uint)track.GetValue(Frame)).ToString());
|
||||
item1.SubItems.Add(((uint)keyFrame.Value).ToString());
|
||||
else
|
||||
item1.SubItems.Add(track.GetValue(Frame).ToString());
|
||||
}
|
||||
item1.SubItems.Add(keyFrame.Value.ToString());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -108,16 +110,15 @@ namespace FirstPlugin.Forms
|
|||
{
|
||||
if (IsKeyed(paramAnim, Frame))
|
||||
{
|
||||
var item1 = new ListViewItem($"{Frame}");
|
||||
/* var item1 = new ListViewItem($"{Frame}");
|
||||
listViewCustom1.Items.Add(item1);
|
||||
|
||||
foreach (var track in paramAnim.Values)
|
||||
{
|
||||
var keyFrame = track.GetKeyFrame(Frame);
|
||||
|
||||
float value = track.GetValue(Frame);
|
||||
item1.SubItems.Add(value.ToString());
|
||||
}
|
||||
item1.SubItems.Add(keyFrame.Value.ToString());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -137,6 +137,8 @@ namespace Switch_Toolbox.Library.Animations
|
|||
|
||||
public bool HasKeyedFrames(float frame)
|
||||
{
|
||||
return false;
|
||||
|
||||
return (XPOS.HasAnimation() && XPOS.GetKeyFrame(frame).IsKeyed ||
|
||||
YPOS.HasAnimation() && YPOS.GetKeyFrame(frame).IsKeyed ||
|
||||
ZPOS.HasAnimation() && ZPOS.GetKeyFrame(frame).IsKeyed ||
|
||||
|
|
2
Toolbox/MainForm.Designer.cs
generated
2
Toolbox/MainForm.Designer.cs
generated
|
@ -446,8 +446,6 @@
|
|||
// MainForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1108, 621);
|
||||
this.Controls.Add(this.tabForms);
|
||||
this.Controls.Add(this.stPanel2);
|
||||
|
|
|
@ -123,9 +123,6 @@
|
|||
<metadata name="tabControlContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>249, 17</value>
|
||||
</metadata>
|
||||
<metadata name="stToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="BtnMdiMinimize.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
|
Loading…
Reference in a new issue