mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add a bunch of help texts and expand on information.
This commit is contained in:
parent
3e5ea0d89c
commit
7f9ca5db76
10 changed files with 505 additions and 390 deletions
|
|
@ -32,6 +32,7 @@ namespace Penumbra
|
|||
public string ForcedCollection { get; set; } = "";
|
||||
|
||||
public bool SortFoldersFirst { get; set; } = false;
|
||||
public bool HasReadCharacterCollectionDesc { get; set; } = false;
|
||||
|
||||
public Dictionary< string, string > CharacterCollections { get; set; } = new();
|
||||
public Dictionary< string, string > ModSortOrder { get; set; } = new();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ namespace Penumbra.Interop
|
|||
}
|
||||
|
||||
// Forces the reload of a specific set of 85 files, notably containing the eqp, eqdp, gmp and est tables, by filename.
|
||||
public unsafe void ReloadPlayerResources()
|
||||
public unsafe void ReloadResidentResources()
|
||||
{
|
||||
ReloadCharacterResources();
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ namespace Penumbra.Meta
|
|||
ClearDirectory();
|
||||
if( reload )
|
||||
{
|
||||
_resourceManagement.ReloadPlayerResources();
|
||||
_resourceManagement.ReloadResidentResources();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class CollectionManager
|
|||
if( ActiveCollection.Cache?.MetaManipulations.Count > 0 || newActive.Cache?.MetaManipulations.Count > 0 )
|
||||
{
|
||||
var resourceManager = Service< ResidentResources >.Get();
|
||||
resourceManager.ReloadPlayerResources();
|
||||
resourceManager.ReloadResidentResources();
|
||||
}
|
||||
|
||||
ActiveCollection = newActive;
|
||||
|
|
@ -111,7 +111,7 @@ public class CollectionManager
|
|||
|
||||
if( reloadMeta && ActiveCollection.Settings.TryGetValue( mod.BasePath.Name, out var config ) && config.Enabled )
|
||||
{
|
||||
Service< ResidentResources >.Get().ReloadPlayerResources();
|
||||
Service< ResidentResources >.Get().ReloadResidentResources();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ public class CollectionManager
|
|||
{
|
||||
ActiveCollection = c;
|
||||
var resourceManager = Service< ResidentResources >.Get();
|
||||
resourceManager.ReloadPlayerResources();
|
||||
resourceManager.ReloadResidentResources();
|
||||
}
|
||||
|
||||
DefaultCollection = c;
|
||||
|
|
@ -242,7 +242,7 @@ public class CollectionManager
|
|||
{
|
||||
ActiveCollection = c;
|
||||
var resourceManager = Service< ResidentResources >.Get();
|
||||
resourceManager.ReloadPlayerResources();
|
||||
resourceManager.ReloadResidentResources();
|
||||
}
|
||||
|
||||
CharacterCollection[ characterName ] = c;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace Penumbra.Mods
|
|||
Cache.UpdateMetaManipulations();
|
||||
if( activeCollection )
|
||||
{
|
||||
Service< ResidentResources >.Get().ReloadPlayerResources();
|
||||
Service< ResidentResources >.Get().ReloadResidentResources();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Penumbra
|
|||
ResourceLoader.Init();
|
||||
ResourceLoader.Enable();
|
||||
|
||||
gameUtils.ReloadPlayerResources();
|
||||
gameUtils.ReloadResidentResources();
|
||||
|
||||
SettingsInterface = new SettingsInterface( this );
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ namespace Penumbra
|
|||
}
|
||||
|
||||
Config.IsEnabled = true;
|
||||
Service< ResidentResources >.Get().ReloadPlayerResources();
|
||||
Service< ResidentResources >.Get().ReloadResidentResources();
|
||||
if( Config.EnablePlayerWatch )
|
||||
{
|
||||
PlayerWatcher.SetStatus( true );
|
||||
|
|
@ -117,7 +117,7 @@ namespace Penumbra
|
|||
}
|
||||
|
||||
Config.IsEnabled = false;
|
||||
Service< ResidentResources >.Get().ReloadPlayerResources();
|
||||
Service< ResidentResources >.Get().ReloadResidentResources();
|
||||
if( Config.EnablePlayerWatch )
|
||||
{
|
||||
PlayerWatcher.SetStatus( false );
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Logging;
|
||||
using ImGuiNET;
|
||||
using Penumbra.Mod;
|
||||
|
|
@ -10,293 +11,390 @@ using Penumbra.Mods;
|
|||
using Penumbra.UI.Custom;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.UI
|
||||
namespace Penumbra.UI;
|
||||
|
||||
public partial class SettingsInterface
|
||||
{
|
||||
public partial class SettingsInterface
|
||||
private class TabCollections
|
||||
{
|
||||
private class TabCollections
|
||||
private const string CharacterCollectionHelpPopup = "Character Collection Information";
|
||||
private readonly Selector _selector;
|
||||
private readonly ModManager _manager;
|
||||
private string _collectionNames = null!;
|
||||
private string _collectionNamesWithNone = null!;
|
||||
private ModCollection[] _collections = null!;
|
||||
private int _currentCollectionIndex;
|
||||
private int _currentForcedIndex;
|
||||
private int _currentDefaultIndex;
|
||||
private readonly Dictionary< string, int > _currentCharacterIndices = new();
|
||||
private string _newCollectionName = string.Empty;
|
||||
private string _newCharacterName = string.Empty;
|
||||
|
||||
private void UpdateNames()
|
||||
{
|
||||
public const string LabelCurrentCollection = "Current Collection";
|
||||
private readonly Selector _selector;
|
||||
private readonly ModManager _manager;
|
||||
private string _collectionNames = null!;
|
||||
private string _collectionNamesWithNone = null!;
|
||||
private ModCollection[] _collections = null!;
|
||||
private int _currentCollectionIndex;
|
||||
private int _currentForcedIndex;
|
||||
private int _currentDefaultIndex;
|
||||
private readonly Dictionary< string, int > _currentCharacterIndices = new();
|
||||
private string _newCollectionName = string.Empty;
|
||||
private string _newCharacterName = string.Empty;
|
||||
_collections = _manager.Collections.Collections.Values.Prepend( ModCollection.Empty ).ToArray();
|
||||
_collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0';
|
||||
_collectionNamesWithNone = "None\0" + _collectionNames;
|
||||
UpdateIndices();
|
||||
}
|
||||
|
||||
private void UpdateNames()
|
||||
|
||||
private int GetIndex( ModCollection collection )
|
||||
{
|
||||
var ret = _collections.IndexOf( c => c.Name == collection.Name );
|
||||
if( ret < 0 )
|
||||
{
|
||||
_collections = _manager.Collections.Collections.Values.Prepend( ModCollection.Empty ).ToArray();
|
||||
_collectionNames = string.Join( "\0", _collections.Skip( 1 ).Select( c => c.Name ) ) + '\0';
|
||||
_collectionNamesWithNone = "None\0" + _collectionNames;
|
||||
UpdateIndices();
|
||||
PluginLog.Error( $"Collection {collection.Name} is not found in collections." );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int GetIndex( ModCollection collection )
|
||||
private void UpdateIndex()
|
||||
=> _currentCollectionIndex = GetIndex( _manager.Collections.CurrentCollection ) - 1;
|
||||
|
||||
private void UpdateForcedIndex()
|
||||
=> _currentForcedIndex = GetIndex( _manager.Collections.ForcedCollection );
|
||||
|
||||
private void UpdateDefaultIndex()
|
||||
=> _currentDefaultIndex = GetIndex( _manager.Collections.DefaultCollection );
|
||||
|
||||
private void UpdateCharacterIndices()
|
||||
{
|
||||
_currentCharacterIndices.Clear();
|
||||
foreach( var kvp in _manager.Collections.CharacterCollection )
|
||||
{
|
||||
var ret = _collections.IndexOf( c => c.Name == collection.Name );
|
||||
if( ret < 0 )
|
||||
{
|
||||
PluginLog.Error( $"Collection {collection.Name} is not found in collections." );
|
||||
return 0;
|
||||
}
|
||||
_currentCharacterIndices[ kvp.Key ] = GetIndex( kvp.Value );
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
private void UpdateIndices()
|
||||
{
|
||||
UpdateIndex();
|
||||
UpdateDefaultIndex();
|
||||
UpdateForcedIndex();
|
||||
UpdateCharacterIndices();
|
||||
}
|
||||
|
||||
public TabCollections( Selector selector )
|
||||
{
|
||||
_selector = selector;
|
||||
_manager = Service< ModManager >.Get();
|
||||
UpdateNames();
|
||||
}
|
||||
|
||||
private void CreateNewCollection( Dictionary< string, ModSettings > settings )
|
||||
{
|
||||
if( _manager.Collections.AddCollection( _newCollectionName, settings ) )
|
||||
{
|
||||
UpdateNames();
|
||||
SetCurrentCollection( _manager.Collections.Collections[ _newCollectionName ], true );
|
||||
}
|
||||
|
||||
private void UpdateIndex()
|
||||
=> _currentCollectionIndex = GetIndex( _manager.Collections.CurrentCollection ) - 1;
|
||||
_newCollectionName = string.Empty;
|
||||
}
|
||||
|
||||
private void UpdateForcedIndex()
|
||||
=> _currentForcedIndex = GetIndex( _manager.Collections.ForcedCollection );
|
||||
|
||||
private void UpdateDefaultIndex()
|
||||
=> _currentDefaultIndex = GetIndex( _manager.Collections.DefaultCollection );
|
||||
|
||||
private void UpdateCharacterIndices()
|
||||
private void DrawCleanCollectionButton()
|
||||
{
|
||||
if( ImGui.Button( "Clean Settings" ) )
|
||||
{
|
||||
_currentCharacterIndices.Clear();
|
||||
foreach( var kvp in _manager.Collections.CharacterCollection )
|
||||
{
|
||||
_currentCharacterIndices[ kvp.Key ] = GetIndex( kvp.Value );
|
||||
}
|
||||
var changes = ModFunctions.CleanUpCollection( _manager.Collections.CurrentCollection.Settings,
|
||||
_manager.BasePath.EnumerateDirectories() );
|
||||
_manager.Collections.CurrentCollection.UpdateSettings( changes );
|
||||
}
|
||||
|
||||
private void UpdateIndices()
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"Remove all stored settings for mods not currently available and fix invalid settings.\nUse at own risk." );
|
||||
}
|
||||
|
||||
private void DrawNewCollectionInput()
|
||||
{
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
ImGui.InputTextWithHint( "##New Collection", "New Collection Name", ref _newCollectionName, 64 );
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"A collection is a set of settings for your installed mods, including their enabled status, their priorities and their mod-specific configuration.\n"
|
||||
+ "You can use multiple collections to quickly switch between sets of mods." );
|
||||
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, _newCollectionName.Length == 0 );
|
||||
|
||||
if( ImGui.Button( "Create New Empty Collection" ) && _newCollectionName.Length > 0 )
|
||||
{
|
||||
UpdateIndex();
|
||||
UpdateDefaultIndex();
|
||||
UpdateForcedIndex();
|
||||
UpdateCharacterIndices();
|
||||
CreateNewCollection( new Dictionary< string, ModSettings >() );
|
||||
}
|
||||
|
||||
public TabCollections( Selector selector )
|
||||
var hover = ImGui.IsItemHovered();
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( "Duplicate Current Collection" ) && _newCollectionName.Length > 0 )
|
||||
{
|
||||
_selector = selector;
|
||||
_manager = Service< ModManager >.Get();
|
||||
CreateNewCollection( _manager.Collections.CurrentCollection.Settings );
|
||||
}
|
||||
|
||||
hover |= ImGui.IsItemHovered();
|
||||
|
||||
style.Pop();
|
||||
if( _newCollectionName.Length == 0 && hover )
|
||||
{
|
||||
ImGui.SetTooltip( "Please enter a name before creating a collection." );
|
||||
}
|
||||
|
||||
var deleteCondition = _manager.Collections.Collections.Count > 1
|
||||
&& _manager.Collections.CurrentCollection.Name != ModCollection.DefaultCollection;
|
||||
ImGui.SameLine();
|
||||
if( ImGuiCustom.DisableButton( "Delete Current Collection", deleteCondition ) )
|
||||
{
|
||||
_manager.Collections.RemoveCollection( _manager.Collections.CurrentCollection.Name );
|
||||
SetCurrentCollection( _manager.Collections.CurrentCollection, true );
|
||||
UpdateNames();
|
||||
}
|
||||
|
||||
private void CreateNewCollection( Dictionary< string, ModSettings > settings )
|
||||
if( !deleteCondition )
|
||||
{
|
||||
if( _manager.Collections.AddCollection( _newCollectionName, settings ) )
|
||||
{
|
||||
UpdateNames();
|
||||
SetCurrentCollection( _manager.Collections.Collections[ _newCollectionName ], true );
|
||||
}
|
||||
|
||||
_newCollectionName = string.Empty;
|
||||
ImGuiCustom.HoverTooltip( "You can not delete the default collection." );
|
||||
}
|
||||
|
||||
private void DrawCleanCollectionButton()
|
||||
if( Penumbra.Config.ShowAdvanced )
|
||||
{
|
||||
if( ImGui.Button( "Clean Settings" ) )
|
||||
{
|
||||
var changes = ModFunctions.CleanUpCollection( _manager.Collections.CurrentCollection.Settings,
|
||||
_manager.BasePath.EnumerateDirectories() );
|
||||
_manager.Collections.CurrentCollection.UpdateSettings( changes );
|
||||
}
|
||||
ImGui.SameLine();
|
||||
DrawCleanCollectionButton();
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"Remove all stored settings for mods not currently available and fix invalid settings.\nUse at own risk." );
|
||||
private void SetCurrentCollection( int idx, bool force )
|
||||
{
|
||||
if( !force && idx == _currentCollectionIndex )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
private void DrawNewCollectionInput()
|
||||
_manager.Collections.SetCurrentCollection( _collections[ idx + 1 ] );
|
||||
_currentCollectionIndex = idx;
|
||||
_selector.Cache.TriggerListReset();
|
||||
if( _selector.Mod != null )
|
||||
{
|
||||
ImGui.InputTextWithHint( "##New Collection", "New Collection", ref _newCollectionName, 64 );
|
||||
_selector.SelectModOnUpdate( _selector.Mod.Data.BasePath.Name );
|
||||
}
|
||||
}
|
||||
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, _newCollectionName.Length == 0 );
|
||||
public void SetCurrentCollection( ModCollection collection, bool force = false )
|
||||
{
|
||||
var idx = Array.IndexOf( _collections, collection ) - 1;
|
||||
if( idx >= 0 )
|
||||
{
|
||||
SetCurrentCollection( idx, force );
|
||||
}
|
||||
}
|
||||
|
||||
if( ImGui.Button( "Create New Empty Collection" ) && _newCollectionName.Length > 0 )
|
||||
public void DrawCurrentCollectionSelector( bool tooltip )
|
||||
{
|
||||
var index = _currentCollectionIndex;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
var combo = ImGui.Combo( "Current Collection", ref index, _collectionNames );
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"This collection will be modified when using the Installed Mods tab and making changes. It does not apply to anything by itself." );
|
||||
|
||||
if( combo )
|
||||
{
|
||||
SetCurrentCollection( index, false );
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDefaultCollectionSelector()
|
||||
{
|
||||
var index = _currentDefaultIndex;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
if( ImGui.Combo( "##Default Collection", ref index, _collectionNamesWithNone ) && index != _currentDefaultIndex )
|
||||
{
|
||||
_manager.Collections.SetDefaultCollection( _collections[ index ] );
|
||||
_currentDefaultIndex = index;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n"
|
||||
+ "They also take precedence before the forced collection." );
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( "Default Collection" );
|
||||
}
|
||||
|
||||
private void DrawForcedCollectionSelector()
|
||||
{
|
||||
var index = _currentForcedIndex;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.Alpha, 0.5f, _manager.Collections.CharacterCollection.Count == 0 );
|
||||
if( ImGui.Combo( "##Forced Collection", ref index, _collectionNamesWithNone )
|
||||
&& index != _currentForcedIndex
|
||||
&& _manager.Collections.CharacterCollection.Count > 0 )
|
||||
{
|
||||
_manager.Collections.SetForcedCollection( _collections[ index ] );
|
||||
_currentForcedIndex = index;
|
||||
}
|
||||
|
||||
style.Pop();
|
||||
if( _manager.Collections.CharacterCollection.Count == 0 && ImGui.IsItemHovered() )
|
||||
{
|
||||
ImGui.SetTooltip(
|
||||
"Forced Collections only provide value if you have at least one Character Collection. There is no need to set one until then." );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"Mods in the forced collection are always loaded if not overwritten by anything in the current or character-based collection.\n"
|
||||
+ "Please avoid mixing meta-manipulating mods in Forced and other collections, as this will probably not work correctly." );
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( "Forced Collection" );
|
||||
}
|
||||
|
||||
private void DrawNewCharacterCollection()
|
||||
{
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
ImGui.InputTextWithHint( "##New Character", "New Character Name", ref _newCharacterName, 32 );
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Click Me for Information!" );
|
||||
ImGui.OpenPopupOnItemClick( CharacterCollectionHelpPopup, ImGuiPopupFlags.MouseButtonLeft );
|
||||
|
||||
ImGui.SameLine();
|
||||
if( ImGuiCustom.DisableButton( "Create New Character Collection",
|
||||
_newCharacterName.Length > 0 && Penumbra.Config.HasReadCharacterCollectionDesc ) )
|
||||
{
|
||||
_manager.Collections.CreateCharacterCollection( _newCharacterName );
|
||||
_currentCharacterIndices[ _newCharacterName ] = 0;
|
||||
_newCharacterName = string.Empty;
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip( "Please enter a Character name before creating the collection.\n"
|
||||
+ "You also need to have read the help text for character collections." );
|
||||
|
||||
DrawCharacterCollectionHelp();
|
||||
}
|
||||
|
||||
private static void DrawCharacterCollectionHelp()
|
||||
{
|
||||
var size = new Vector2( 700 * ImGuiHelpers.GlobalScale, 34 * ImGui.GetTextLineHeightWithSpacing() );
|
||||
ImGui.SetNextWindowPos( ImGui.GetMainViewport().GetCenter(), ImGuiCond.Appearing, Vector2.One / 2 );
|
||||
ImGui.SetNextWindowSize( size, ImGuiCond.Appearing );
|
||||
var _ = true;
|
||||
if( ImGui.BeginPopupModal( CharacterCollectionHelpPopup, ref _, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove ) )
|
||||
{
|
||||
const string header = "Character Collections are a Hack! Use them at your own risk.";
|
||||
using var end = ImGuiRaii.DeferredEnd( ImGui.EndPopup );
|
||||
var textWidth = ImGui.CalcTextSize( header ).X;
|
||||
ImGui.NewLine();
|
||||
ImGui.SetCursorPosX( ( size.X - textWidth ) / 2 );
|
||||
using var color = ImGuiRaii.PushColor( ImGuiCol.Text, 0xFF0000B8 );
|
||||
ImGui.Text( header );
|
||||
color.Pop();
|
||||
ImGui.NewLine();
|
||||
ImGui.TextWrapped(
|
||||
"Character Collections are collections that get applied whenever the named character gets redrawn by Penumbra,"
|
||||
+ " whether by a manual '/penumbra redraw' command, or by the automatic redrawing feature.\n"
|
||||
+ "This means that they specifically require redrawing of a character to even apply, and thus can not work with mods that modify something that does not depend on characters being drawn, such as:\n"
|
||||
+ " - animations\n"
|
||||
+ " - sounds\n"
|
||||
+ " - most effects\n"
|
||||
+ " - most ui elements.\n"
|
||||
+ "They can also not work with actors that are not named, like the Character Preview or TryOn Actors, and they can not work in cutscenes, since redrawing in cutscenes would cancel all animations.\n"
|
||||
+ "They also do not work with every character customization (like skin, tattoo, hair, etc. changes) since those are not always re-requested by the game on redrawing a player. They may work, they may not, you need to test it.\n"
|
||||
+ "\n"
|
||||
+ "Due to the nature of meta manipulating mods, you can not mix meta manipulations inside a Character (or the Default) collection with meta manipulations inside the Forced collection.\n"
|
||||
+ "\n"
|
||||
+ "To verify that you have actually read this, you need to hold control and shift while clicking the Understood button for it to take effect.\n"
|
||||
+ "Due to the nature of redrawing being a hack, weird things (or maybe even crashes) may happen when using Character Collections. The way this works is:\n"
|
||||
+ " - Penumbra queues a redraw of an actor.\n"
|
||||
+ " - When the redraw queue reaches that actor, the actor gets undrawn (turned invisible).\n"
|
||||
+ " - Penumbra checks the actors name and if it matches a Character Collection, it replaces the Default collection with that one.\n"
|
||||
+ " - Penumbra triggers the redraw of that actor. The game requests files.\n"
|
||||
+ " - Penumbra potentially redirects those file requests to the modded files in the active collection, which is either Default or Character. (Or, afterwards, Forced).\n"
|
||||
+ " - The actor is drawn.\n"
|
||||
+ " - Penumbra returns the active collection to the Default Collection.\n"
|
||||
+ "If any of those steps fails, or if the file requests take too long, it may happen that a character is drawn with half of its models from the Default and the other half from the Character Collection, or a modded Model is loaded, but not its corresponding modded textures, which lets it stay invisible, or similar problems." );
|
||||
|
||||
var buttonSize = ImGuiHelpers.ScaledVector2( 150, 0 );
|
||||
var offset = ( size.X - buttonSize.X ) / 2;
|
||||
ImGui.SetCursorPos( new Vector2( offset, size.Y - 3 * ImGui.GetTextLineHeightWithSpacing() ) );
|
||||
var state = ImGui.GetIO().KeyCtrl && ImGui.GetIO().KeyShift;
|
||||
color.Push( ImGuiCol.ButtonHovered, 0xFF00A000, state );
|
||||
if( ImGui.Button( "Understood!", buttonSize ) )
|
||||
{
|
||||
CreateNewCollection( new Dictionary< string, ModSettings >() );
|
||||
if( state && !Penumbra.Config.HasReadCharacterCollectionDesc )
|
||||
{
|
||||
Penumbra.Config.HasReadCharacterCollectionDesc = true;
|
||||
Penumbra.Config.Save();
|
||||
}
|
||||
|
||||
ImGui.CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawCharacterCollectionSelectors()
|
||||
{
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndChild );
|
||||
if( !ImGui.BeginChild( "##CollectionChild", AutoFillSize, true ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawDefaultCollectionSelector();
|
||||
DrawForcedCollectionSelector();
|
||||
|
||||
foreach( var name in _manager.Collections.CharacterCollection.Keys.ToArray() )
|
||||
{
|
||||
var idx = _currentCharacterIndices[ name ];
|
||||
var tmp = idx;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
if( ImGui.Combo( $"##{name}collection", ref tmp, _collectionNamesWithNone ) && idx != tmp )
|
||||
{
|
||||
_manager.Collections.SetCharacterCollection( name, _collections[ tmp ] );
|
||||
_currentCharacterIndices[ name ] = tmp;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( "Duplicate Current Collection" ) && _newCollectionName.Length > 0 )
|
||||
|
||||
using var font = ImGuiRaii.PushFont( UiBuilder.IconFont );
|
||||
|
||||
using var style = ImGuiRaii.PushStyle( ImGuiStyleVar.FramePadding, Vector2.One * ImGuiHelpers.GlobalScale * 1.5f );
|
||||
if( ImGui.Button( $"{FontAwesomeIcon.Trash.ToIconString()}##{name}" ) )
|
||||
{
|
||||
CreateNewCollection( _manager.Collections.CurrentCollection.Settings );
|
||||
_manager.Collections.RemoveCharacterCollection( name );
|
||||
}
|
||||
|
||||
style.Pop();
|
||||
|
||||
var deleteCondition = _manager.Collections.Collections.Count > 1
|
||||
&& _manager.Collections.CurrentCollection.Name != ModCollection.DefaultCollection;
|
||||
ImGui.SameLine();
|
||||
if( ImGuiCustom.DisableButton( "Delete Current Collection", deleteCondition ) )
|
||||
{
|
||||
_manager.Collections.RemoveCollection( _manager.Collections.CurrentCollection.Name );
|
||||
SetCurrentCollection( _manager.Collections.CurrentCollection, true );
|
||||
UpdateNames();
|
||||
}
|
||||
|
||||
if( Penumbra.Config.ShowAdvanced )
|
||||
{
|
||||
ImGui.SameLine();
|
||||
DrawCleanCollectionButton();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCurrentCollection( int idx, bool force )
|
||||
{
|
||||
if( !force && idx == _currentCollectionIndex )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_manager.Collections.SetCurrentCollection( _collections[ idx + 1 ] );
|
||||
_currentCollectionIndex = idx;
|
||||
_selector.Cache.TriggerListReset();
|
||||
if( _selector.Mod != null )
|
||||
{
|
||||
_selector.SelectModOnUpdate( _selector.Mod.Data.BasePath.Name );
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCurrentCollection( ModCollection collection, bool force = false )
|
||||
{
|
||||
var idx = Array.IndexOf( _collections, collection ) - 1;
|
||||
if( idx >= 0 )
|
||||
{
|
||||
SetCurrentCollection( idx, force );
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawCurrentCollectionSelector( bool tooltip )
|
||||
{
|
||||
var index = _currentCollectionIndex;
|
||||
var combo = ImGui.Combo( LabelCurrentCollection, ref index, _collectionNames );
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"This collection will be modified when using the Installed Mods tab and making changes. It does not apply to anything by itself." );
|
||||
|
||||
if( combo )
|
||||
{
|
||||
SetCurrentCollection( index, false );
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawDefaultCollectionSelector()
|
||||
{
|
||||
var index = _currentDefaultIndex;
|
||||
if( ImGui.Combo( "##Default Collection", ref index, _collectionNamesWithNone ) && index != _currentDefaultIndex )
|
||||
{
|
||||
_manager.Collections.SetDefaultCollection( _collections[ index ] );
|
||||
_currentDefaultIndex = index;
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n"
|
||||
+ "They also take precedence before the forced collection." );
|
||||
font.Pop();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy( 24, 0 );
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( "Default Collection" );
|
||||
ImGui.Text( name );
|
||||
}
|
||||
|
||||
private void DrawForcedCollectionSelector()
|
||||
DrawNewCharacterCollection();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if( !ImGui.BeginTabItem( "Collections" ) )
|
||||
{
|
||||
var index = _currentForcedIndex;
|
||||
if( ImGui.Combo( "##Forced Collection", ref index, _collectionNamesWithNone ) && index != _currentForcedIndex )
|
||||
{
|
||||
_manager.Collections.SetForcedCollection( _collections[ index ] );
|
||||
_currentForcedIndex = index;
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"Mods in the forced collection are always loaded if not overwritten by anything in the current or character-based collection.\n"
|
||||
+ "Please avoid mixing meta-manipulating mods in Forced and other collections, as this will probably not work correctly." );
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy( 24, 0 );
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( "Forced Collection" );
|
||||
return;
|
||||
}
|
||||
|
||||
private void DrawNewCharacterCollection()
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndTabItem )
|
||||
.Push( ImGui.EndChild );
|
||||
|
||||
if( ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) )
|
||||
{
|
||||
ImGui.InputTextWithHint( "##New Character", "New Character Name", ref _newCharacterName, 32 );
|
||||
DrawCurrentCollectionSelector( true );
|
||||
|
||||
ImGui.SameLine();
|
||||
if( ImGuiCustom.DisableButton( "Create New Character Collection", _newCharacterName.Length > 0 ) )
|
||||
{
|
||||
_manager.Collections.CreateCharacterCollection( _newCharacterName );
|
||||
_currentCharacterIndices[ _newCharacterName ] = 0;
|
||||
_newCharacterName = string.Empty;
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"A character collection will be used whenever you manually redraw a character with the Name you have set up.\n"
|
||||
+ "If you enable automatic character redraws in the Settings tab, penumbra will try to use Character collections for corresponding characters automatically.\n" );
|
||||
ImGuiHelpers.ScaledDummy( 0, 10 );
|
||||
DrawNewCollectionInput();
|
||||
}
|
||||
|
||||
raii.Pop();
|
||||
|
||||
private void DrawCharacterCollectionSelectors()
|
||||
{
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndChild );
|
||||
if( !ImGui.BeginChild( "##CollectionChild", AutoFillSize, true ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawDefaultCollectionSelector();
|
||||
DrawForcedCollectionSelector();
|
||||
|
||||
foreach( var name in _manager.Collections.CharacterCollection.Keys.ToArray() )
|
||||
{
|
||||
var idx = _currentCharacterIndices[ name ];
|
||||
var tmp = idx;
|
||||
if( ImGui.Combo( $"##{name}collection", ref tmp, _collectionNamesWithNone ) && idx != tmp )
|
||||
{
|
||||
_manager.Collections.SetCharacterCollection( name, _collections[ tmp ] );
|
||||
_currentCharacterIndices[ name ] = tmp;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
using var font = ImGuiRaii.PushFont( UiBuilder.IconFont );
|
||||
if( ImGui.Button( $"{FontAwesomeIcon.Trash.ToIconString()}##{name}" ) )
|
||||
{
|
||||
_manager.Collections.RemoveCharacterCollection( name );
|
||||
}
|
||||
|
||||
font.Pop();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.Text( name );
|
||||
}
|
||||
|
||||
DrawNewCharacterCollection();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if( !ImGui.BeginTabItem( "Collections" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.EndTabItem )
|
||||
.Push( ImGui.EndChild );
|
||||
|
||||
if( ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) )
|
||||
{
|
||||
DrawCurrentCollectionSelector( true );
|
||||
|
||||
ImGuiHelpers.ScaledDummy( 0, 10 );
|
||||
DrawNewCollectionInput();
|
||||
}
|
||||
|
||||
raii.Pop();
|
||||
|
||||
DrawCharacterCollectionSelectors();
|
||||
}
|
||||
DrawCharacterCollectionSelectors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -616,7 +616,7 @@ namespace Penumbra.UI
|
|||
const float size = 200;
|
||||
|
||||
DrawModsSelectorFilter();
|
||||
var textSize = ImGui.CalcTextSize( TabCollections.LabelCurrentCollection ).X + ImGui.GetStyle().ItemInnerSpacing.X;
|
||||
var textSize = ImGui.CalcTextSize( "Current Collection" ).X + ImGui.GetStyle().ItemInnerSpacing.X;
|
||||
var comboSize = size * ImGui.GetIO().FontGlobalScale;
|
||||
var offset = comboSize + textSize;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Logging;
|
||||
using ImGuiNET;
|
||||
using Penumbra.Interop;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.UI.Custom;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
@ -18,24 +18,6 @@ public partial class SettingsInterface
|
|||
{
|
||||
private class TabSettings
|
||||
{
|
||||
private const string LabelTab = "Settings";
|
||||
private const string LabelRootFolder = "Root Folder";
|
||||
private const string LabelTempFolder = "Temporary Folder";
|
||||
private const string LabelRediscoverButton = "Rediscover Mods";
|
||||
private const string LabelOpenFolder = "Open Mods Folder";
|
||||
private const string LabelOpenTempFolder = "Open Temporary Folder";
|
||||
private const string LabelEnabled = "Enable Mods";
|
||||
private const string LabelEnabledPlayerWatch = "Enable automatic Character Redraws";
|
||||
private const string LabelWaitFrames = "Wait Frames";
|
||||
private const string LabelSortFoldersFirst = "Sort Mod Folders Before Mods";
|
||||
private const string LabelScaleModSelector = "Scale Mod Selector With Window Size";
|
||||
private const string LabelShowAdvanced = "Show Advanced Settings";
|
||||
private const string LabelLogLoadedFiles = "Log all loaded files";
|
||||
private const string LabelDisableNotifications = "Disable filesystem change notifications";
|
||||
private const string LabelEnableHttpApi = "Enable HTTP API";
|
||||
private const string LabelReloadResource = "Reload Player Resource";
|
||||
private const string LabelManageModsOffset = "\"Manage mods\"-Button Offset";
|
||||
|
||||
private readonly SettingsInterface _base;
|
||||
private readonly Configuration _config;
|
||||
private bool _configChanged;
|
||||
|
|
@ -52,17 +34,46 @@ public partial class SettingsInterface
|
|||
_newTempDirectory = _config.TempDirectory;
|
||||
}
|
||||
|
||||
private static bool DrawPressEnterWarning( string old, float? width = null )
|
||||
private static bool DrawPressEnterWarning( string old )
|
||||
{
|
||||
const uint red = 0xFF202080;
|
||||
using var color = ImGuiRaii.PushColor( ImGuiCol.Button, red );
|
||||
var w = Vector2.UnitX * ( width ?? ImGui.CalcItemWidth() );
|
||||
var w = Vector2.UnitX * ImGui.CalcItemWidth();
|
||||
return ImGui.Button( $"Press Enter or Click Here to Save (Current Directory: {old})", w );
|
||||
}
|
||||
|
||||
private static void DrawOpenDirectoryButton( int id, DirectoryInfo directory, bool condition )
|
||||
{
|
||||
ImGui.PushID( id );
|
||||
var ret = ImGui.Button( "Open Directory" );
|
||||
ImGuiCustom.HoverTooltip( "Open this directory in your configured file explorer." );
|
||||
if( ret && condition && Directory.Exists( directory.FullName ) )
|
||||
{
|
||||
Process.Start( new ProcessStartInfo( directory.FullName )
|
||||
{
|
||||
UseShellExecute = true,
|
||||
} );
|
||||
}
|
||||
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
||||
private void DrawRootFolder()
|
||||
{
|
||||
var save = ImGui.InputText( LabelRootFolder, ref _newModDirectory, 255, ImGuiInputTextFlags.EnterReturnsTrue );
|
||||
ImGui.BeginGroup();
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
var save = ImGui.InputText( "Root Directory", ref _newModDirectory, 255, ImGuiInputTextFlags.EnterReturnsTrue );
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "This is where Penumbra will store your extracted mod files.\n"
|
||||
+ "TTMP files are not copied, just extracted.\n"
|
||||
+ "This directory needs to be accessible and you need write access here.\n"
|
||||
+ "It is recommended that this directory is placed on a fast hard drive, preferably an SSD.\n"
|
||||
+ "It should also be placed near the root of a logical drive - the shorter the total path to this folder, the better.\n"
|
||||
+ "Definitely do not place it in your Dalamud directory or any sub-directory thereof." );
|
||||
ImGui.SameLine();
|
||||
DrawOpenDirectoryButton( 0, _base._modManager.BasePath, _base._modManager.Valid );
|
||||
ImGui.EndGroup();
|
||||
|
||||
if( _config.ModDirectory == _newModDirectory || !_newModDirectory.Any() )
|
||||
{
|
||||
return;
|
||||
|
|
@ -79,36 +90,24 @@ public partial class SettingsInterface
|
|||
|
||||
private void DrawTempFolder()
|
||||
{
|
||||
ImGui.SetNextItemWidth( 400 * ImGuiHelpers.GlobalScale );
|
||||
ImGui.BeginGroup();
|
||||
var save = ImGui.InputText( LabelTempFolder, ref _newTempDirectory, 255, ImGuiInputTextFlags.EnterReturnsTrue );
|
||||
|
||||
ImGuiCustom.HoverTooltip( "The folder used to store temporary meta manipulation files.\n"
|
||||
+ "Leave this blank if you have no reason not to.\n"
|
||||
+ "A folder 'penumbrametatmp' will be created as a subdirectory to the specified directory.\n"
|
||||
+ "If none is specified (i.e. this is blank) this folder will be created in the root folder instead." );
|
||||
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
var save = ImGui.InputText( "Temp Directory", ref _newTempDirectory, 255, ImGuiInputTextFlags.EnterReturnsTrue );
|
||||
ImGui.SameLine();
|
||||
if( ImGui.Button( LabelOpenTempFolder ) )
|
||||
{
|
||||
if( !Directory.Exists( _base._modManager.TempPath.FullName ) || !_base._modManager.TempWritable )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Process.Start( new ProcessStartInfo( _base._modManager.TempPath.FullName )
|
||||
{
|
||||
UseShellExecute = true,
|
||||
} );
|
||||
}
|
||||
|
||||
ImGuiComponents.HelpMarker( "This is where Penumbra will store temporary meta manipulation files.\n"
|
||||
+ "Leave this blank if you have no reason not to.\n"
|
||||
+ "A directory 'penumbrametatmp' will be created as a sub-directory to the specified directory.\n"
|
||||
+ "If none is specified (i.e. this is blank) this directory will be created in the root directory instead.\n" );
|
||||
ImGui.SameLine();
|
||||
DrawOpenDirectoryButton( 1, _base._modManager.TempPath, _base._modManager.TempWritable );
|
||||
ImGui.EndGroup();
|
||||
|
||||
if( _newTempDirectory == _config.TempDirectory )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( save || DrawPressEnterWarning( _config.TempDirectory, 400 ) )
|
||||
if( save || DrawPressEnterWarning( _config.TempDirectory ) )
|
||||
{
|
||||
_base._modManager.SetTempDirectory( _newTempDirectory );
|
||||
_newTempDirectory = _config.TempDirectory;
|
||||
|
|
@ -117,34 +116,21 @@ public partial class SettingsInterface
|
|||
|
||||
private void DrawRediscoverButton()
|
||||
{
|
||||
if( ImGui.Button( LabelRediscoverButton ) )
|
||||
if( ImGui.Button( "Rediscover Mods" ) )
|
||||
{
|
||||
_base._menu.InstalledTab.Selector.ClearSelection();
|
||||
_base._modManager.DiscoverMods();
|
||||
_base._menu.InstalledTab.Selector.Cache.TriggerListReset();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawOpenModsButton()
|
||||
{
|
||||
if( ImGui.Button( LabelOpenFolder ) )
|
||||
{
|
||||
if( !Directory.Exists( _config.ModDirectory ) || !Service< ModManager >.Get().Valid )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Process.Start( new ProcessStartInfo( _config.ModDirectory )
|
||||
{
|
||||
UseShellExecute = true,
|
||||
} );
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Force Penumbra to completely re-scan your root directory as if it was restarted." );
|
||||
}
|
||||
|
||||
private void DrawEnabledBox()
|
||||
{
|
||||
var enabled = _config.IsEnabled;
|
||||
if( ImGui.Checkbox( LabelEnabled, ref enabled ) )
|
||||
if( ImGui.Checkbox( "Enable Mods", ref enabled ) )
|
||||
{
|
||||
_base._penumbra.SetEnabled( enabled );
|
||||
}
|
||||
|
|
@ -153,53 +139,68 @@ public partial class SettingsInterface
|
|||
private void DrawShowAdvancedBox()
|
||||
{
|
||||
var showAdvanced = _config.ShowAdvanced;
|
||||
if( ImGui.Checkbox( LabelShowAdvanced, ref showAdvanced ) )
|
||||
if( ImGui.Checkbox( "Show Advanced Settings", ref showAdvanced ) )
|
||||
{
|
||||
_config.ShowAdvanced = showAdvanced;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Enable some advanced options in this window and in the mod selector.\n"
|
||||
+ "This is required to enable manually editing any mod information." );
|
||||
}
|
||||
|
||||
private void DrawManageModsButtonOffsetButton()
|
||||
{
|
||||
var manageModsButtonOffset = _config.ManageModsButtonOffset;
|
||||
ImGui.SetNextItemWidth( 150 * ImGuiHelpers.GlobalScale );
|
||||
if( ImGui.DragFloat2( LabelManageModsOffset, ref manageModsButtonOffset, 1f ) )
|
||||
if( ImGui.DragFloat2( "\"Manage Mods\"-Button Offset", ref manageModsButtonOffset, 1f ) )
|
||||
{
|
||||
_config.ManageModsButtonOffset = manageModsButtonOffset;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
_base._manageModsButton.ForceDraw = ImGui.IsItemActive();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"Shift the \"Manage Mods\"-Button displayed in the login-lobby by the given amount of pixels in X/Y-direction." );
|
||||
}
|
||||
|
||||
private void DrawSortFoldersFirstBox()
|
||||
{
|
||||
var foldersFirst = _config.SortFoldersFirst;
|
||||
if( ImGui.Checkbox( LabelSortFoldersFirst, ref foldersFirst ) )
|
||||
if( ImGui.Checkbox( "Sort Mod-Folders Before Mods", ref foldersFirst ) )
|
||||
{
|
||||
_config.SortFoldersFirst = foldersFirst;
|
||||
_base._menu.InstalledTab.Selector.Cache.TriggerListReset();
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"Prioritizes all mod-folders in the mod-selector in the Installed Mods tab so that folders come before single mods, instead of being sorted completely alphabetically" );
|
||||
}
|
||||
|
||||
private void DrawScaleModSelectorBox()
|
||||
{
|
||||
var scaleModSelector = _config.ScaleModSelector;
|
||||
if( ImGui.Checkbox( LabelScaleModSelector, ref scaleModSelector ) )
|
||||
if( ImGui.Checkbox( "Scale Mod Selector With Window Size", ref scaleModSelector ) )
|
||||
{
|
||||
_config.ScaleModSelector = scaleModSelector;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"Instead of keeping the mod-selector in the Installed Mods tab a fixed width, this will let it scale with the total size of the Penumbra window." );
|
||||
}
|
||||
|
||||
private void DrawLogLoadedFilesBox()
|
||||
{
|
||||
ImGui.Checkbox( LabelLogLoadedFiles, ref _base._penumbra.ResourceLoader.LogAllFiles );
|
||||
ImGui.Checkbox( "Log Loaded Files", ref _base._penumbra.ResourceLoader.LogAllFiles );
|
||||
ImGui.SameLine();
|
||||
var regex = _base._penumbra.ResourceLoader.LogFileFilter?.ToString() ?? string.Empty;
|
||||
var tmp = regex;
|
||||
ImGui.SetNextItemWidth( SettingsMenu.InputTextWidth );
|
||||
if( ImGui.InputTextWithHint( "##LogFilter", "Matching this Regex...", ref tmp, 64 ) && tmp != regex )
|
||||
{
|
||||
try
|
||||
|
|
@ -212,22 +213,28 @@ public partial class SettingsInterface
|
|||
PluginLog.Debug( "Could not create regex:\n{Exception}", e );
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Log all loaded files that match the given Regex to the PluginLog." );
|
||||
}
|
||||
|
||||
private void DrawDisableNotificationsBox()
|
||||
{
|
||||
var fsWatch = _config.DisableFileSystemNotifications;
|
||||
if( ImGui.Checkbox( LabelDisableNotifications, ref fsWatch ) )
|
||||
if( ImGui.Checkbox( "Disable Filesystem Change Notifications", ref fsWatch ) )
|
||||
{
|
||||
_config.DisableFileSystemNotifications = fsWatch;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Currently does nothing." );
|
||||
}
|
||||
|
||||
private void DrawEnableHttpApiBox()
|
||||
{
|
||||
var http = _config.EnableHttpApi;
|
||||
if( ImGui.Checkbox( LabelEnableHttpApi, ref http ) )
|
||||
if( ImGui.Checkbox( "Enable HTTP API", ref http ) )
|
||||
{
|
||||
if( http )
|
||||
{
|
||||
|
|
@ -241,21 +248,25 @@ public partial class SettingsInterface
|
|||
_config.EnableHttpApi = http;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Currently does nothing." );
|
||||
}
|
||||
|
||||
private void DrawEnabledPlayerWatcher()
|
||||
{
|
||||
var enabled = _config.EnablePlayerWatch;
|
||||
if( ImGui.Checkbox( LabelEnabledPlayerWatch, ref enabled ) )
|
||||
if( ImGui.Checkbox( "Enable Automatic Character Redraws", ref enabled ) )
|
||||
{
|
||||
_config.EnablePlayerWatch = enabled;
|
||||
_configChanged = true;
|
||||
Penumbra.PlayerWatcher.SetStatus( enabled );
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
"If this setting is enabled, penumbra will keep tabs on characters that have a corresponding collection setup in the Collections tab.\n"
|
||||
+ "Penumbra will try to automatically redraw those characters using their collection when they first appear in an instance, or when they change their current equip." );
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"If this setting is enabled, Penumbra will keep tabs on characters that have a corresponding character collection setup in the Collections tab.\n"
|
||||
+ "Penumbra will try to automatically redraw those characters using their collection when they first appear in an instance, or when they change their current equip.\n" );
|
||||
|
||||
if( !_config.EnablePlayerWatch || !_config.ShowAdvanced )
|
||||
{
|
||||
|
|
@ -264,28 +275,32 @@ public partial class SettingsInterface
|
|||
|
||||
var waitFrames = _config.WaitFrames;
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth( 50 );
|
||||
if( ImGui.InputInt( LabelWaitFrames, ref waitFrames, 0, 0 )
|
||||
ImGui.SetNextItemWidth( 50 * ImGuiHelpers.GlobalScale );
|
||||
if( ImGui.InputInt( "Wait Frames", ref waitFrames, 0, 0 )
|
||||
&& waitFrames != _config.WaitFrames
|
||||
&& waitFrames > 0
|
||||
&& waitFrames < 3000 )
|
||||
&& waitFrames is > 0 and < 3000 )
|
||||
{
|
||||
_base._penumbra.ObjectReloader.DefaultWaitFrames = waitFrames;
|
||||
_config.WaitFrames = waitFrames;
|
||||
_configChanged = true;
|
||||
}
|
||||
|
||||
ImGuiCustom.HoverTooltip(
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker(
|
||||
"The number of frames penumbra waits after some events (like zone changes) until it starts trying to redraw actors again, in a range of [1, 3001].\n"
|
||||
+ "Keep this as low as possible while producing stable results." );
|
||||
}
|
||||
|
||||
private static void DrawReloadResourceButton()
|
||||
{
|
||||
if( ImGui.Button( LabelReloadResource ) )
|
||||
if( ImGui.Button( "Reload Resident Resources" ) )
|
||||
{
|
||||
Service< ResidentResources >.Get().ReloadPlayerResources();
|
||||
Service< ResidentResources >.Get().ReloadResidentResources();
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiComponents.HelpMarker( "Reload some specific files that the game keeps in memory at all times.\n"
|
||||
+ "You usually should not need to do this." );
|
||||
}
|
||||
|
||||
private void DrawAdvancedSettings()
|
||||
|
|
@ -299,7 +314,7 @@ public partial class SettingsInterface
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
if( !ImGui.BeginTabItem( LabelTab ) )
|
||||
if( !ImGui.BeginTabItem( "Settings" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -309,8 +324,6 @@ public partial class SettingsInterface
|
|||
DrawRootFolder();
|
||||
|
||||
DrawRediscoverButton();
|
||||
ImGui.SameLine();
|
||||
DrawOpenModsButton();
|
||||
|
||||
ImGuiCustom.VerticalDistance( DefaultVerticalSpace );
|
||||
DrawEnabledBox();
|
||||
|
|
|
|||
|
|
@ -1,91 +1,94 @@
|
|||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.UI.Custom;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.UI
|
||||
namespace Penumbra.UI;
|
||||
|
||||
public partial class SettingsInterface
|
||||
{
|
||||
public partial class SettingsInterface
|
||||
private class SettingsMenu
|
||||
{
|
||||
private class SettingsMenu
|
||||
public static float InputTextWidth
|
||||
=> 450 * ImGuiHelpers.GlobalScale;
|
||||
|
||||
private const string PenumbraSettingsLabel = "PenumbraSettings";
|
||||
|
||||
public static readonly Vector2 MinSettingsSize = new(800, 450);
|
||||
public static readonly Vector2 MaxSettingsSize = new(69420, 42069);
|
||||
|
||||
private readonly SettingsInterface _base;
|
||||
private readonly TabSettings _settingsTab;
|
||||
private readonly TabImport _importTab;
|
||||
private readonly TabBrowser _browserTab;
|
||||
private readonly TabEffective _effectiveTab;
|
||||
private readonly TabChangedItems _changedItems;
|
||||
internal readonly TabCollections CollectionsTab;
|
||||
internal readonly TabInstalled InstalledTab;
|
||||
|
||||
public SettingsMenu( SettingsInterface ui )
|
||||
{
|
||||
private const string PenumbraSettingsLabel = "PenumbraSettings";
|
||||
|
||||
public static readonly Vector2 MinSettingsSize = new( 800, 450 );
|
||||
public static readonly Vector2 MaxSettingsSize = new( 69420, 42069 );
|
||||
|
||||
private readonly SettingsInterface _base;
|
||||
private readonly TabSettings _settingsTab;
|
||||
private readonly TabImport _importTab;
|
||||
private readonly TabBrowser _browserTab;
|
||||
private readonly TabEffective _effectiveTab;
|
||||
private readonly TabChangedItems _changedItems;
|
||||
internal readonly TabCollections CollectionsTab;
|
||||
internal readonly TabInstalled InstalledTab;
|
||||
|
||||
public SettingsMenu( SettingsInterface ui )
|
||||
{
|
||||
_base = ui;
|
||||
_settingsTab = new TabSettings( _base );
|
||||
_importTab = new TabImport( _base );
|
||||
_browserTab = new TabBrowser();
|
||||
InstalledTab = new TabInstalled( _base, _importTab.NewMods );
|
||||
CollectionsTab = new TabCollections( InstalledTab.Selector );
|
||||
_effectiveTab = new TabEffective();
|
||||
_changedItems = new TabChangedItems( _base );
|
||||
}
|
||||
_base = ui;
|
||||
_settingsTab = new TabSettings( _base );
|
||||
_importTab = new TabImport( _base );
|
||||
_browserTab = new TabBrowser();
|
||||
InstalledTab = new TabInstalled( _base, _importTab.NewMods );
|
||||
CollectionsTab = new TabCollections( InstalledTab.Selector );
|
||||
_effectiveTab = new TabEffective();
|
||||
_changedItems = new TabChangedItems( _base );
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
private const bool DefaultVisibility = true;
|
||||
private const bool DefaultVisibility = true;
|
||||
#else
|
||||
private const bool DefaultVisibility = false;
|
||||
#endif
|
||||
public bool Visible = DefaultVisibility;
|
||||
public bool DebugTabVisible = DefaultVisibility;
|
||||
public bool Visible = DefaultVisibility;
|
||||
public bool DebugTabVisible = DefaultVisibility;
|
||||
|
||||
public void Draw()
|
||||
public void Draw()
|
||||
{
|
||||
if( !Visible )
|
||||
{
|
||||
if( !Visible )
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSizeConstraints( MinSettingsSize, MaxSettingsSize );
|
||||
ImGui.SetNextWindowSizeConstraints( MinSettingsSize, MaxSettingsSize );
|
||||
#if DEBUG
|
||||
var ret = ImGui.Begin( _base._penumbra.PluginDebugTitleStr, ref Visible );
|
||||
var ret = ImGui.Begin( _base._penumbra.PluginDebugTitleStr, ref Visible );
|
||||
#else
|
||||
var ret = ImGui.Begin( _base._penumbra.Name, ref Visible );
|
||||
#endif
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.End );
|
||||
if( !ret )
|
||||
using var raii = ImGuiRaii.DeferredEnd( ImGui.End );
|
||||
if( !ret )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.BeginTabBar( PenumbraSettingsLabel );
|
||||
raii.Push( ImGui.EndTabBar );
|
||||
|
||||
_settingsTab.Draw();
|
||||
CollectionsTab.Draw();
|
||||
_importTab.Draw();
|
||||
|
||||
if( Service< ModManager >.Get().Valid && !_importTab.IsImporting() )
|
||||
{
|
||||
_browserTab.Draw();
|
||||
InstalledTab.Draw();
|
||||
_changedItems.Draw();
|
||||
if( Penumbra.Config.ShowAdvanced )
|
||||
{
|
||||
return;
|
||||
_effectiveTab.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.BeginTabBar( PenumbraSettingsLabel );
|
||||
raii.Push( ImGui.EndTabBar );
|
||||
|
||||
_settingsTab.Draw();
|
||||
CollectionsTab.Draw();
|
||||
_importTab.Draw();
|
||||
|
||||
if( Service< ModManager >.Get().Valid && !_importTab.IsImporting() )
|
||||
{
|
||||
_browserTab.Draw();
|
||||
InstalledTab.Draw();
|
||||
_changedItems.Draw();
|
||||
if( Penumbra.Config.ShowAdvanced )
|
||||
{
|
||||
_effectiveTab.Draw();
|
||||
}
|
||||
}
|
||||
|
||||
if( DebugTabVisible )
|
||||
{
|
||||
_base.DrawDebugTab();
|
||||
_base.DrawResourceManagerTab();
|
||||
}
|
||||
if( DebugTabVisible )
|
||||
{
|
||||
_base.DrawDebugTab();
|
||||
_base.DrawResourceManagerTab();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue