mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
fix: handle DTR node removals when reloading plugins (fixes #759)
This commit is contained in:
parent
aac5cdfef7
commit
5cb693e834
2 changed files with 20 additions and 8 deletions
|
|
@ -74,6 +74,19 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
Service<Framework>.Get().Update -= this.Update;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove nodes marked as "should be removed" from the bar.
|
||||
/// </summary>
|
||||
internal void HandleRemovedNodes()
|
||||
{
|
||||
foreach (var data in this.entries.Where(d => d.ShouldBeRemoved))
|
||||
{
|
||||
this.RemoveNode(data.TextNode);
|
||||
}
|
||||
|
||||
this.entries.RemoveAll(d => d.ShouldBeRemoved);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether an entry with the specified title exists.
|
||||
/// </summary>
|
||||
|
|
@ -123,12 +136,7 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
var dtr = GetDtr();
|
||||
if (dtr == null) return;
|
||||
|
||||
foreach (var data in this.entries.Where(d => d.ShouldBeRemoved))
|
||||
{
|
||||
this.RemoveNode(data.TextNode);
|
||||
}
|
||||
|
||||
this.entries.RemoveAll(d => d.ShouldBeRemoved);
|
||||
this.HandleRemovedNodes();
|
||||
|
||||
// The collision node on the DTR element is always the width of its content
|
||||
if (dtr->UldManager.NodeList == null) return;
|
||||
|
|
@ -206,7 +214,7 @@ namespace Dalamud.Game.Gui.Dtr
|
|||
var dtr = GetDtr();
|
||||
if (dtr == null || dtr->RootNode == null) return false;
|
||||
|
||||
for (int i = 0; i < dtr->UldManager.NodeListCount; i++)
|
||||
for (var i = 0; i < dtr->UldManager.NodeListCount; i++)
|
||||
{
|
||||
if (dtr->UldManager.NodeList[i]->NodeID > 1000)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -14,6 +13,7 @@ using CheapLoc;
|
|||
using Dalamud.Configuration;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Gui.Dtr;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Plugin.Internal.Exceptions;
|
||||
|
|
@ -790,6 +790,10 @@ namespace Dalamud.Plugin.Internal
|
|||
}
|
||||
}
|
||||
|
||||
// We need to handle removed DTR nodes here, as otherwise, plugins will not be able to re-add their bar entries after updates.
|
||||
var dtr = Service<DtrBar>.Get();
|
||||
dtr.HandleRemovedNodes();
|
||||
|
||||
try
|
||||
{
|
||||
await this.InstallPluginAsync(metadata.UpdateManifest, metadata.UseTesting, PluginLoadReason.Update);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue