diff --git a/Penumbra/UI/AdvancedWindow/FileEditor.cs b/Penumbra/UI/AdvancedWindow/FileEditor.cs index eeb94c71..2c6ac170 100644 --- a/Penumbra/UI/AdvancedWindow/FileEditor.cs +++ b/Penumbra/UI/AdvancedWindow/FileEditor.cs @@ -207,12 +207,15 @@ public class FileEditor( 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() diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs index 72ab37b2..b05bcac2 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.MdlTab.cs @@ -1,4 +1,3 @@ -using Lumina.Data.Parsing; using OtterGui; using Penumbra.GameData; using Penumbra.GameData.Files; diff --git a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs index bbed64b7..de088736 100644 --- a/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs +++ b/Penumbra/UI/AdvancedWindow/ModEditWindow.Models.cs @@ -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"))