mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-02-19 06:17:45 +01:00
Rework API, use Collection ID in crash handler, use collection GUIDs in more places.
This commit is contained in:
parent
793ed4f0a7
commit
ba8999914f
88 changed files with 4193 additions and 3930 deletions
|
|
@ -25,8 +25,8 @@ public partial class ModEditWindow
|
|||
var resources = ResourceTreeApiHelper
|
||||
.GetResourcesOfType(_resourceTreeFactory.FromObjectTable(ResourceTreeFactory.Flags.LocalPlayerRelatedOnly), type)
|
||||
.Values
|
||||
.SelectMany(resources => resources.Values)
|
||||
.Select(resource => resource.Item1);
|
||||
.SelectMany(r => r.Values)
|
||||
.Select(r => r.Item1);
|
||||
|
||||
return new HashSet<string>(resources, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ using Dalamud.Game.ClientState.Objects;
|
|||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Plugin;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Collections.Manager;
|
||||
|
|
@ -28,8 +30,8 @@ public sealed class CollectionPanel : IDisposable
|
|||
private readonly IndividualAssignmentUi _individualAssignmentUi;
|
||||
private readonly InheritanceUi _inheritanceUi;
|
||||
private readonly ModStorage _mods;
|
||||
|
||||
private readonly IFontHandle _nameFont;
|
||||
private readonly FilenameService _fileNames;
|
||||
private readonly IFontHandle _nameFont;
|
||||
|
||||
private static readonly IReadOnlyDictionary<CollectionType, (string Name, uint Border)> Buttons = CreateButtons();
|
||||
private static readonly IReadOnlyList<(CollectionType, bool, bool, string, uint)> AdvancedTree = CreateTree();
|
||||
|
|
@ -38,7 +40,7 @@ public sealed class CollectionPanel : IDisposable
|
|||
private int _draggedIndividualAssignment = -1;
|
||||
|
||||
public CollectionPanel(DalamudPluginInterface pi, CommunicatorService communicator, CollectionManager manager,
|
||||
CollectionSelector selector, ActorManager actors, ITargetManager targets, ModStorage mods)
|
||||
CollectionSelector selector, ActorManager actors, ITargetManager targets, ModStorage mods, FilenameService fileNames)
|
||||
{
|
||||
_collections = manager.Storage;
|
||||
_active = manager.Active;
|
||||
|
|
@ -46,6 +48,7 @@ public sealed class CollectionPanel : IDisposable
|
|||
_actors = actors;
|
||||
_targets = targets;
|
||||
_mods = mods;
|
||||
_fileNames = fileNames;
|
||||
_individualAssignmentUi = new IndividualAssignmentUi(communicator, actors, manager);
|
||||
_inheritanceUi = new InheritanceUi(manager, _selector);
|
||||
_nameFont = pi.UiBuilder.FontAtlas.NewGameFontHandle(new GameFontStyle(GameFontFamilyAndSize.Jupiter23));
|
||||
|
|
@ -206,12 +209,57 @@ public sealed class CollectionPanel : IDisposable
|
|||
var collection = _active.Current;
|
||||
DrawCollectionName(collection);
|
||||
DrawStatistics(collection);
|
||||
DrawCollectionData(collection);
|
||||
_inheritanceUi.Draw();
|
||||
ImGui.Separator();
|
||||
DrawInactiveSettingsList(collection);
|
||||
DrawSettingsList(collection);
|
||||
}
|
||||
|
||||
private void DrawCollectionData(ModCollection collection)
|
||||
{
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
ImGui.BeginGroup();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Name");
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("Identifier");
|
||||
ImGui.EndGroup();
|
||||
ImGui.SameLine();
|
||||
ImGui.BeginGroup();
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
|
||||
var name = collection.Name;
|
||||
var identifier = collection.Identifier;
|
||||
var width = ImGui.GetContentRegionAvail().X;
|
||||
var fileName = _fileNames.CollectionFile(collection);
|
||||
ImGui.SetNextItemWidth(width);
|
||||
ImGui.InputText("##name", ref name, 128);
|
||||
using (ImRaii.PushFont(UiBuilder.MonoFont))
|
||||
{
|
||||
if (ImGui.Button(collection.Identifier, new Vector2(width, 0)))
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(fileName) { UseShellExecute = true });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Penumbra.Messager.NotificationMessage(ex, $"Could not open file {fileName}.", $"Could not open file {fileName}",
|
||||
NotificationType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
|
||||
ImGui.SetClipboardText(identifier);
|
||||
|
||||
ImGuiUtil.HoverTooltip(
|
||||
$"Open the file\n\t{fileName}\ncontaining this design in the .json-editor of your choice.\n\nRight-Click to copy identifier to clipboard.");
|
||||
|
||||
ImGui.EndGroup();
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
ImGui.Separator();
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
}
|
||||
|
||||
private void DrawContext(bool open, ModCollection? collection, CollectionType type, ActorIdentifier identifier, string text, char suffix)
|
||||
{
|
||||
var label = $"{type}{text}{suffix}";
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public sealed class CollectionSelector : ItemSelector<ModCollection>, IDisposabl
|
|||
|
||||
public CollectionSelector(Configuration config, CommunicatorService communicator, CollectionStorage storage, ActiveCollections active,
|
||||
TutorialService tutorial)
|
||||
: base(new List<ModCollection>(), Flags.Delete | Flags.Add | Flags.Duplicate | Flags.Filter)
|
||||
: base([], Flags.Delete | Flags.Add | Flags.Duplicate | Flags.Filter)
|
||||
{
|
||||
_config = config;
|
||||
_communicator = communicator;
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ public sealed class CollectionsTab : IDisposable, ITab
|
|||
}
|
||||
|
||||
public CollectionsTab(DalamudPluginInterface pi, Configuration configuration, CommunicatorService communicator,
|
||||
CollectionManager collectionManager, ModStorage modStorage, ActorManager actors, ITargetManager targets, TutorialService tutorial)
|
||||
CollectionManager collectionManager, ModStorage modStorage, ActorManager actors, ITargetManager targets, TutorialService tutorial, FilenameService fileNames)
|
||||
{
|
||||
_config = configuration.Ephemeral;
|
||||
_tutorial = tutorial;
|
||||
_selector = new CollectionSelector(configuration, communicator, collectionManager.Storage, collectionManager.Active, _tutorial);
|
||||
_panel = new CollectionPanel(pi, communicator, collectionManager, _selector, actors, targets, modStorage);
|
||||
_panel = new CollectionPanel(pi, communicator, collectionManager, _selector, actors, targets, modStorage, fileNames);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public static class CrashDataExtensions
|
|||
ImGuiUtil.DrawTableColumn(character.Age.ToString(CultureInfo.InvariantCulture));
|
||||
ImGuiUtil.DrawTableColumn(character.ThreadId.ToString());
|
||||
ImGuiUtil.DrawTableColumn(character.CharacterName);
|
||||
ImGuiUtil.DrawTableColumn(character.CollectionName);
|
||||
ImGuiUtil.DrawTableColumn(character.CollectionId.ToString());
|
||||
ImGuiUtil.DrawTableColumn(character.CharacterAddress);
|
||||
ImGuiUtil.DrawTableColumn(character.Timestamp.ToString());
|
||||
}, ImGui.GetTextLineHeightWithSpacing());
|
||||
|
|
@ -79,7 +79,7 @@ public static class CrashDataExtensions
|
|||
ImGuiUtil.DrawTableColumn(file.ActualFileName);
|
||||
ImGuiUtil.DrawTableColumn(file.RequestedFileName);
|
||||
ImGuiUtil.DrawTableColumn(file.CharacterName);
|
||||
ImGuiUtil.DrawTableColumn(file.CollectionName);
|
||||
ImGuiUtil.DrawTableColumn(file.CollectionId.ToString());
|
||||
ImGuiUtil.DrawTableColumn(file.CharacterAddress);
|
||||
ImGuiUtil.DrawTableColumn(file.Timestamp.ToString());
|
||||
}, ImGui.GetTextLineHeightWithSpacing());
|
||||
|
|
@ -102,7 +102,7 @@ public static class CrashDataExtensions
|
|||
ImGuiUtil.DrawTableColumn(vfx.ThreadId.ToString());
|
||||
ImGuiUtil.DrawTableColumn(vfx.InvocationType);
|
||||
ImGuiUtil.DrawTableColumn(vfx.CharacterName);
|
||||
ImGuiUtil.DrawTableColumn(vfx.CollectionName);
|
||||
ImGuiUtil.DrawTableColumn(vfx.CollectionId.ToString());
|
||||
ImGuiUtil.DrawTableColumn(vfx.CharacterAddress);
|
||||
ImGuiUtil.DrawTableColumn(vfx.Timestamp.ToString());
|
||||
}, ImGui.GetTextLineHeightWithSpacing());
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ using CharacterUtility = Penumbra.Interop.Services.CharacterUtility;
|
|||
using ObjectKind = Dalamud.Game.ClientState.Objects.Enums.ObjectKind;
|
||||
using ResidentResourceManager = Penumbra.Interop.Services.ResidentResourceManager;
|
||||
using ImGuiClip = OtterGui.ImGuiClip;
|
||||
using Penumbra.Api.IpcTester;
|
||||
|
||||
namespace Penumbra.UI.Tabs.Debug;
|
||||
|
||||
|
|
@ -76,7 +77,6 @@ public class DebugTab : Window, ITab
|
|||
private readonly CharacterUtility _characterUtility;
|
||||
private readonly ResidentResourceManager _residentResources;
|
||||
private readonly ResourceManagerService _resourceManager;
|
||||
private readonly PenumbraIpcProviders _ipc;
|
||||
private readonly CollectionResolver _collectionResolver;
|
||||
private readonly DrawObjectState _drawObjectState;
|
||||
private readonly PathState _pathState;
|
||||
|
|
@ -100,7 +100,7 @@ public class DebugTab : Window, ITab
|
|||
IClientState clientState,
|
||||
ValidityChecker validityChecker, ModManager modManager, HttpApi httpApi, ActorManager actors, StainService stains,
|
||||
CharacterUtility characterUtility, ResidentResourceManager residentResources,
|
||||
ResourceManagerService resourceManager, PenumbraIpcProviders ipc, CollectionResolver collectionResolver,
|
||||
ResourceManagerService resourceManager, CollectionResolver collectionResolver,
|
||||
DrawObjectState drawObjectState, PathState pathState, SubfileHelper subfileHelper, IdentifiedCollectionCache identifiedCollectionCache,
|
||||
CutsceneService cutsceneService, ModImportManager modImporter, ImportPopup importPopup, FrameworkManager framework,
|
||||
TextureManager textureManager, ShaderReplacementFixer shaderReplacementFixer, RedrawService redraws, DictEmote emotes,
|
||||
|
|
@ -124,7 +124,6 @@ public class DebugTab : Window, ITab
|
|||
_characterUtility = characterUtility;
|
||||
_residentResources = residentResources;
|
||||
_resourceManager = resourceManager;
|
||||
_ipc = ipc;
|
||||
_collectionResolver = collectionResolver;
|
||||
_drawObjectState = drawObjectState;
|
||||
_pathState = pathState;
|
||||
|
|
@ -440,7 +439,9 @@ public class DebugTab : Window, ITab
|
|||
: $"0x{(nint)((Character*)obj.Address)->GameObject.GetDrawObject():X}");
|
||||
var identifier = _actors.FromObject(obj, out _, false, true, false);
|
||||
ImGuiUtil.DrawTableColumn(_actors.ToString(identifier));
|
||||
var id = obj.AsObject->ObjectKind ==(byte) ObjectKind.BattleNpc ? $"{identifier.DataId} | {obj.AsObject->DataID}" : identifier.DataId.ToString();
|
||||
var id = obj.AsObject->ObjectKind == (byte)ObjectKind.BattleNpc
|
||||
? $"{identifier.DataId} | {obj.AsObject->DataID}"
|
||||
: identifier.DataId.ToString();
|
||||
ImGuiUtil.DrawTableColumn(id);
|
||||
}
|
||||
|
||||
|
|
@ -969,13 +970,8 @@ public class DebugTab : Window, ITab
|
|||
/// <summary> Draw information about IPC options and availability. </summary>
|
||||
private void DrawDebugTabIpc()
|
||||
{
|
||||
if (!ImGui.CollapsingHeader("IPC"))
|
||||
{
|
||||
_ipcTester.UnsubscribeEvents();
|
||||
return;
|
||||
}
|
||||
|
||||
_ipcTester.Draw();
|
||||
if (ImGui.CollapsingHeader("IPC"))
|
||||
_ipcTester.Draw();
|
||||
}
|
||||
|
||||
/// <summary> Helper to print a property and its value in a 2-column table. </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue