Update to API4, use IPC instead of API-project. Replace Actor in most visible names with Object, Character or Player..

This commit is contained in:
Ottermandias 2021-08-27 17:51:51 +02:00
parent 3680d2b63f
commit 4dfc2cf665
60 changed files with 812 additions and 740 deletions

View file

@ -27,17 +27,13 @@ namespace Penumbra.UI
| ImGuiWindowFlags.NoSavedSettings;
private readonly SettingsInterface _base;
private readonly Dalamud.Game.ClientState.Condition _condition;
public ManageModsButton( SettingsInterface ui )
{
_base = ui;
_condition = ui._plugin!.PluginInterface!.ClientState.Condition;
}
=> _base = ui;
public void Draw()
{
if( _condition.Any() || _base._menu.Visible )
if( Dalamud.Conditions.Any() || _base._menu.Visible )
{
return;
}

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Dalamud.Interface;
using Dalamud.Plugin;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Mod;
using Penumbra.Mods;
@ -21,9 +21,9 @@ namespace Penumbra.UI
private string _collectionNames = null!;
private string _collectionNamesWithNone = null!;
private ModCollection[] _collections = null!;
private int _currentCollectionIndex = 0;
private int _currentForcedIndex = 0;
private int _currentDefaultIndex = 0;
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;

View file

@ -5,11 +5,9 @@ using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Runtime.InteropServices;
using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.ClientState.Objects.Types;
using ImGuiNET;
using Penumbra.Api;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Structs;
using Penumbra.GameData.Util;
using Penumbra.Interop;
using Penumbra.Meta;
@ -20,96 +18,98 @@ namespace Penumbra.UI
{
public partial class SettingsInterface
{
private void DrawDebugTabActors()
private static void DrawDebugTabPlayers()
{
if( !ImGui.CollapsingHeader( "Actors##Debug" ) )
if( !ImGui.CollapsingHeader( "Players##Debug" ) )
{
return;
}
var actors = _plugin.PlayerWatcher.WatchedPlayers().ToArray();
if( !actors.Any() )
var players = Penumbra.PlayerWatcher.WatchedPlayers().ToArray();
if( !players.Any() )
{
return;
}
if( ImGui.BeginTable( "##ActorTable", 13, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollX,
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 4 * actors.Length ) ) )
if( !ImGui.BeginTable( "##ObjectTable", 13, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollX,
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 4 * players.Length ) ) )
{
var identifier = GameData.GameData.GetIdentifier( _plugin.PluginInterface );
return;
}
foreach( var (actor, equip) in actors )
{
// @formatter:off
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text( actor );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.MainHand}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Head}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Body}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Hands}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Legs}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Feet}" );
var identifier = GameData.GameData.GetIdentifier();
foreach( var (actor, equip) in players )
{
// @formatter:off
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text( actor );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.MainHand}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Head}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Body}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Hands}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Legs}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Feet}" );
ImGui.TableNextRow();
ImGui.TableNextColumn();
if (equip.IsSet == 0)
{
ImGui.Text( "(not set)" );
}
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.MainHand.Set, equip.MainHand.Type, equip.MainHand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Head.Set, 0, equip.Head.Variant, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Body.Set, 0, equip.Body.Variant, EquipSlot.Body )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Hands.Set, 0, equip.Hands.Variant, EquipSlot.Hands )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Legs.Set, 0, equip.Legs.Variant, EquipSlot.Legs )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Feet.Set, 0, equip.Feet.Variant, EquipSlot.Feet )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.Text( $"{equip.OffHand}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Ears}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Neck}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Wrists}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.LFinger}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.RFinger}" );
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.OffHand.Set, equip.OffHand.Type, equip.OffHand.Variant, EquipSlot.OffHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Ears.Set, 0, equip.Ears.Variant, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Neck.Set, 0, equip.Neck.Variant, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Wrists.Set, 0, equip.Wrists.Variant, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.LFinger.Set, 0, equip.LFinger.Variant, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.RFinger.Set, 0, equip.RFinger.Variant, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
// @formatter:on
ImGui.TableNextRow();
ImGui.TableNextColumn();
if (equip.IsSet == 0)
{
ImGui.Text( "(not set)" );
}
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.MainHand.Set, equip.MainHand.Type, equip.MainHand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Head.Set, 0, equip.Head.Variant, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Body.Set, 0, equip.Body.Variant, EquipSlot.Body )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Hands.Set, 0, equip.Hands.Variant, EquipSlot.Hands )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Legs.Set, 0, equip.Legs.Variant, EquipSlot.Legs )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Feet.Set, 0, equip.Feet.Variant, EquipSlot.Feet )?.Name.ToString() ?? "Unknown" );
ImGui.EndTable();
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.Text( $"{equip.OffHand}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Ears}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Neck}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.Wrists}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.LFinger}" );
ImGui.TableNextColumn();
ImGui.Text( $"{equip.RFinger}" );
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.OffHand.Set, equip.OffHand.Type, equip.OffHand.Variant, EquipSlot.OffHand )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Ears.Set, 0, equip.Ears.Variant, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Neck.Set, 0, equip.Neck.Variant, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.Wrists.Set, 0, equip.Wrists.Variant, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.LFinger.Set, 0, equip.LFinger.Variant, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
ImGui.TableNextColumn();
ImGui.Text( identifier.Identify( equip.RFinger.Set, 0, equip.RFinger.Variant, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
// @formatter:on
}
ImGui.EndTable();
}
private static void PrintValue( string name, string value )
@ -121,7 +121,7 @@ namespace Penumbra.UI
ImGui.Text( value );
}
private void DrawDebugTabGeneral()
private static void DrawDebugTabGeneral()
{
if( !ImGui.CollapsingHeader( "General##Debug" ) )
{
@ -138,12 +138,12 @@ namespace Penumbra.UI
PrintValue( "Active Collection", manager.Collections.ActiveCollection.Name );
PrintValue( "Mod Manager BasePath", manager.BasePath.Name );
PrintValue( "Mod Manager BasePath-Full", manager.BasePath.FullName );
PrintValue( "Mod Manager BasePath IsRooted", Path.IsPathRooted( _plugin.Configuration.ModDirectory ).ToString() );
PrintValue( "Mod Manager BasePath IsRooted", Path.IsPathRooted( Penumbra.Config.ModDirectory ).ToString() );
PrintValue( "Mod Manager BasePath Exists", Directory.Exists( manager.BasePath.FullName ).ToString() );
PrintValue( "Mod Manager Valid", manager.Valid.ToString() );
PrintValue( "Mod Manager Temp Path", manager.TempPath.FullName );
PrintValue( "Mod Manager Temp Path IsRooted",
( !_plugin.Configuration.TempDirectory.Any() || Path.IsPathRooted( _plugin.Configuration.TempDirectory ) ).ToString() );
( !Penumbra.Config.TempDirectory.Any() || Path.IsPathRooted( Penumbra.Config.TempDirectory ) ).ToString() );
PrintValue( "Mod Manager Temp Path Exists", Directory.Exists( manager.TempPath.FullName ).ToString() );
PrintValue( "Mod Manager Temp Path IsWritable", manager.TempWritable.ToString() );
@ -157,70 +157,70 @@ namespace Penumbra.UI
return;
}
var queue = ( Queue< (int, string, RedrawType) >? )_plugin.ActorRefresher.GetType()
.GetField( "_actorIds", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher )
var queue = ( Queue< (int, string, RedrawType) >? )_penumbra.ObjectReloader.GetType()
.GetField( "_objectIds", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader )
?? new Queue< (int, string, RedrawType) >();
var currentFrame = ( int? )_plugin.ActorRefresher.GetType()
var currentFrame = ( int? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentFrame", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
?.GetValue( _penumbra.ObjectReloader );
var changedSettings = ( bool? )_plugin.ActorRefresher.GetType()
var changedSettings = ( bool? )_penumbra.ObjectReloader.GetType()
.GetField( "_changedSettings", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
?.GetValue( _penumbra.ObjectReloader );
var currentActorId = ( int? )_plugin.ActorRefresher.GetType()
.GetField( "_currentActorId", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
var currentObjectId = ( int? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentObjectId", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );
var currentActorName = ( string? )_plugin.ActorRefresher.GetType()
.GetField( "_currentActorName", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
var currentObjectName = ( string? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentObjectName", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );
var currentActorStartState = ( ActorRefresher.LoadingFlags? )_plugin.ActorRefresher.GetType()
.GetField( "_currentActorStartState", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
var currentObjectStartState = ( ObjectReloader.LoadingFlags? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentObjectStartState", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );
var currentActorRedraw = ( RedrawType? )_plugin.ActorRefresher.GetType()
.GetField( "_currentActorRedraw", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
var currentRedrawType = ( RedrawType? )_penumbra.ObjectReloader.GetType()
.GetField( "_currentRedrawType", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _penumbra.ObjectReloader );
var (currentActor, currentActorIdx) = ( (Actor?, int) )_plugin.ActorRefresher.GetType()
.GetMethod( "FindCurrentActor", BindingFlags.NonPublic | BindingFlags.Instance )?
.Invoke( _plugin.ActorRefresher, Array.Empty< object >() )!;
var (currentObject, currentObjectIdx) = ( (GameObject?, int) )_penumbra.ObjectReloader.GetType()
.GetMethod( "FindCurrentObject", BindingFlags.NonPublic | BindingFlags.Instance )?
.Invoke( _penumbra.ObjectReloader, Array.Empty< object >() )!;
var currentRender = currentActor != null
? ( ActorRefresher.LoadingFlags? )Marshal.ReadInt32( ActorRefresher.RenderPtr( currentActor ) )
var currentRender = currentObject != null
? ( ObjectReloader.LoadingFlags? )Marshal.ReadInt32( ObjectReloader.RenderPtr( currentObject ) )
: null;
var waitFrames = ( int? )_plugin.ActorRefresher.GetType()
var waitFrames = ( int? )_penumbra.ObjectReloader.GetType()
.GetField( "_waitFrames", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
?.GetValue( _penumbra.ObjectReloader );
var wasTarget = ( bool? )_plugin.ActorRefresher.GetType()
var wasTarget = ( bool? )_penumbra.ObjectReloader.GetType()
.GetField( "_wasTarget", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
?.GetValue( _penumbra.ObjectReloader );
var gPose = ( bool? )_plugin.ActorRefresher.GetType()
var gPose = ( bool? )_penumbra.ObjectReloader.GetType()
.GetField( "_inGPose", BindingFlags.Instance | BindingFlags.NonPublic )
?.GetValue( _plugin.ActorRefresher );
?.GetValue( _penumbra.ObjectReloader );
if( ImGui.BeginTable( "##RedrawData", 2, ImGuiTableFlags.SizingFixedFit,
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 7 ) ) )
{
PrintValue( "Current Wait Frame", waitFrames?.ToString() ?? "null" );
PrintValue( "Current Frame", currentFrame?.ToString() ?? "null" );
PrintValue( "Currently in GPose", gPose?.ToString() ?? "null" );
PrintValue( "Current Changed Settings", changedSettings?.ToString() ?? "null" );
PrintValue( "Current Actor Id", currentActorId?.ToString( "X8" ) ?? "null" );
PrintValue( "Current Actor Name", currentActorName ?? "null" );
PrintValue( "Current Actor Start State", ( ( int? )currentActorStartState )?.ToString( "X8" ) ?? "null" );
PrintValue( "Current Actor Was Target", wasTarget?.ToString() ?? "null" );
PrintValue( "Current Actor Redraw", currentActorRedraw?.ToString() ?? "null" );
PrintValue( "Current Actor Address", currentActor?.Address.ToString( "X16" ) ?? "null" );
PrintValue( "Current Actor Index", currentActorIdx >= 0 ? currentActorIdx.ToString() : "null" );
PrintValue( "Current Actor Render Flags", ( ( int? )currentRender )?.ToString( "X8" ) ?? "null" );
PrintValue( "Current Wait Frame", waitFrames?.ToString() ?? "null" );
PrintValue( "Current Frame", currentFrame?.ToString() ?? "null" );
PrintValue( "Currently in GPose", gPose?.ToString() ?? "null" );
PrintValue( "Current Changed Settings", changedSettings?.ToString() ?? "null" );
PrintValue( "Current Object Id", currentObjectId?.ToString( "X8" ) ?? "null" );
PrintValue( "Current Object Name", currentObjectName ?? "null" );
PrintValue( "Current Object Start State", ( ( int? )currentObjectStartState )?.ToString( "X8" ) ?? "null" );
PrintValue( "Current Object Was Target", wasTarget?.ToString() ?? "null" );
PrintValue( "Current Object Redraw", currentRedrawType?.ToString() ?? "null" );
PrintValue( "Current Object Address", currentObject?.Address.ToString( "X16" ) ?? "null" );
PrintValue( "Current Object Index", currentObjectIdx >= 0 ? currentObjectIdx.ToString() : "null" );
PrintValue( "Current Object Render Flags", ( ( int? )currentRender )?.ToString( "X8" ) ?? "null" );
ImGui.EndTable();
}
@ -228,13 +228,13 @@ namespace Penumbra.UI
&& ImGui.BeginTable( "##RedrawTable", 3, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.ScrollX,
new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * queue.Count ) ) )
{
foreach( var (actorId, actorName, redraw) in queue )
foreach( var (objectId, objectName, redraw) in queue )
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text( actorName );
ImGui.Text( objectName );
ImGui.TableNextColumn();
ImGui.Text( $"0x{actorId:X8}" );
ImGui.Text( $"0x{objectId:X8}" );
ImGui.TableNextColumn();
ImGui.Text( redraw.ToString() );
}
@ -245,12 +245,12 @@ namespace Penumbra.UI
if( queue.Any() && ImGui.Button( "Clear" ) )
{
queue.Clear();
_plugin.ActorRefresher.GetType()
.GetField( "_currentFrame", BindingFlags.Instance | BindingFlags.NonPublic )?.SetValue( _plugin.ActorRefresher, 0 );
_penumbra.ObjectReloader.GetType()
.GetField( "_currentFrame", BindingFlags.Instance | BindingFlags.NonPublic )?.SetValue( _penumbra.ObjectReloader, 0 );
}
}
private void DrawDebugTabTempFiles()
private static void DrawDebugTabTempFiles()
{
if( !ImGui.CollapsingHeader( "Temporary Files##Debug" ) )
{
@ -270,18 +270,18 @@ namespace Penumbra.UI
?? new Dictionary< GamePath, MetaManager.FileInformation >();
foreach( var file in files )
foreach( var (file, info) in files )
{
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.Text( file.Value.CurrentFile?.FullName ?? "None" );
ImGui.Text( info.CurrentFile?.FullName ?? "None" );
ImGui.TableNextColumn();
ImGui.Text( file.Key );
ImGui.Text( file );
ImGui.TableNextColumn();
file.Value.CurrentFile?.Refresh();
ImGui.Text( file.Value.CurrentFile?.Exists ?? false ? "Exists" : "Missing" );
info.CurrentFile?.Refresh();
ImGui.Text( info.CurrentFile?.Exists ?? false ? "Exists" : "Missing" );
ImGui.TableNextColumn();
ImGui.Text( file.Value.Changed ? "Data Changed" : "Unchanged" );
ImGui.Text( info.Changed ? "Data Changed" : "Unchanged" );
}
}
@ -299,7 +299,7 @@ namespace Penumbra.UI
ImGui.NewLine();
DrawDebugTabRedraw();
ImGui.NewLine();
DrawDebugTabActors();
DrawDebugTabPlayers();
ImGui.NewLine();
DrawDebugTabTempFiles();
ImGui.NewLine();

View file

@ -4,7 +4,7 @@ using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using System.Windows.Forms;
using Dalamud.Plugin;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Importer;
using Penumbra.Mods;

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dalamud.Plugin;
using Dalamud.Logging;
using Penumbra.Mods;
namespace Penumbra.UI
@ -18,12 +18,12 @@ namespace Penumbra.UI
private readonly List< (bool visible, uint color) > _visibleMods = new();
private readonly Dictionary< ModFolder, (bool visible, bool enabled) > _visibleFolders = new();
private string _modFilter = "";
private string _modFilterChanges = "";
private string _modFilterAuthor = "";
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
private bool _listResetNecessary = false;
private bool _filterResetNecessary = false;
private string _modFilter = string.Empty;
private string _modFilterChanges = string.Empty;
private string _modFilterAuthor = string.Empty;
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
private bool _listResetNecessary;
private bool _filterResetNecessary;
public ModFilter StateFilter
@ -167,6 +167,7 @@ namespace Penumbra.UI
{
_visibleMods.Add( CheckFilters( mod ) );
}
_filterResetNecessary = false;
}

View file

@ -3,6 +3,7 @@ using System.Linq;
using Dalamud.Interface;
using ImGuiNET;
using Penumbra.Api;
using Penumbra.GameData.Enums;
using Penumbra.GameData.Util;
using Penumbra.Meta;
using Penumbra.Mod;
@ -124,7 +125,7 @@ namespace Penumbra.UI
private void Save()
{
_modManager.Collections.CurrentCollection.Save( _base._plugin.PluginInterface! );
_modManager.Collections.CurrentCollection.Save();
}
private void DrawAboutTab()
@ -183,13 +184,13 @@ namespace Penumbra.UI
if( ret != MouseButton.None )
{
_base._plugin.Api.InvokeClick( ret, item.Value );
_base._penumbra.Api.InvokeClick( ret, item.Value );
}
if( _base._plugin.Api.HasTooltip && ImGui.IsItemHovered() )
if( _base._penumbra.Api.HasTooltip && ImGui.IsItemHovered() )
{
ImGui.BeginTooltip();
_base._plugin.Api.InvokeTooltip( item.Value );
_base._penumbra.Api.InvokeTooltip( item.Value );
ImGui.EndTooltip();
}
}

View file

@ -2,7 +2,7 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Numerics;
using Dalamud.Plugin;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Mod;
using Penumbra.Mods;
@ -523,7 +523,7 @@ namespace Penumbra.UI
DrawEnabledMark();
ImGui.SameLine();
DrawPriority();
if( _base._plugin!.Configuration!.ShowAdvanced )
if( Penumbra.Config.ShowAdvanced )
{
ImGui.SameLine();
DrawEditableMark();

View file

@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using Dalamud.Interface;
using Dalamud.Plugin;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Importer;
using Penumbra.Mod;
@ -155,7 +154,7 @@ namespace Penumbra.UI
{
try
{
var newDir = TexToolsImport.CreateModFolder( new DirectoryInfo( _base._plugin.Configuration!.ModDirectory ),
var newDir = TexToolsImport.CreateModFolder( new DirectoryInfo( Penumbra.Config!.ModDirectory ),
newName );
var modMeta = new ModMeta
{
@ -377,7 +376,7 @@ namespace Penumbra.UI
var folderName = Marshal.PtrToStringUni( payload.Data );
if( ModFileSystem.Find( folderName!, out var droppedFolder )
&& !ReferenceEquals( droppedFolder, folder )
&& !folder.FullName.StartsWith( folderName, StringComparison.InvariantCultureIgnoreCase ) )
&& !folder.FullName.StartsWith( folderName!, StringComparison.InvariantCultureIgnoreCase ) )
{
droppedFolder.Move( folder );
}
@ -541,7 +540,7 @@ namespace Penumbra.UI
collection == _modManager.Collections.ActiveCollection );
}
collection.Save( _base._plugin.PluginInterface );
collection.Save();
}
private void DrawRenameFolderInput( ModFolder folder )
@ -657,7 +656,7 @@ namespace Penumbra.UI
{
if( item is ModFolder sub )
{
var (visible, enabled) = Cache.GetFolder( sub );
var (visible, _) = Cache.GetFolder( sub );
if( visible )
{
DrawModFolder( sub, ref idx );
@ -757,7 +756,7 @@ namespace Penumbra.UI
try
{
_selectorScalingFactor = _base._plugin.Configuration.ScaleModSelector
_selectorScalingFactor = Penumbra.Config.ScaleModSelector
? ImGui.GetWindowWidth() / SettingsMenu.MinSettingsSize.X
: 1f;
// Selector pane

View file

@ -2,9 +2,9 @@ using System;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using Dalamud.Plugin;
using Dalamud.Logging;
using ImGuiNET;
using Penumbra.Api;
using Penumbra.GameData.Enums;
using Penumbra.Interop;
using Penumbra.Mods;
using Penumbra.Util;
@ -39,7 +39,7 @@ namespace Penumbra.UI
public TabSettings( SettingsInterface ui )
{
_base = ui;
_config = _base._plugin.Configuration!;
_config = Penumbra.Config;
_configChanged = false;
}
@ -115,10 +115,10 @@ namespace Penumbra.UI
{
_config.IsEnabled = enabled;
_configChanged = true;
_base._plugin.ActorRefresher.RedrawAll( enabled ? RedrawType.WithSettings : RedrawType.WithoutSettings );
if( _config.EnableActorWatch )
_base._penumbra.ObjectReloader.RedrawAll( enabled ? RedrawType.WithSettings : RedrawType.WithoutSettings );
if( _config.EnablePlayerWatch )
{
_base._plugin.PlayerWatcher.SetStatus( enabled );
Penumbra.PlayerWatcher.SetStatus( enabled );
}
}
}
@ -156,16 +156,16 @@ namespace Penumbra.UI
private void DrawLogLoadedFilesBox()
{
ImGui.Checkbox( LabelLogLoadedFiles, ref _base._plugin.ResourceLoader.LogAllFiles );
ImGui.Checkbox( LabelLogLoadedFiles, ref _base._penumbra.ResourceLoader.LogAllFiles );
ImGui.SameLine();
var regex = _base._plugin.ResourceLoader.LogFileFilter?.ToString() ?? string.Empty;
var regex = _base._penumbra.ResourceLoader.LogFileFilter?.ToString() ?? string.Empty;
var tmp = regex;
if( ImGui.InputTextWithHint( "##LogFilter", "Matching this Regex...", ref tmp, 64 ) && tmp != regex )
{
try
{
var newRegex = tmp.Length > 0 ? new Regex( tmp, RegexOptions.Compiled ) : null;
_base._plugin.ResourceLoader.LogFileFilter = newRegex;
_base._penumbra.ResourceLoader.LogFileFilter = newRegex;
}
catch( Exception e )
{
@ -191,11 +191,11 @@ namespace Penumbra.UI
{
if( http )
{
_base._plugin.CreateWebServer();
_base._penumbra.CreateWebServer();
}
else
{
_base._plugin.ShutdownWebServer();
_base._penumbra.ShutdownWebServer();
}
_config.EnableHttpApi = http;
@ -205,12 +205,12 @@ namespace Penumbra.UI
private void DrawEnabledPlayerWatcher()
{
var enabled = _config.EnableActorWatch;
var enabled = _config.EnablePlayerWatch;
if( ImGui.Checkbox( LabelEnabledPlayerWatch, ref enabled ) )
{
_config.EnableActorWatch = enabled;
_config.EnablePlayerWatch = enabled;
_configChanged = true;
_base._plugin.PlayerWatcher.SetStatus( enabled );
Penumbra.PlayerWatcher.SetStatus( enabled );
}
if( ImGui.IsItemHovered() )
@ -220,7 +220,7 @@ namespace Penumbra.UI
+ "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." );
}
if( _config.EnableActorWatch && _config.ShowAdvanced )
if( _config.EnablePlayerWatch && _config.ShowAdvanced )
{
var waitFrames = _config.WaitFrames;
ImGui.SameLine();
@ -230,9 +230,9 @@ namespace Penumbra.UI
&& waitFrames > 0
&& waitFrames < 3000 )
{
_base._plugin.ActorRefresher.DefaultWaitFrames = waitFrames;
_config.WaitFrames = waitFrames;
_configChanged = true;
_base._penumbra.ObjectReloader.DefaultWaitFrames = waitFrames;
_config.WaitFrames = waitFrames;
_configChanged = true;
}
if( ImGui.IsItemHovered() )

View file

@ -12,34 +12,34 @@ namespace Penumbra.UI
private static readonly Vector2 AutoFillSize = new( -1, -1 );
private static readonly Vector2 ZeroVector = new( 0, 0 );
private readonly Plugin _plugin;
private readonly Penumbra _penumbra;
private readonly ManageModsButton _manageModsButton;
private readonly MenuBar _menuBar;
private readonly SettingsMenu _menu;
private readonly ModManager _modManager;
public SettingsInterface( Plugin plugin )
public SettingsInterface( Penumbra penumbra )
{
_plugin = plugin;
_penumbra = penumbra;
_manageModsButton = new ManageModsButton( this );
_menuBar = new MenuBar( this );
_menu = new SettingsMenu( this );
_modManager = Service< ModManager >.Get();
_plugin.PluginInterface.UiBuilder.DisableGposeUiHide = true;
_plugin.PluginInterface.UiBuilder.OnBuildUi += Draw;
_plugin.PluginInterface.UiBuilder.OnOpenConfigUi += OpenConfig;
Dalamud.PluginInterface.UiBuilder.DisableGposeUiHide = true;
Dalamud.PluginInterface.UiBuilder.Draw += Draw;
Dalamud.PluginInterface.UiBuilder.OpenConfigUi += OpenConfig;
}
public void Dispose()
{
_menu.InstalledTab.Selector.Cache.Dispose();
_plugin.PluginInterface.UiBuilder.OnBuildUi -= Draw;
_plugin.PluginInterface.UiBuilder.OnOpenConfigUi -= OpenConfig;
Dalamud.PluginInterface.UiBuilder.Draw -= Draw;
Dalamud.PluginInterface.UiBuilder.OpenConfigUi -= OpenConfig;
}
private void OpenConfig( object _1, EventArgs _2 )
private void OpenConfig()
=> _menu.Visible = true;
public void FlipVisibility()
@ -58,14 +58,14 @@ namespace Penumbra.UI
private void ReloadMods()
{
_menu.InstalledTab.Selector.ClearSelection();
_modManager.DiscoverMods( _plugin.Configuration.ModDirectory );
_modManager.DiscoverMods( Penumbra.Config.ModDirectory );
_menu.InstalledTab.Selector.Cache.TriggerListReset();
}
private void SaveCurrentCollection( bool recalculateMeta )
{
var current = _modManager.Collections.CurrentCollection;
current.Save( _plugin.PluginInterface );
current.Save();
RecalculateCurrent( recalculateMeta );
}

View file

@ -50,12 +50,13 @@ namespace Penumbra.UI
ImGui.SetNextWindowSizeConstraints( MinSettingsSize, MaxSettingsSize );
#if DEBUG
var ret = ImGui.Begin( _base._plugin.PluginDebugTitleStr, ref Visible );
var ret = ImGui.Begin( _base._penumbra.PluginDebugTitleStr, ref Visible );
#else
var ret = ImGui.Begin( _base._plugin.Name, ref Visible );
#endif
if( !ret )
{
ImGui.End();
return;
}
@ -70,7 +71,7 @@ namespace Penumbra.UI
_browserTab.Draw();
InstalledTab.Draw();
if( _base._plugin!.Configuration!.ShowAdvanced )
if( Penumbra.Config.ShowAdvanced )
{
_effectiveTab.Draw();
}