mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Add filtering selecting single results
This commit is contained in:
parent
e9a2744131
commit
08ae14222b
14 changed files with 17 additions and 100 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit 1525b782fffb63fa3ccab8286c335c2279f853a1
|
||||
Subproject commit 69a8ee3ae21480123881bc93ac0458671e7d0c46
|
||||
|
|
@ -5,8 +5,8 @@ using System.Linq;
|
|||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Collections;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Collections;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.Meta.Manager;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Collections;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ using System.Linq;
|
|||
using Dalamud.Configuration;
|
||||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Import;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.UI.Classes;
|
||||
using Penumbra.Util;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
||||
namespace Penumbra;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using Dalamud.Data;
|
|||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.ClientState.Keys;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
|
|
@ -21,7 +22,6 @@ public class Dalamud
|
|||
// @formatter:off
|
||||
[PluginService][RequiredVersion("1.0")] public static DalamudPluginInterface PluginInterface { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static CommandManager Commands { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static SigScanner SigScanner { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static DataManager GameData { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static ClientState ClientState { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static ChatGui Chat { get; private set; } = null!;
|
||||
|
|
@ -31,5 +31,6 @@ public class Dalamud
|
|||
[PluginService][RequiredVersion("1.0")] public static ObjectTable Objects { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static TitleScreenMenu TitleScreenMenu { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static GameGui GameGui { get; private set; } = null!;
|
||||
[PluginService][RequiredVersion("1.0")] public static KeyState KeyState { get; private set; } = null!;
|
||||
// @formatter:on
|
||||
}
|
||||
|
|
@ -4,11 +4,11 @@ using Dalamud.Hooking;
|
|||
using Dalamud.Logging;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using OtterGui;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Interop.Resolver;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Dalamud.Logging;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.GameData.Enums;
|
||||
using Penumbra.GameData.Files;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ public partial class Mod
|
|||
private readonly MdlFile _file;
|
||||
private readonly string[] _currentMaterials;
|
||||
private readonly IReadOnlyList<int> _materialIndices;
|
||||
public bool Changed { get; private set; } = false;
|
||||
public bool Changed { get; private set; }
|
||||
|
||||
public IReadOnlyList<string> CurrentMaterials
|
||||
=> _currentMaterials;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Penumbra.Util;
|
||||
using OtterGui;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ using System.Text.RegularExpressions;
|
|||
using Dalamud.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.GameData.ByteString;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using OtterGui;
|
||||
using OtterGui.Filesystem;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector< Mod, Mod
|
|||
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
|
||||
|
||||
public ModFileSystemSelector( ModFileSystem fileSystem )
|
||||
: base( fileSystem )
|
||||
: base( fileSystem, Dalamud.KeyState )
|
||||
{
|
||||
SubscribeRightClickFolder( EnableDescendants, 10 );
|
||||
SubscribeRightClickFolder( DisableDescendants, 10 );
|
||||
|
|
@ -407,9 +407,9 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector< Mod, Mod
|
|||
{
|
||||
if( _lastSelectedDirectory.Length > 0 )
|
||||
{
|
||||
base.SelectedLeaf = ( ModFileSystem.Leaf? )FileSystem.Root.GetAllDescendants( ISortMode< Mod >.Lexicographical )
|
||||
var leaf = ( ModFileSystem.Leaf? )FileSystem.Root.GetAllDescendants( ISortMode< Mod >.Lexicographical )
|
||||
.FirstOrDefault( l => l is ModFileSystem.Leaf m && m.Value.ModPath.FullName == _lastSelectedDirectory );
|
||||
OnSelectionChange( null, base.SelectedLeaf?.Value, default );
|
||||
Select( leaf );
|
||||
_lastSelectedDirectory = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
namespace Penumbra.Util;
|
||||
|
||||
public static class ArrayExtensions
|
||||
{
|
||||
// Iterate over enumerables with additional index.
|
||||
public static IEnumerable< (T, int) > WithIndex< T >( this IEnumerable< T > list )
|
||||
=> list.Select( ( x, i ) => ( x, i ) );
|
||||
|
||||
|
||||
// Find the index of the first object fulfilling predicate's criteria in the given list.
|
||||
// Returns -1 if no such object is found.
|
||||
public static int IndexOf< T >( this IEnumerable< T > array, Predicate< T > predicate )
|
||||
{
|
||||
var i = 0;
|
||||
foreach( var obj in array )
|
||||
{
|
||||
if( predicate( obj ) )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the index of the first occurrence of needle in the given list.
|
||||
// Returns -1 if needle is not contained in the list.
|
||||
public static int IndexOf< T >( this IEnumerable< T > array, T needle ) where T : notnull
|
||||
{
|
||||
var i = 0;
|
||||
foreach( var obj in array )
|
||||
{
|
||||
if( needle.Equals( obj ) )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find the first object fulfilling predicate's criteria in the given list, if one exists.
|
||||
// Returns true if an object is found, false otherwise.
|
||||
public static bool FindFirst< T >( this IEnumerable< T > array, Predicate< T > predicate, [NotNullWhen( true )] out T? result )
|
||||
{
|
||||
foreach( var obj in array )
|
||||
{
|
||||
if( predicate( obj ) )
|
||||
{
|
||||
result = obj!;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find the first occurrence of needle in the given list and return the value contained in the list in result.
|
||||
// Returns true if an object is found, false otherwise.
|
||||
public static bool FindFirst< T >( this IEnumerable< T > array, T needle, [NotNullWhen( true )] out T? result ) where T : notnull
|
||||
{
|
||||
foreach( var obj in array )
|
||||
{
|
||||
if( obj.Equals( needle ) )
|
||||
{
|
||||
result = obj!;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue