2018-11-22 21:54:52 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Switch_Toolbox.Library;
|
|
|
|
|
using FirstPlugin;
|
2018-11-22 23:06:22 +01:00
|
|
|
|
using Syroot.NintenTools.NSW.Bfres;
|
2018-11-22 21:54:52 +01:00
|
|
|
|
|
|
|
|
|
namespace Bfres.Structs
|
|
|
|
|
{
|
|
|
|
|
public class FscnFolder : TreeNodeCustom
|
|
|
|
|
{
|
|
|
|
|
public FscnFolder()
|
|
|
|
|
{
|
|
|
|
|
Text = "Scene Animations";
|
|
|
|
|
Name = "FSCN";
|
|
|
|
|
|
|
|
|
|
ContextMenu = new ContextMenu();
|
|
|
|
|
MenuItem import = new MenuItem("Import");
|
|
|
|
|
ContextMenu.MenuItems.Add(import);
|
|
|
|
|
import.Click += Import;
|
|
|
|
|
MenuItem exportAll = new MenuItem("Export All");
|
|
|
|
|
ContextMenu.MenuItems.Add(exportAll);
|
|
|
|
|
exportAll.Click += ExportAll;
|
|
|
|
|
MenuItem clear = new MenuItem("Clear");
|
|
|
|
|
ContextMenu.MenuItems.Add(clear);
|
|
|
|
|
clear.Click += Clear;
|
|
|
|
|
}
|
2018-11-22 22:17:03 +01:00
|
|
|
|
private void Import(object sender, EventArgs args)
|
2018-11-22 21:54:52 +01:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2018-11-22 22:17:03 +01:00
|
|
|
|
private void ExportAll(object sender, EventArgs args)
|
2018-11-22 21:54:52 +01:00
|
|
|
|
{
|
2018-11-23 21:39:16 +01:00
|
|
|
|
FolderSelectDialog sfd = new FolderSelectDialog();
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
string folderPath = sfd.SelectedPath;
|
|
|
|
|
foreach (FSCN fscn in Nodes)
|
|
|
|
|
{
|
|
|
|
|
string FileName = folderPath + '\\' + fscn.Text + ".bfscn";
|
|
|
|
|
((FSCN)fscn).SceneAnim.Export(FileName, fscn.GetResFile());
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-22 21:54:52 +01:00
|
|
|
|
}
|
2018-11-22 22:17:03 +01:00
|
|
|
|
private void Clear(object sender, EventArgs args)
|
2018-11-22 21:54:52 +01:00
|
|
|
|
{
|
2018-11-22 23:06:22 +01:00
|
|
|
|
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all scene animations? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
2018-11-22 21:54:52 +01:00
|
|
|
|
if (dialogResult == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Nodes.Clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick(TreeView treeView)
|
|
|
|
|
{
|
|
|
|
|
FormLoader.LoadEditor(this, Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-22 23:06:22 +01:00
|
|
|
|
public class FSCN : TreeNodeCustom
|
2018-11-22 21:54:52 +01:00
|
|
|
|
{
|
2018-11-22 23:06:22 +01:00
|
|
|
|
public SceneAnim SceneAnim;
|
|
|
|
|
public FSCN()
|
|
|
|
|
{
|
2018-11-28 03:21:31 +01:00
|
|
|
|
ImageKey = "sceneAnimation";
|
|
|
|
|
SelectedImageKey = "sceneAnimation";
|
2018-11-22 23:06:22 +01:00
|
|
|
|
|
|
|
|
|
ContextMenu = new ContextMenu();
|
|
|
|
|
MenuItem export = new MenuItem("Export");
|
|
|
|
|
ContextMenu.MenuItems.Add(export);
|
|
|
|
|
export.Click += Export;
|
|
|
|
|
MenuItem replace = new MenuItem("Replace");
|
|
|
|
|
ContextMenu.MenuItems.Add(replace);
|
|
|
|
|
replace.Click += Replace;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-23 01:40:36 +01:00
|
|
|
|
public ResFile GetResFile()
|
|
|
|
|
{
|
|
|
|
|
return ((ResourceFile)Parent.Parent).resFile;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-22 23:06:22 +01:00
|
|
|
|
private void Export(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
2018-11-28 03:21:31 +01:00
|
|
|
|
sfd.Filter = "Supported Formats|*.bfscn;";
|
2018-11-22 23:06:22 +01:00
|
|
|
|
sfd.FileName = Text;
|
|
|
|
|
sfd.DefaultExt = ".bfska";
|
|
|
|
|
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
2018-11-23 01:40:36 +01:00
|
|
|
|
SceneAnim.Export(sfd.FileName, GetResFile());
|
2018-11-22 23:06:22 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void Replace(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
2018-11-28 03:21:31 +01:00
|
|
|
|
ofd.Filter = "Supported Formats|*.bfscn;";
|
2018-11-22 21:54:52 +01:00
|
|
|
|
|
2018-11-22 23:06:22 +01:00
|
|
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
SceneAnim.Import(ofd.FileName);
|
|
|
|
|
}
|
|
|
|
|
SceneAnim.Name = Text;
|
|
|
|
|
}
|
|
|
|
|
public void Read(SceneAnim scn)
|
|
|
|
|
{
|
|
|
|
|
SceneAnim = scn;
|
|
|
|
|
}
|
2018-11-22 21:54:52 +01:00
|
|
|
|
}
|
|
|
|
|
}
|