diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 8e006dbc..9ac6dae7 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 29e61158..e6e270c0 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 820ecd44..5c2610ac 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/BrawlboxHelper/BrawlHelper.cs b/BrawlboxHelper/BrawlHelper.cs index 2bd41e5b..de15a722 100644 --- a/BrawlboxHelper/BrawlHelper.cs +++ b/BrawlboxHelper/BrawlHelper.cs @@ -10,6 +10,26 @@ using BrawlLib.Wii.Animations; namespace BrawlboxHelper { + public class KeyGroupData + { + public float Value; + } + + public class BoneAnimKeyData + { + public Dictionary XPOS = new Dictionary(); + public Dictionary YPOS = new Dictionary(); + public Dictionary ZPOS = new Dictionary(); + + public Dictionary XROT = new Dictionary(); + public Dictionary YROT = new Dictionary(); + public Dictionary ZROT = new Dictionary(); + + public Dictionary XSCA = new Dictionary(); + public Dictionary YSCA = new Dictionary(); + public Dictionary ZSCA = new Dictionary(); + } + public class FSHUConverter { public static ResU.ShaderParamAnim Clr02Fshu(string FileName) @@ -241,6 +261,8 @@ namespace BrawlboxHelper public class FSKAConverter { + public static List BoneAnimKeys = new List(); + static float Deg2Rad = (float)(Math.PI / 180f); static float Rad2Deg = (float)(180f / Math.PI); diff --git a/Switch_FileFormatsMain/FileFormats/Audio/Archives/BARS.cs b/Switch_FileFormatsMain/FileFormats/Audio/Archives/BARS.cs index 48a56b0e..8e076281 100644 --- a/Switch_FileFormatsMain/FileFormats/Audio/Archives/BARS.cs +++ b/Switch_FileFormatsMain/FileFormats/Audio/Archives/BARS.cs @@ -72,7 +72,7 @@ namespace FirstPlugin public class AudioEntry : TreeNodeCustom { - public AudioType Type; + public string Magic; public byte[] Data; public AudioEntry() @@ -88,12 +88,12 @@ namespace FirstPlugin } public void SetupMusic() { - if (Type == AudioType.Bfwav) + if (Magic == "FWAV" || Magic == "BWAV") { ImageKey = "bfwav"; SelectedImageKey = "bfwav"; } - else if (Type == AudioType.Bfstp) + else if (Magic == "FSTP") { ImageKey = "bfstp"; SelectedImageKey = "bfstp"; @@ -148,9 +148,9 @@ namespace FirstPlugin } public void UpdateEditor() { - switch (Type) + switch (Magic) { - case AudioType.Bfwav: + case "FWAV": // ShowHexView(); ShowBfwavPlayer(); break; @@ -245,16 +245,18 @@ namespace FirstPlugin BARSAudioFile audio = bars.AudioEntries[i].AudioFile; AudioEntry node = new AudioEntry(); - node.Type = audio.AudioType; + node.Magic = audio.Magic; node.Data = audio.data; node.SetupMusic(); - if (audio.AudioType == AudioType.Bfwav) + if (audio.Magic == "FWAV") node.Text = audioName + ".bfwav"; - else if (audio.AudioType == AudioType.Bfstp) + else if (audio.Magic == "FSTP") node.Text = audioName + ".bfstp"; + else if (audio.Magic == "BWAV") + node.Text = audioName + ".bwav"; else - node.Text = audioName + ".UNKOWN"; + node.Text = $"{audioName}.{audio.Magic}"; Nodes[1].Nodes.Add(node); } diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs index 601ea2d2..1c9448b5 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs @@ -82,6 +82,11 @@ namespace Bfres.Structs Items.Add(new STToolStipMenuItem("Show All Models", null, ShowAllModelsAction, Keys.Control | Keys.A)); Items.Add(new STToolStipMenuItem("Hide All Models", null, HideAllModelsAction, Keys.Control | Keys.H)); } + if (Type == BRESGroupType.SkeletalAnim) + { + Items.Add(new STToolStripSeparator()); + Items.Add(new STToolStipMenuItem("Batch Edit Base Data", null, BatchEditBaseAnimDataAction, Keys.Control | Keys.A)); + } return Items.ToArray(); } @@ -95,6 +100,66 @@ namespace Bfres.Structs protected void HideAllModelsAction(object sender, EventArgs e) { HideAllModels(); } protected void ShowAllModelsAction(object sender, EventArgs e) { ShowAllModels(); } + protected void BatchEditBaseAnimDataAction(object sender, EventArgs e) { BatchEditBaseAnimData(); } + + private void BatchEditBaseAnimData() + { + if (Nodes.Count <= 0) + return; + + return; + + BatchEditBaseAnimDataForm form = new BatchEditBaseAnimDataForm(); + form.LoadAnim((Animation)Nodes[0]); + + if (form.ShowDialog()== DialogResult.OK) + { + foreach (FSKA animation in Nodes) + { + if (animation.SkeletalAnimU != null) + { + foreach (var boneAnim in animation.SkeletalAnimU.BoneAnims) + { + if (boneAnim.Name == form.TargetBone) + { + var baseData = boneAnim.BaseData; + if (form.HasCustomScale) + { + boneAnim.FlagsBase |= ResU.BoneAnimFlagsBase.Scale; + boneAnim.ApplyScaleOne = false; + boneAnim.ApplyScaleUniform = false; + baseData.Scale = new Syroot.Maths.Vector3F(form.ScaleX, form.ScaleY, form.ScaleZ); + } + + boneAnim.BaseData = baseData; + } + } + } + else + { + foreach (var boneAnim in animation.SkeletalAnim.BoneAnims) + { + if (boneAnim.Name == form.TargetBone) + { + var baseData = boneAnim.BaseData; + if (form.HasCustomScale) + { + boneAnim.FlagsBase |= ResNX.BoneAnimFlagsBase.Scale; + boneAnim.ApplyScaleOne = false; + boneAnim.ApplyScaleUniform = false; + baseData.Scale = new Syroot.Maths.Vector3F(form.ScaleX, form.ScaleY, form.ScaleZ); + } + + boneAnim.BaseData = baseData; + } + } + } + + animation.OpenAnimationData(); + } + } + } + public override void ReplaceAll() { FolderSelectDialog sfd = new FolderSelectDialog(); diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs index 9801c27d..6a2a911e 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs @@ -58,7 +58,6 @@ namespace Bfres.Structs } protected void NewAction(object sender, EventArgs e) { NewBoneAnim(); } - public void NewBoneAnim() { var boneAnim = new BoneAnimNode("NewBoneTarget", true); @@ -134,6 +133,11 @@ namespace Bfres.Structs { STSkeleton skeleton = GetActiveSkeleton(); + for (int i = 0; i <= FrameCount; i++) + { + + } + if (SkeletalAnimU != null) BrawlboxHelper.FSKAConverter.Fska2Chr0(BfresPlatformConverter.FSKAConvertWiiUToSwitch(SkeletalAnimU), FileName); else diff --git a/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.Designer.cs b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.Designer.cs new file mode 100644 index 00000000..4c17b028 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.Designer.cs @@ -0,0 +1,191 @@ +namespace FirstPlugin +{ + partial class BatchEditBaseAnimDataForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel(); + this.boneListCB = new Switch_Toolbox.Library.Forms.STComboBox(); + this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel(); + this.stLabel3 = new Switch_Toolbox.Library.Forms.STLabel(); + this.stLabel4 = new Switch_Toolbox.Library.Forms.STLabel(); + this.scaleXUD = new Switch_Toolbox.Library.Forms.STNumbericUpDown(); + this.scaleYUD = new Switch_Toolbox.Library.Forms.STNumbericUpDown(); + this.scaleZUD = new Switch_Toolbox.Library.Forms.STNumbericUpDown(); + this.stButton1 = new Switch_Toolbox.Library.Forms.STButton(); + this.contentContainer.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scaleXUD)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.scaleYUD)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.scaleZUD)).BeginInit(); + this.SuspendLayout(); + // + // contentContainer + // + this.contentContainer.Controls.Add(this.stButton1); + this.contentContainer.Controls.Add(this.scaleZUD); + this.contentContainer.Controls.Add(this.scaleYUD); + this.contentContainer.Controls.Add(this.scaleXUD); + this.contentContainer.Controls.Add(this.stLabel4); + this.contentContainer.Controls.Add(this.stLabel3); + this.contentContainer.Controls.Add(this.stLabel2); + this.contentContainer.Controls.Add(this.boneListCB); + this.contentContainer.Controls.Add(this.stLabel1); + this.contentContainer.Size = new System.Drawing.Size(409, 259); + this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0); + this.contentContainer.Controls.SetChildIndex(this.boneListCB, 0); + this.contentContainer.Controls.SetChildIndex(this.stLabel2, 0); + this.contentContainer.Controls.SetChildIndex(this.stLabel3, 0); + this.contentContainer.Controls.SetChildIndex(this.stLabel4, 0); + this.contentContainer.Controls.SetChildIndex(this.scaleXUD, 0); + this.contentContainer.Controls.SetChildIndex(this.scaleYUD, 0); + this.contentContainer.Controls.SetChildIndex(this.scaleZUD, 0); + this.contentContainer.Controls.SetChildIndex(this.stButton1, 0); + // + // stLabel1 + // + this.stLabel1.AutoSize = true; + this.stLabel1.Location = new System.Drawing.Point(9, 40); + this.stLabel1.Name = "stLabel1"; + this.stLabel1.Size = new System.Drawing.Size(66, 13); + this.stLabel1.TabIndex = 12; + this.stLabel1.Text = "Bone Target"; + // + // boneListCB + // + this.boneListCB.BorderColor = System.Drawing.Color.Empty; + this.boneListCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid; + this.boneListCB.ButtonColor = System.Drawing.Color.Empty; + this.boneListCB.FormattingEnabled = true; + this.boneListCB.Location = new System.Drawing.Point(12, 56); + this.boneListCB.Name = "boneListCB"; + this.boneListCB.ReadOnly = true; + this.boneListCB.Size = new System.Drawing.Size(132, 21); + this.boneListCB.TabIndex = 13; + // + // stLabel2 + // + this.stLabel2.AutoSize = true; + this.stLabel2.Location = new System.Drawing.Point(9, 106); + this.stLabel2.Name = "stLabel2"; + this.stLabel2.Size = new System.Drawing.Size(44, 13); + this.stLabel2.TabIndex = 14; + this.stLabel2.Text = "Scale X"; + // + // stLabel3 + // + this.stLabel3.AutoSize = true; + this.stLabel3.Location = new System.Drawing.Point(121, 106); + this.stLabel3.Name = "stLabel3"; + this.stLabel3.Size = new System.Drawing.Size(44, 13); + this.stLabel3.TabIndex = 15; + this.stLabel3.Text = "Scale Y"; + // + // stLabel4 + // + this.stLabel4.AutoSize = true; + this.stLabel4.Location = new System.Drawing.Point(224, 106); + this.stLabel4.Name = "stLabel4"; + this.stLabel4.Size = new System.Drawing.Size(44, 13); + this.stLabel4.TabIndex = 16; + this.stLabel4.Text = "Scale Z"; + // + // scaleXUD + // + this.scaleXUD.Location = new System.Drawing.Point(12, 132); + this.scaleXUD.Name = "scaleXUD"; + this.scaleXUD.Size = new System.Drawing.Size(106, 20); + this.scaleXUD.TabIndex = 17; + this.scaleXUD.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // scaleYUD + // + this.scaleYUD.Location = new System.Drawing.Point(124, 132); + this.scaleYUD.Name = "scaleYUD"; + this.scaleYUD.Size = new System.Drawing.Size(106, 20); + this.scaleYUD.TabIndex = 18; + this.scaleYUD.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // scaleZUD + // + this.scaleZUD.Location = new System.Drawing.Point(227, 132); + this.scaleZUD.Name = "scaleZUD"; + this.scaleZUD.Size = new System.Drawing.Size(106, 20); + this.scaleZUD.TabIndex = 19; + this.scaleZUD.Value = new decimal(new int[] { + 1, + 0, + 0, + 0}); + // + // stButton1 + // + this.stButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.stButton1.DialogResult = System.Windows.Forms.DialogResult.OK; + this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.stButton1.Location = new System.Drawing.Point(326, 229); + this.stButton1.Name = "stButton1"; + this.stButton1.Size = new System.Drawing.Size(75, 23); + this.stButton1.TabIndex = 20; + this.stButton1.Text = "Ok"; + this.stButton1.UseVisualStyleBackColor = false; + // + // BatchEditBaseAnimDataForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(415, 264); + this.Name = "BatchEditBaseAnimDataForm"; + this.Text = "BatchEditBaseAnimDataForm"; + this.contentContainer.ResumeLayout(false); + this.contentContainer.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scaleXUD)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.scaleYUD)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.scaleZUD)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private Switch_Toolbox.Library.Forms.STLabel stLabel1; + private Switch_Toolbox.Library.Forms.STNumbericUpDown scaleYUD; + private Switch_Toolbox.Library.Forms.STNumbericUpDown scaleXUD; + private Switch_Toolbox.Library.Forms.STLabel stLabel4; + private Switch_Toolbox.Library.Forms.STLabel stLabel3; + private Switch_Toolbox.Library.Forms.STLabel stLabel2; + private Switch_Toolbox.Library.Forms.STComboBox boneListCB; + private Switch_Toolbox.Library.Forms.STButton stButton1; + private Switch_Toolbox.Library.Forms.STNumbericUpDown scaleZUD; + } +} \ No newline at end of file diff --git a/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.cs b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.cs new file mode 100644 index 00000000..1b841747 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.cs @@ -0,0 +1,44 @@ +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 Switch_Toolbox.Library.Forms; +using Switch_Toolbox.Library.Animations; + +namespace FirstPlugin +{ + public partial class BatchEditBaseAnimDataForm : STForm + { + public float ScaleX => (float)scaleXUD.Value; + public float ScaleY => (float)scaleXUD.Value; + public float ScaleZ => (float)scaleXUD.Value; + + public string TargetBone => boneListCB.GetSelectedText(); + + public BatchEditBaseAnimDataForm() + { + InitializeComponent(); + } + + public bool HasCustomScale + { + get + { + return ScaleX != 1 || ScaleY != 1 || ScaleZ != 1; + } + } + + public void LoadAnim(Animation anim) + { + foreach (var bone in anim.Bones) + boneListCB.Items.Add(bone.Text); + + boneListCB.SelectedIndex = 0; + } + } +} diff --git a/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.resx b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/BFRES/BatchEditBaseAnimDataForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj index e0d9cee0..ce91b431 100644 --- a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj +++ b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj @@ -257,6 +257,12 @@ + + Form + + + BatchEditBaseAnimDataForm.cs + Form @@ -969,6 +975,9 @@ SamplerEditorSimple.cs + + BatchEditBaseAnimDataForm.cs + BfresEditor.cs diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 6ef0c42d..c964e6b1 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.FileListAbsolute.txt b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.FileListAbsolute.txt index 84bde424..8bb1b0eb 100644 --- a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.FileListAbsolute.txt +++ b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.FileListAbsolute.txt @@ -333,3 +333,4 @@ C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Rele C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.Forms.ParamPatternMaterialEditor.resources C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.SmoothNormalsMultiMeshForm.resources C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.BMDModelImportSettings.resources +C:\Users\Nathan\Documents\GitHub\SwitchToolboxV1\Switch_FileFormatsMain\obj\Release\FirstPlugin.BatchEditBaseAnimDataForm.resources diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index e75e721f..b066df77 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Toolbox/Lib/BarsLibrary.dll b/Toolbox/Lib/BarsLibrary.dll index e982038e..01fcbb14 100644 Binary files a/Toolbox/Lib/BarsLibrary.dll and b/Toolbox/Lib/BarsLibrary.dll differ diff --git a/Toolbox/Lib/BarsLibrary.pdb b/Toolbox/Lib/BarsLibrary.pdb index ad6fb37e..1ada7ae6 100644 Binary files a/Toolbox/Lib/BarsLibrary.pdb and b/Toolbox/Lib/BarsLibrary.pdb differ