mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-18 14:44:29 +01:00
Add some migration stuff.
This commit is contained in:
parent
dc336569ff
commit
f9b5a626cf
6 changed files with 397 additions and 69 deletions
55
Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs
Normal file
55
Penumbra/UI/Tabs/Debug/ModMigratorDebug.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
using ImGuiNET;
|
||||
using OtterGui.Services;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.UI.Tabs.Debug;
|
||||
|
||||
public class ModMigratorDebug(ModMigrator migrator) : IUiService
|
||||
{
|
||||
private string _inputPath = string.Empty;
|
||||
private string _outputPath = string.Empty;
|
||||
private Task? _indexTask;
|
||||
private Task? _mdlTask;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (!ImUtf8.CollapsingHeaderId("Mod Migrator"u8))
|
||||
return;
|
||||
|
||||
ImUtf8.InputText("##input"u8, ref _inputPath, "Input Path..."u8);
|
||||
ImUtf8.InputText("##output"u8, ref _outputPath, "Output Path..."u8);
|
||||
|
||||
if (ImUtf8.ButtonEx("Create Index Texture"u8, "Requires input to be a path to a normal texture."u8, default, _inputPath.Length == 0
|
||||
|| _outputPath.Length == 0
|
||||
|| _indexTask is
|
||||
{
|
||||
IsCompleted: false,
|
||||
}))
|
||||
_indexTask = migrator.CreateIndexFile(_inputPath, _outputPath);
|
||||
|
||||
if (_indexTask is not null)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImUtf8.TextFrameAligned($"{_indexTask.Status}");
|
||||
}
|
||||
|
||||
if (ImUtf8.ButtonEx("Update Model File"u8, "Requires input to be a path to a mdl."u8, default, _inputPath.Length == 0
|
||||
|| _outputPath.Length == 0
|
||||
|| _mdlTask is
|
||||
{
|
||||
IsCompleted: false,
|
||||
}))
|
||||
_mdlTask = Task.Run(() =>
|
||||
{
|
||||
File.Copy(_inputPath, _outputPath, true);
|
||||
MigrationManager.TryMigrateSingleModel(_outputPath, false);
|
||||
});
|
||||
|
||||
if (_mdlTask is not null)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImUtf8.TextFrameAligned($"{_mdlTask.Status}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue