mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +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,12 +207,15 @@ public class FileEditor<T>(
|
|||
var canSave = _changed && _currentFile is { Valid: true };
|
||||
if (ImGuiUtil.DrawDisabledButton("Save to File", Vector2.Zero,
|
||||
$"Save the selected {fileType} file with all changes applied. This is not revertible.", !canSave))
|
||||
{
|
||||
compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write());
|
||||
if (owner.Mod != null)
|
||||
communicator.ModFileChanged.Invoke(owner.Mod, _currentPath);
|
||||
_changed = false;
|
||||
}
|
||||
SaveFile();
|
||||
}
|
||||
|
||||
public void SaveFile()
|
||||
{
|
||||
compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write());
|
||||
if (owner.Mod != null)
|
||||
communicator.ModFileChanged.Invoke(owner.Mod, _currentPath);
|
||||
_changed = false;
|
||||
}
|
||||
|
||||
private void ResetButton()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Lumina.Data.Parsing;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Files;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Lumina.Data.Parsing;
|
|||
using OtterGui;
|
||||
using OtterGui.Custom;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData;
|
||||
using Penumbra.GameData.Files;
|
||||
|
|
@ -67,6 +68,7 @@ public partial class ModEditWindow
|
|||
{
|
||||
var ret = tab.Dirty;
|
||||
var data = UpdateFile(tab.Mdl, ret, disabled);
|
||||
DrawVersionUpdate(tab, disabled);
|
||||
DrawImportExport(tab, disabled);
|
||||
|
||||
ret |= DrawModelMaterialDetails(tab, disabled);
|
||||
|
|
@ -80,6 +82,19 @@ public partial class ModEditWindow
|
|||
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)
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("Import / Export"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue