Fix some tool menu extensions from the plguin
This commit is contained in:
parent
9e3556a5f9
commit
84f9811f93
Binary file not shown.
230
File_Format_Library/Actors/BotwActorLoader.cs
Normal file
230
File_Format_Library/Actors/BotwActorLoader.cs
Normal file
@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library;
|
||||
using Toolbox.Library.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that holds methods to load actor data for botw.
|
||||
/// </summary>
|
||||
public class BotwActorLoader
|
||||
{
|
||||
private static string ActorPath = $"/Actor/Pack/";
|
||||
private static string CachedActorsPath = $"/Pack/";
|
||||
|
||||
public enum ActorCategory
|
||||
{
|
||||
Armour,
|
||||
Animal,
|
||||
Weapon,
|
||||
Item,
|
||||
Enemy,
|
||||
Npc,
|
||||
}
|
||||
|
||||
public class ActorDefineInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public ActorDefineInfo(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, ActorDefineInfo> ArmorActorDefine = new Dictionary<string, ActorDefineInfo>()
|
||||
{
|
||||
{"001", new ActorDefineInfo("Hylian Tunic Set") },
|
||||
{"002",new ActorDefineInfo("Hylian Tunic Set Upgraded") },
|
||||
{"003",new ActorDefineInfo("Hylian Tunic Set Upgraded 2") },
|
||||
{"004",new ActorDefineInfo("Hylian Tunic Set Upgraded 3") },
|
||||
{"005",new ActorDefineInfo("Tunic of the Wild Set") },
|
||||
{"006",new ActorDefineInfo("Zora Set") },
|
||||
{"007",new ActorDefineInfo("Zora Set Upgraded") },
|
||||
{"008",new ActorDefineInfo("Desert Voe Set") },
|
||||
{"009",new ActorDefineInfo("Snowquill Set" )},
|
||||
{"011",new ActorDefineInfo("Flamebreaker Set") },
|
||||
{"012",new ActorDefineInfo("Stealth Set" )},
|
||||
{"014",new ActorDefineInfo("Climbing Gear Set" )},
|
||||
{"017",new ActorDefineInfo("Radiant Set" )},
|
||||
{"020",new ActorDefineInfo("Soldier's Armor Set" )},
|
||||
{"021",new ActorDefineInfo("Ancient Set") },
|
||||
{"022",new ActorDefineInfo("Bokoblin Mask") },
|
||||
{"024",new ActorDefineInfo("Diamond Circlet") },
|
||||
{"025",new ActorDefineInfo("Ruby Circlet") },
|
||||
{"026",new ActorDefineInfo("Sapphire Circlet") },
|
||||
{"027",new ActorDefineInfo("Topaz Circlet") },
|
||||
{"028",new ActorDefineInfo("Opal Circlet") },
|
||||
{"029",new ActorDefineInfo("Amber Circlet") },
|
||||
};
|
||||
|
||||
private ObjectEditor editor;
|
||||
|
||||
public BotwActorLoader()
|
||||
{
|
||||
editor = new ObjectEditor();
|
||||
editor.Text = "Actor Editor BOTW";
|
||||
LibraryGUI.CreateMdiWindow(editor);
|
||||
|
||||
LoadActors();
|
||||
}
|
||||
|
||||
private void LoadActors()
|
||||
{
|
||||
//Setup a list of nodes based on category
|
||||
TreeNode ArmourFolder = new TreeNode("Armours");
|
||||
TreeNode WeaponsFolder = new TreeNode("Weapons");
|
||||
TreeNode ItemsFolder = new TreeNode("Items");
|
||||
TreeNode EnemyFolder = new TreeNode("Enemies");
|
||||
|
||||
if (!Directory.Exists(Runtime.BotwGamePath))
|
||||
{
|
||||
bool IsValid = NotifySetGamePath();
|
||||
if (!IsValid) //Give up loading it if it's wrong
|
||||
return;
|
||||
}
|
||||
|
||||
//Load all our actors into a class
|
||||
foreach (var file in Directory.GetFiles($"{Runtime.BotwGamePath}{ActorPath}"))
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(file);
|
||||
|
||||
var actorType = name.Split('_').First();
|
||||
var actorID = name.Split('_').Skip(1).FirstOrDefault();
|
||||
var actorProperty = name.Split('_').Last();
|
||||
|
||||
if (actorType == "Armor")
|
||||
{
|
||||
if (ArmorActorDefine.ContainsKey(actorID))
|
||||
{
|
||||
ActorDefineInfo info = ArmorActorDefine[actorID];
|
||||
|
||||
ActorEntry entry = new ActorEntry();
|
||||
entry.Text = info.Name;
|
||||
entry.FilePath = file;
|
||||
entry.FileName = name;
|
||||
entry.Category = ActorCategory.Armour;
|
||||
ArmourFolder.Nodes.Add(entry);
|
||||
}
|
||||
}
|
||||
else if (actorType == "Animal")
|
||||
{
|
||||
|
||||
}
|
||||
else if (actorType == "Npc")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//The game also caches certain actors to the pack folder at boot
|
||||
|
||||
|
||||
if (ArmourFolder.Nodes.Count != 0)
|
||||
editor.AddNode(ArmourFolder);
|
||||
if (EnemyFolder.Nodes.Count != 0)
|
||||
editor.AddNode(EnemyFolder);
|
||||
if (ItemsFolder.Nodes.Count != 0)
|
||||
editor.AddNode(ItemsFolder);
|
||||
if (WeaponsFolder.Nodes.Count != 0)
|
||||
editor.AddNode(WeaponsFolder);
|
||||
}
|
||||
|
||||
private bool NotifySetGamePath()
|
||||
{
|
||||
string dir = "";
|
||||
|
||||
var result = MessageBox.Show("Please set your game path for botw", "Actor Loader", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
FolderSelectDialog folderSelect = new FolderSelectDialog();
|
||||
if (folderSelect.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dir = folderSelect.SelectedPath;
|
||||
Runtime.BotwGamePath = dir;
|
||||
Config.Save();
|
||||
}
|
||||
}
|
||||
|
||||
return IsValidDirectory(dir);
|
||||
}
|
||||
|
||||
private bool IsValidDirectory(string directory)
|
||||
{
|
||||
bool HasActors = Directory.Exists($"{directory}\\Actor");
|
||||
return HasActors ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A container for multiple actors that link to each other.
|
||||
/// </summary>
|
||||
public class ActorCotainer : TreeNodeCustom
|
||||
{
|
||||
public List<ActorEntry> SubActors = new List<ActorEntry>();
|
||||
}
|
||||
|
||||
public class ActorEntry : TreeNodeCustom
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
|
||||
public ActorCategory Category { get; set; }
|
||||
|
||||
public ActorParameters Parameters { get; set; }
|
||||
public ActorModel Models { get; set; }
|
||||
public ActorTextures Textures { get; set; }
|
||||
|
||||
public void ReloadActorProperties()
|
||||
{
|
||||
Textures = new ActorTextures();
|
||||
Models = new ActorModel();
|
||||
Parameters = new ActorParameters();
|
||||
|
||||
//Load our texture paths if they exist
|
||||
|
||||
}
|
||||
|
||||
public override void OnClick(TreeView treeview)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ActorParameters
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ActorTextures
|
||||
{
|
||||
/// <summary>
|
||||
/// The file path for the main texture data (no mips for wii u)
|
||||
/// For Switch this stores both
|
||||
/// </summary>
|
||||
public string FilePathTex1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path for the mip map texture data (for wii u)
|
||||
/// </summary>
|
||||
public string FilePathTex2 { get; set; }
|
||||
}
|
||||
|
||||
public class ActorModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The file path that stores the model for an actor
|
||||
/// </summary>
|
||||
public string FilePathModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file path that stores the animation for an actor
|
||||
/// </summary>
|
||||
public string FilePathAnimation { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -201,6 +201,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Actors\BotwActorLoader.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="FileFormats\AAMP\AAMP.cs" />
|
||||
<Compile Include="FileFormats\Archives\APAK.cs" />
|
||||
@ -296,6 +297,12 @@
|
||||
<Compile Include="GL\GXToOpenGL.cs" />
|
||||
<Compile Include="GL\KCL_Render.cs" />
|
||||
<Compile Include="GL\LM2_Render.cs" />
|
||||
<Compile Include="GUI\ActorEditorBotw.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GUI\ActorEditorBotw.Designer.cs">
|
||||
<DependentUpon>ActorEditorBotw.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GUI\BFFNT\BffntEditor.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
37
File_Format_Library/GUI/ActorEditorBotw.Designer.cs
generated
Normal file
37
File_Format_Library/GUI/ActorEditorBotw.Designer.cs
generated
Normal file
@ -0,0 +1,37 @@
|
||||
namespace FirstPlugin.Forms
|
||||
{
|
||||
partial class ActorEditorBotw
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
21
File_Format_Library/GUI/ActorEditorBotw.cs
Normal file
21
File_Format_Library/GUI/ActorEditorBotw.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library.Forms;
|
||||
|
||||
namespace FirstPlugin.Forms
|
||||
{
|
||||
public partial class ActorEditorBotw : STUserControl
|
||||
{
|
||||
public ActorEditorBotw()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -101,6 +101,15 @@ namespace FirstPlugin
|
||||
|
||||
toolsExt[1] = new STToolStripItem("Mario Kart 8");
|
||||
toolsExt[1].DropDownItems.Add(new STToolStripItem("Probe Light Converter", GenerateProbeLightBounds));
|
||||
|
||||
|
||||
// toolsExt[2] = new STToolStripItem("Breath Of The Wild");
|
||||
// toolsExt[2].DropDownItems.Add(new STToolStripItem("Actor Editor", ActorEditor));
|
||||
}
|
||||
|
||||
private void ActorEditor(object sender, EventArgs args)
|
||||
{
|
||||
BotwActorLoader actorEditor = new BotwActorLoader();
|
||||
}
|
||||
|
||||
private void OpenKingdomSelector(object sender, EventArgs args)
|
||||
@ -274,7 +283,7 @@ namespace FirstPlugin
|
||||
private Type[] LoadMenus()
|
||||
{
|
||||
List<Type> MenuItems = new List<Type>();
|
||||
// MenuItems.Add(typeof(MenuExt));
|
||||
MenuItems.Add(typeof(MenuExt));
|
||||
return MenuItems.ToArray();
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ using OpenTK.Graphics.OpenGL;
|
||||
namespace Toolbox.Library
|
||||
{
|
||||
//Data from https://github.com/jam1garner/Smash-Forge/blob/master/Smash%20Forge/Filetypes/Textures/DDS.cs
|
||||
public class DDS : STGenericTexture, IFileFormat, ISingleTextureIconLoader, IContextMenuNode
|
||||
public class DDS : STGenericTexture, IFileFormat, IContextMenuNode
|
||||
{
|
||||
public STGenericTexture IconTexture { get { return this; } }
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user