Scaffold tab file

This commit is contained in:
ackwell 2023-12-21 19:06:55 +11:00
parent 27123f2a64
commit f04b295989
3 changed files with 26 additions and 4 deletions

View file

@ -0,0 +1,20 @@
using Penumbra.GameData.Files;
namespace Penumbra.UI.AdvancedWindow;
public partial class ModEditWindow
{
private class MdlTab : IWritable
{
public readonly MdlFile Mdl;
public MdlTab(byte[] bytes)
{
Mdl = new MdlFile(bytes);
}
public bool Valid => Mdl.Valid;
public byte[] Write() => Mdl.Write();
}
}

View file

@ -9,12 +9,14 @@ namespace Penumbra.UI.AdvancedWindow;
public partial class ModEditWindow
{
private readonly FileEditor<MdlFile> _modelTab;
private readonly FileEditor<MdlTab> _modelTab;
private static List<TagButtons> _submeshAttributeTagWidgets = new();
private static bool DrawModelPanel(MdlFile file, bool disabled)
private static bool DrawModelPanel(MdlTab tab, bool disabled)
{
var file = tab.Mdl;
var submeshTotal = file.Meshes.Aggregate(0, (count, mesh) => count + mesh.SubMeshCount);
if (_submeshAttributeTagWidgets.Count != submeshTotal)
{

View file

@ -584,8 +584,8 @@ public partial class ModEditWindow : Window, IDisposable
_materialTab = new FileEditor<MtrlTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Materials", ".mtrl",
() => PopulateIsOnPlayer(_editor.Files.Mtrl, ResourceType.Mtrl), DrawMaterialPanel, () => _mod?.ModPath.FullName ?? string.Empty,
(bytes, path, writable) => new MtrlTab(this, new MtrlFile(bytes), path, writable));
_modelTab = new FileEditor<MdlFile>(this, gameData, config, _editor.Compactor, _fileDialog, "Models", ".mdl",
() => PopulateIsOnPlayer(_editor.Files.Mdl, ResourceType.Mdl), DrawModelPanel, () => _mod?.ModPath.FullName ?? string.Empty, (bytes, _, _) => new MdlFile(bytes));
_modelTab = new FileEditor<MdlTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Models", ".mdl",
() => PopulateIsOnPlayer(_editor.Files.Mdl, ResourceType.Mdl), DrawModelPanel, () => _mod?.ModPath.FullName ?? string.Empty, (bytes, _, _) => new MdlTab(bytes));
_shaderPackageTab = new FileEditor<ShpkTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Shaders", ".shpk",
() => PopulateIsOnPlayer(_editor.Files.Shpk, ResourceType.Shpk), DrawShaderPackagePanel, () => _mod?.ModPath.FullName ?? string.Empty,
(bytes, _, _) => new ShpkTab(_fileDialog, bytes));