1
0
mirror of synced 2024-11-12 10:10:50 +01:00

Add more editors

This commit is contained in:
KillzXGaming 2019-05-09 16:05:17 -04:00
parent d56e49f924
commit 880e48f35d
14 changed files with 82 additions and 10 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Switch_Toolbox;
using System.Windows.Forms;
using Switch_Toolbox.Library;
using Switch_Toolbox.Library.Forms;
using BcresLibrary;
namespace FirstPlugin
@ -74,15 +75,38 @@ namespace FirstPlugin
switch (Folder.Type)
{
case BCRESGroupType.Models:
Folder.AddNode(new CMDLWrapper((Model)section));
Folder.AddNode(new CMDLWrapper((Model)section) { BcresParent = this } );
break;
case BCRESGroupType.Textures:
Folder.AddNode(new TXOBWrapper((Texture)section));
Folder.AddNode(new TXOBWrapper((Texture)section) { BcresParent = this });
break;
}
}
}
public void LoadEditors(TreeNode Wrapper, Action OnPropertyChanged)
{
if (Wrapper is MTOBWrapper) {
LoadPropertyGrid(Wrapper, OnPropertyChanged);
}
if (Wrapper is CMDLWrapper) {
LoadPropertyGrid(Wrapper, OnPropertyChanged);
}
}
private void LoadPropertyGrid(object property, Action OnPropertyChanged)
{
STPropertyGrid editor = (STPropertyGrid)LibraryGUI.Instance.GetActiveContent(typeof(STPropertyGrid));
if (editor == null)
{
editor = new STPropertyGrid();
editor.Dock = DockStyle.Fill;
LibraryGUI.Instance.LoadEditor(editor);
}
editor.LoadProperty(property, OnPropertyChanged);
}
public void Unload()
{

View File

@ -12,6 +12,9 @@ namespace FirstPlugin
{
public class CMDLWrapper : STGenericModel
{
internal BCRES BcresParent;
internal Model Model;
public CMDLWrapper()
{
ImageKey = "Model";
@ -19,9 +22,12 @@ namespace FirstPlugin
}
public CMDLWrapper(Model model) : base() { LoadModel(model); }
internal Model Model;
public override void OnClick(TreeView treeview)
public override void OnClick(TreeView treeview) {
BcresParent.LoadEditors(this, OnPropertyChanged);
}
private void OnPropertyChanged()
{
}
@ -29,7 +35,6 @@ namespace FirstPlugin
public void LoadModel(Model model)
{
Model = model;
Text = model.Name;
}
}

View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Switch_Toolbox.Library;
using BcresLibrary;
namespace FirstPlugin
{
public class MTOBWrapper : STGenericMaterial
{
internal BCRES BcresParent;
internal Material Material;
public MTOBWrapper()
{
ImageKey = "Material";
SelectedImageKey = "Material";
}
public MTOBWrapper(Material material) : base() { Load(material); }
public override void OnClick(TreeView treeview) {
BcresParent.LoadEditors(this, OnPropertyChanged);
}
private void OnPropertyChanged()
{
}
public void Load(Material material)
{
Material = material;
Text = material.Name;
}
}
}

View File

@ -13,6 +13,9 @@ namespace FirstPlugin
{
public class TXOBWrapper : STGenericTexture
{
internal BCRES BcresParent;
internal Texture Texture;
public TXOBWrapper()
{
ImageKey = "Texture";
@ -20,7 +23,6 @@ namespace FirstPlugin
}
public TXOBWrapper(Texture texture) : base() { LoadTexture(texture); }
internal Texture Texture;
public override TEX_FORMAT[] SupportedFormats
{
@ -33,8 +35,7 @@ namespace FirstPlugin
}
}
public override void OnClick(TreeView treeview)
{
public override void OnClick(TreeView treeview) {
UpdateEditor();
}

View File

@ -208,7 +208,8 @@
<Compile Include="FileFormats\Audio\WAV.cs" />
<Compile Include="FileFormats\BCRES\BCRES.cs" />
<Compile Include="FileFormats\BCRES\Wrappers\BCRESGroupNode.cs" />
<Compile Include="FileFormats\BCRES\Wrappers\CMDLWrapper.cs" />
<Compile Include="FileFormats\BCRES\Wrappers\CMDL\CMDLWrapper.cs" />
<Compile Include="FileFormats\BCRES\Wrappers\CMDL\MTOBWrapper.cs" />
<Compile Include="FileFormats\BCRES\Wrappers\TXOBWrapper.cs" />
<Compile Include="FileFormats\BFRES\BFRESGroupNode.cs" />
<Compile Include="FileFormats\BFRES\BFRESAnimFolder.cs" />

View File

@ -1 +1 @@
7019283c1c03cb65fbd4a085da2cf5126b8f90da
928f89f7f6dfc0b9d93b0d3492830143335df5e0