Add an Update Bibo Materials button.

This commit is contained in:
Ottermandias 2022-08-10 15:45:14 +02:00
parent 5b07245cd9
commit f264725c45
4 changed files with 25 additions and 2 deletions

View file

@ -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 );

View file

@ -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" ) )

View file

@ -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;

View file

@ -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 )