diff --git a/Penumbra/Interop/Resolver/PathResolver.DrawObjectState.cs b/Penumbra/Interop/Resolver/PathResolver.DrawObjectState.cs index 41e55e2e..d51ffadd 100644 --- a/Penumbra/Interop/Resolver/PathResolver.DrawObjectState.cs +++ b/Penumbra/Interop/Resolver/PathResolver.DrawObjectState.cs @@ -143,7 +143,7 @@ public unsafe partial class PathResolver CreatingCharacterBase?.Invoke( ( IntPtr )LastGameObject, _lastCreatedCollection!, ( IntPtr )modelPtr, b, c ); } - var ret = _characterBaseCreateHook!.Original( a, b, c, d ); + var ret = _characterBaseCreateHook.Original( a, b, c, d ); if( LastGameObject != null ) { _drawObjectToObject[ ret ] = ( _lastCreatedCollection!, LastGameObject->ObjectIndex ); diff --git a/Penumbra/Mods/Editor/Mod.Editor.MdlMaterials.cs b/Penumbra/Mods/Editor/Mod.Editor.MdlMaterials.cs index 1f601ef4..f9ac3708 100644 --- a/Penumbra/Mods/Editor/Mod.Editor.MdlMaterials.cs +++ b/Penumbra/Mods/Editor/Mod.Editor.MdlMaterials.cs @@ -69,7 +69,7 @@ public partial class Mod } // Find all model files in the mod that contain skin materials. - private void ScanModels() + public void ScanModels() { _modelFiles.Clear(); foreach( var file in AvailableFiles.Where( f => f.File.Extension == ".mdl" ) ) diff --git a/Penumbra/UI/Classes/ModEditWindow.cs b/Penumbra/UI/Classes/ModEditWindow.cs index 898a98f2..0c7d8b9f 100644 --- a/Penumbra/UI/Classes/ModEditWindow.cs +++ b/Penumbra/UI/Classes/ModEditWindow.cs @@ -45,6 +45,9 @@ public partial class ModEditWindow : Window, IDisposable public void ChangeOption( ISubMod? subMod ) => _editor?.SetSubMod( subMod ); + public void UpdateModels() + => _editor?.ScanModels(); + public override bool DrawConditions() => _editor != null; diff --git a/Penumbra/UI/ConfigWindow.ModPanel.Edit.cs b/Penumbra/UI/ConfigWindow.ModPanel.Edit.cs index 2377bb77..b24a3f4e 100644 --- a/Penumbra/UI/ConfigWindow.ModPanel.Edit.cs +++ b/Penumbra/UI/ConfigWindow.ModPanel.Edit.cs @@ -93,6 +93,26 @@ public partial class ConfigWindow MoveDirectory.Draw( _mod, buttonSize ); ImGui.Dummy( _window._defaultSpace ); + DrawUpdateBibo( buttonSize ); + + ImGui.Dummy( _window._defaultSpace ); + } + + private void DrawUpdateBibo( Vector2 buttonSize) + { + if( ImGui.Button( "Update Bibo Material", buttonSize ) ) + { + var editor = new Mod.Editor( _mod, null ); + editor.ReplaceAllMaterials( "bibo", "b" ); + editor.ReplaceAllMaterials( "bibopube", "c" ); + editor.SaveAllModels(); + _window.ModEditPopup.UpdateModels(); + } + + ImGuiUtil.HoverTooltip( "For every model in this mod, change all material names that end in a _b or _c suffix to a _bibo or _bibopube suffix respectively.\n" + + "Does nothing if the mod does not contain any such models or no model contains such materials.\n" + + "Use this for outdated mods made for old Bibo bodies.\n" + + "Go to Advanced Editing for more fine-tuned control over material assignment." ); } private void BackupButtons( Vector2 buttonSize )