mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 13:14:17 +01:00
Add model update button.
This commit is contained in:
parent
4f0f3721a6
commit
0d939b12f4
3 changed files with 24 additions and 7 deletions
|
|
@ -207,13 +207,16 @@ public class FileEditor<T>(
|
||||||
var canSave = _changed && _currentFile is { Valid: true };
|
var canSave = _changed && _currentFile is { Valid: true };
|
||||||
if (ImGuiUtil.DrawDisabledButton("Save to File", Vector2.Zero,
|
if (ImGuiUtil.DrawDisabledButton("Save to File", Vector2.Zero,
|
||||||
$"Save the selected {fileType} file with all changes applied. This is not revertible.", !canSave))
|
$"Save the selected {fileType} file with all changes applied. This is not revertible.", !canSave))
|
||||||
|
SaveFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveFile()
|
||||||
{
|
{
|
||||||
compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write());
|
compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write());
|
||||||
if (owner.Mod != null)
|
if (owner.Mod != null)
|
||||||
communicator.ModFileChanged.Invoke(owner.Mod, _currentPath);
|
communicator.ModFileChanged.Invoke(owner.Mod, _currentPath);
|
||||||
_changed = false;
|
_changed = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void ResetButton()
|
private void ResetButton()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using Lumina.Data.Parsing;
|
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using Penumbra.GameData;
|
using Penumbra.GameData;
|
||||||
using Penumbra.GameData.Files;
|
using Penumbra.GameData.Files;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using Lumina.Data.Parsing;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Custom;
|
using OtterGui.Custom;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
using OtterGui.Text;
|
||||||
using OtterGui.Widgets;
|
using OtterGui.Widgets;
|
||||||
using Penumbra.GameData;
|
using Penumbra.GameData;
|
||||||
using Penumbra.GameData.Files;
|
using Penumbra.GameData.Files;
|
||||||
|
|
@ -67,6 +68,7 @@ public partial class ModEditWindow
|
||||||
{
|
{
|
||||||
var ret = tab.Dirty;
|
var ret = tab.Dirty;
|
||||||
var data = UpdateFile(tab.Mdl, ret, disabled);
|
var data = UpdateFile(tab.Mdl, ret, disabled);
|
||||||
|
DrawVersionUpdate(tab, disabled);
|
||||||
DrawImportExport(tab, disabled);
|
DrawImportExport(tab, disabled);
|
||||||
|
|
||||||
ret |= DrawModelMaterialDetails(tab, disabled);
|
ret |= DrawModelMaterialDetails(tab, disabled);
|
||||||
|
|
@ -80,6 +82,19 @@ public partial class ModEditWindow
|
||||||
return !disabled && ret;
|
return !disabled && ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawVersionUpdate(MdlTab tab, bool disabled)
|
||||||
|
{
|
||||||
|
if (disabled || tab.Mdl.Version is not MdlFile.V5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!ImUtf8.ButtonEx("Update MDL Version from V5 to V6"u8, "Try using this if the bone weights of a pre-Dawntrail model seem wrong.\n\nThis is not revertible."u8,
|
||||||
|
new Vector2(-0.1f, 0), false, 0, Colors.PressEnterWarningBg))
|
||||||
|
return;
|
||||||
|
|
||||||
|
tab.Mdl.ConvertV5ToV6();
|
||||||
|
_modelTab.SaveFile();
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawImportExport(MdlTab tab, bool disabled)
|
private void DrawImportExport(MdlTab tab, bool disabled)
|
||||||
{
|
{
|
||||||
if (!ImGui.CollapsingHeader("Import / Export"))
|
if (!ImGui.CollapsingHeader("Import / Export"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue