mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Added IPC call to allow for redrawing only members of specified collections
This commit is contained in:
parent
c4b6e4e00b
commit
228509f052
4 changed files with 31 additions and 5 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit c23ee05c1e9fa103eaa52e6aa7e855ef568ee669
|
Subproject commit 874a3773bc4f637de1ef1fa8756b4debe3d8f68b
|
||||||
|
|
@ -2,11 +2,14 @@ using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
|
using Penumbra.Collections;
|
||||||
|
using Penumbra.Collections.Manager;
|
||||||
|
using Penumbra.GameData.Interop;
|
||||||
using Penumbra.Interop.Services;
|
using Penumbra.Interop.Services;
|
||||||
|
|
||||||
namespace Penumbra.Api.Api;
|
namespace Penumbra.Api.Api;
|
||||||
|
|
||||||
public class RedrawApi(RedrawService redrawService, IFramework framework) : IPenumbraApiRedraw, IApiService
|
public class RedrawApi(RedrawService redrawService, IFramework framework, CollectionManager collections, ObjectManager objects, ApiHelpers helpers) : IPenumbraApiRedraw, IApiService
|
||||||
{
|
{
|
||||||
public void RedrawObject(int gameObjectIndex, RedrawType setting)
|
public void RedrawObject(int gameObjectIndex, RedrawType setting)
|
||||||
{
|
{
|
||||||
|
|
@ -28,9 +31,27 @@ public class RedrawApi(RedrawService redrawService, IFramework framework) : IPen
|
||||||
framework.RunOnFrameworkThread(() => redrawService.RedrawAll(setting));
|
framework.RunOnFrameworkThread(() => redrawService.RedrawAll(setting));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RedrawCollectionMembers(Guid collectionId, RedrawType setting)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!collections.Storage.ById(collectionId, out var collection))
|
||||||
|
collection = ModCollection.Empty;
|
||||||
|
framework.RunOnFrameworkThread(() =>
|
||||||
|
{
|
||||||
|
foreach (var actor in objects.Objects)
|
||||||
|
{
|
||||||
|
helpers.AssociatedCollection(actor.ObjectIndex, out var modCollection);
|
||||||
|
if (collection == modCollection)
|
||||||
|
{
|
||||||
|
framework.RunOnFrameworkThread(() => redrawService.RedrawObject(actor.ObjectIndex, setting));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public event GameObjectRedrawnDelegate? GameObjectRedrawn
|
public event GameObjectRedrawnDelegate? GameObjectRedrawn
|
||||||
{
|
{
|
||||||
add => redrawService.GameObjectRedrawn += value;
|
add => redrawService.GameObjectRedrawn += value;
|
||||||
remove => redrawService.GameObjectRedrawn -= value;
|
remove => redrawService.GameObjectRedrawn -= value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ public sealed class IpcProviders : IDisposable, IApiService
|
||||||
IpcSubscribers.RedrawObject.Provider(pi, api.Redraw),
|
IpcSubscribers.RedrawObject.Provider(pi, api.Redraw),
|
||||||
IpcSubscribers.RedrawAll.Provider(pi, api.Redraw),
|
IpcSubscribers.RedrawAll.Provider(pi, api.Redraw),
|
||||||
IpcSubscribers.GameObjectRedrawn.Provider(pi, api.Redraw),
|
IpcSubscribers.GameObjectRedrawn.Provider(pi, api.Redraw),
|
||||||
|
IpcSubscribers.RedrawCollectionMembers.Provider(pi, api.Redraw),
|
||||||
|
|
||||||
IpcSubscribers.ResolveDefaultPath.Provider(pi, api.Resolve),
|
IpcSubscribers.ResolveDefaultPath.Provider(pi, api.Resolve),
|
||||||
IpcSubscribers.ResolveInterfacePath.Provider(pi, api.Resolve),
|
IpcSubscribers.ResolveInterfacePath.Provider(pi, api.Resolve),
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,10 @@ public class CollectionsIpcTester(IDalamudPluginInterface pi) : IUiService
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
ImGui.OpenPopup("Changed Item List");
|
ImGui.OpenPopup("Changed Item List");
|
||||||
}
|
}
|
||||||
|
IpcTester.DrawIntro(RedrawCollectionMembers.Label, "Redraw Collection Members");
|
||||||
|
if (ImGui.Button("Redraw##ObjectCollection"))
|
||||||
|
new RedrawCollectionMembers(pi).Invoke(collectionList[0].Id, RedrawType.Redraw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawChangedItemPopup()
|
private void DrawChangedItemPopup()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue