1
0
mirror of synced 2025-02-21 04:58:41 +01:00

Add option to export all for gfbanm in gfpak

This commit is contained in:
KillzXGaming 2020-05-10 11:58:08 -04:00
parent d971b03a17
commit 7a1ed513b1

View File

@ -8,7 +8,7 @@ using System.Windows.Forms;
using Toolbox.Library;
using System.IO;
using Toolbox.Library.IO;
using Toolbox.Library.Forms;
using Toolbox.Library.Animations;
namespace FirstPlugin
{
@ -142,6 +142,8 @@ namespace FirstPlugin
folder = new TextureFolder(this, "Textures");
if (folderName == "Models")
folder = new ModelFolder("Models");
if (folderName == "Animations")
folder = new AnimationFolder("Animations");
node.Nodes.Add(folder);
folders.Add(folderName, folder);
@ -255,6 +257,50 @@ namespace FirstPlugin
}
}
public class AnimationFolder : QuickAccessFileFolder, IContextMenuNode
{
public AnimationFolder(string text) : base(text) {
}
public virtual ToolStripItem[] GetContextMenuItems()
{
List<ToolStripItem> Items = new List<ToolStripItem>();
Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction, Keys.Control | Keys.E));
return Items.ToArray();
}
private void ExportAllAction(object sender, EventArgs args)
{
OnExpand();
List<string> Formats = new List<string>();
Formats.Add("SMD (.smd)");
FolderSelectDialog sfd = new FolderSelectDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
string folderPath = sfd.SelectedPath;
BatchFormatExport form = new BatchFormatExport(Formats);
if (form.ShowDialog() == DialogResult.OK)
{
foreach (TreeNode node in Nodes)
{
Console.WriteLine($"node {node}");
if (!(node is IAnimationContainer))
continue;
var anim = ((IAnimationContainer)node).AnimationController;
// if (form.Index == 0)
SMD.Save((STSkeletonAnimation)anim, $"{folderPath}/{node.Text}.smd");
}
}
}
}
}
public class TextureSubFolder : TreeNodeCustom
{