diff --git a/ChatTwo/ChatTwo.yaml b/ChatTwo/ChatTwo.yaml index c7ae849..3af3763 100755 --- a/ChatTwo/ChatTwo.yaml +++ b/ChatTwo/ChatTwo.yaml @@ -34,3 +34,6 @@ changelog: |- **Textures** - Switch to dalamuds internal texture cache + + **Misc** + - Role Icons are now compatible with penumbra [thanks mopi] diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index 16a23e9..7852b86 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -13,14 +13,12 @@ using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface; using Dalamud.Interface.Style; -using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Dalamud.Interface.Windowing; using Dalamud.Memory; using FFXIVClientStructs.FFXIV.Client.UI; using ImGuiNET; -using Lumina.Data.Files; using Lumina.Excel; using Lumina.Excel.GeneratedSheets; @@ -55,7 +53,6 @@ public sealed class ChatLogWindow : Window internal bool Activate; private int ActivatePos = -1; internal string Chat = string.Empty; - internal IDalamudTextureWrap? FontIcon; private readonly List InputBacklog = []; private int InputBacklogIdx = -1; private int LastTab { get; set; } @@ -131,7 +128,6 @@ public sealed class ChatLogWindow : Window Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip); Plugin.ClientState.Logout -= Logout; Plugin.ClientState.Login -= Login; - FontIcon?.Dispose(); Plugin.Commands.Register("/chat2").Execute -= ToggleChat; Plugin.Commands.Register("/clearlog2").Execute -= ClearLog; } @@ -497,7 +493,6 @@ public sealed class ChatLogWindow : Window { try { - FontIcon = Plugin.TextureProvider.GetFromGame("common/font/fonticon_ps5.tex").GetWrapOrDefault(); DrawChatLog(); AddPopOutsToDraw(); DrawAutoComplete(); @@ -1592,7 +1587,7 @@ public sealed class ChatLogWindow : Window private void DrawChunk(Chunk chunk, bool wrap = true, PayloadHandler? handler = null, float lineWidth = 0f) { - if (chunk is IconChunk icon && FontIcon != null) + if (chunk is IconChunk icon) { DrawIcon(chunk, icon, handler); return; @@ -1681,7 +1676,11 @@ public sealed class ChatLogWindow : Window if (!IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out var entry)) return; - var texSize = new Vector2(FontIcon!.Width, FontIcon.Height); + var iconTexture = Plugin.TextureProvider.GetFromGame("common/font/fonticon_ps5.tex").GetWrapOrDefault(); + if (iconTexture == null) + return; + + var texSize = new Vector2(iconTexture.Width, iconTexture.Height); var sizeRatio = FontManager.GetFontSize() / entry.Height; var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale; @@ -1689,7 +1688,7 @@ public sealed class ChatLogWindow : Window var uv0 = new Vector2(entry.Left, entry.Top + 170) * 2 / texSize; var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height + 170) * 2 / texSize; - ImGui.Image(FontIcon.ImGuiHandle, size, uv0, uv1); + ImGui.Image(iconTexture.ImGuiHandle, size, uv0, uv1); ImGuiUtil.PostPayload(chunk, handler); } diff --git a/ChatTwo/Ui/InputPreview.cs b/ChatTwo/Ui/InputPreview.cs index 6ff815a..d4fd01b 100644 --- a/ChatTwo/Ui/InputPreview.cs +++ b/ChatTwo/Ui/InputPreview.cs @@ -170,7 +170,7 @@ public partial class InputPreview : Window private void DrawChunkPreview(Chunk chunk, PayloadHandler? handler = null, float lineWidth = 0f, int unique = 0) { - if (chunk is IconChunk icon && LogWindow.FontIcon != null) + if (chunk is IconChunk icon) { LogWindow.DrawIcon(chunk, icon, handler); if (icon.Icon != BitmapFontIcon.AutoTranslateBegin)