mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 21:24:18 +01:00
Scaffold tab file
This commit is contained in:
parent
27123f2a64
commit
f04b295989
3 changed files with 26 additions and 4 deletions
20
Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs
Normal file
20
Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,12 +9,14 @@ namespace Penumbra.UI.AdvancedWindow;
|
||||||
|
|
||||||
public partial class ModEditWindow
|
public partial class ModEditWindow
|
||||||
{
|
{
|
||||||
private readonly FileEditor<MdlFile> _modelTab;
|
private readonly FileEditor<MdlTab> _modelTab;
|
||||||
|
|
||||||
private static List<TagButtons> _submeshAttributeTagWidgets = new();
|
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);
|
var submeshTotal = file.Meshes.Aggregate(0, (count, mesh) => count + mesh.SubMeshCount);
|
||||||
if (_submeshAttributeTagWidgets.Count != submeshTotal)
|
if (_submeshAttributeTagWidgets.Count != submeshTotal)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -584,8 +584,8 @@ public partial class ModEditWindow : Window, IDisposable
|
||||||
_materialTab = new FileEditor<MtrlTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Materials", ".mtrl",
|
_materialTab = new FileEditor<MtrlTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Materials", ".mtrl",
|
||||||
() => PopulateIsOnPlayer(_editor.Files.Mtrl, ResourceType.Mtrl), DrawMaterialPanel, () => _mod?.ModPath.FullName ?? string.Empty,
|
() => PopulateIsOnPlayer(_editor.Files.Mtrl, ResourceType.Mtrl), DrawMaterialPanel, () => _mod?.ModPath.FullName ?? string.Empty,
|
||||||
(bytes, path, writable) => new MtrlTab(this, new MtrlFile(bytes), path, writable));
|
(bytes, path, writable) => new MtrlTab(this, new MtrlFile(bytes), path, writable));
|
||||||
_modelTab = new FileEditor<MdlFile>(this, gameData, config, _editor.Compactor, _fileDialog, "Models", ".mdl",
|
_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 MdlFile(bytes));
|
() => 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",
|
_shaderPackageTab = new FileEditor<ShpkTab>(this, gameData, config, _editor.Compactor, _fileDialog, "Shaders", ".shpk",
|
||||||
() => PopulateIsOnPlayer(_editor.Files.Shpk, ResourceType.Shpk), DrawShaderPackagePanel, () => _mod?.ModPath.FullName ?? string.Empty,
|
() => PopulateIsOnPlayer(_editor.Files.Shpk, ResourceType.Shpk), DrawShaderPackagePanel, () => _mod?.ModPath.FullName ?? string.Empty,
|
||||||
(bytes, _, _) => new ShpkTab(_fileDialog, bytes));
|
(bytes, _, _) => new ShpkTab(_fileDialog, bytes));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue