mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 06:47:44 +01:00
UldWidget fixes (#2557)
* Fix missing directory separator in theme path * Hide themed texture exception when file not found * Check ThemeSupportBitmask
This commit is contained in:
parent
5a0257e40e
commit
9538af0554
1 changed files with 13 additions and 7 deletions
|
|
@ -47,6 +47,7 @@ internal class UldWidget : IDataWindowWidget
|
||||||
("48 8D 15 ?? ?? ?? ?? 45 33 C0 E9 ?? ?? ?? ??", 3)
|
("48 8D 15 ?? ?? ?? ?? 45 33 C0 E9 ?? ?? ?? ??", 3)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private DataManager dataManager;
|
||||||
private CancellationTokenSource? cts;
|
private CancellationTokenSource? cts;
|
||||||
private Task<string[]>? uldNamesTask;
|
private Task<string[]>? uldNamesTask;
|
||||||
|
|
||||||
|
|
@ -69,6 +70,8 @@ internal class UldWidget : IDataWindowWidget
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
|
this.dataManager ??= Service<DataManager>.Get();
|
||||||
|
|
||||||
this.cts?.Cancel();
|
this.cts?.Cancel();
|
||||||
ClearTask(ref this.uldNamesTask);
|
ClearTask(ref this.uldNamesTask);
|
||||||
this.uldNamesTask = null;
|
this.uldNamesTask = null;
|
||||||
|
|
@ -264,7 +267,7 @@ internal class UldWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToThemedPath(string path) =>
|
private string ToThemedPath(string path) =>
|
||||||
UldBaseBath + (this.selectedTheme > 0 ? $"img{this.selectedTheme:D2}" : string.Empty) + path[UldBaseBath.Length..];
|
UldBaseBath + (this.selectedTheme > 0 ? $"img{this.selectedTheme:D2}/" : string.Empty) + path[UldBaseBath.Length..];
|
||||||
|
|
||||||
private void DrawTextureEntry(UldRoot.TextureEntry textureEntry, TextureManager textureManager)
|
private void DrawTextureEntry(UldRoot.TextureEntry textureEntry, TextureManager textureManager)
|
||||||
{
|
{
|
||||||
|
|
@ -292,14 +295,17 @@ internal class UldWidget : IDataWindowWidget
|
||||||
else if (e is not null)
|
else if (e is not null)
|
||||||
ImGui.Text(e.ToString());
|
ImGui.Text(e.ToString());
|
||||||
|
|
||||||
if (this.selectedTheme != 0)
|
if (this.selectedTheme != 0 && (textureEntry.ThemeSupportBitmask & (1 << (this.selectedTheme - 1))) != 0)
|
||||||
{
|
{
|
||||||
var texturePathThemed = this.ToThemedPath(texturePath);
|
var texturePathThemed = this.ToThemedPath(texturePath);
|
||||||
ImGui.Text($"Themed path at {texturePathThemed}:");
|
if (this.dataManager.FileExists(texturePathThemed))
|
||||||
if (textureManager.Shared.GetFromGame(texturePathThemed).TryGetWrap(out wrap, out e))
|
{
|
||||||
ImGui.Image(wrap.Handle, wrap.Size);
|
ImGui.Text($"Themed path at {texturePathThemed}:");
|
||||||
else if (e is not null)
|
if (textureManager.Shared.GetFromGame(texturePathThemed).TryGetWrap(out wrap, out e))
|
||||||
ImGui.Text(e.ToString());
|
ImGui.Image(wrap.Handle, wrap.Size);
|
||||||
|
else if (e is not null)
|
||||||
|
ImGui.Text(e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndTooltip();
|
ImGui.EndTooltip();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue