This commit is contained in:
CakeAndBanana
2025-09-30 05:45:03 +02:00
4 changed files with 158 additions and 86 deletions

View File

@@ -309,7 +309,8 @@ namespace LightlessSync.UI
ImGui.EndTabItem(); ImGui.EndTabItem();
} }
#if DEBUG
#if DEBUG
if (ImGui.BeginTabItem("Debug")) if (ImGui.BeginTabItem("Debug"))
{ {
ImGui.Text("Broadcast Cache"); ImGui.Text("Broadcast Cache");
@@ -365,10 +366,10 @@ namespace LightlessSync.UI
ImGui.EndTable(); ImGui.EndTable();
} }
#endif
ImGui.EndTabItem(); ImGui.EndTabItem();
} }
#endif
ImGui.EndTabBar(); ImGui.EndTabBar();
} }

View File

@@ -547,73 +547,147 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
using var tab = ImRaii.TabItem(tabText + "###" + kvp.Key.ToString()); using var tab = ImRaii.TabItem(tabText + "###" + kvp.Key.ToString());
if (tab.Success) if (tab.Success)
{ {
var groupedfiles = kvp.Value.Select(v => v.Value).GroupBy(f => f.FileType, StringComparer.Ordinal) var groupedfiles = kvp.Value.Select(v => v.Value).GroupBy(f => f.FileType, StringComparer.Ordinal).OrderBy(k => k.Key, StringComparer.Ordinal).ToList();
.OrderBy(k => k.Key, StringComparer.Ordinal).ToList();
ImGui.TextUnformatted("Files for " + kvp.Key); ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(1f, 1f));
ImGui.SameLine(); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(1f, 1f));
ImGui.TextUnformatted(kvp.Value.Count.ToString());
ImGui.SameLine();
using (var font = ImRaii.PushFont(UiBuilder.IconFont)) if (ImGui.BeginTable($"##fileStats_{kvp.Key}", 3,
ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingFixedFit))
{ {
ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString()); ImGui.TableNextRow();
} ImGui.TableNextColumn();
if (ImGui.IsItemHovered()) ImGui.TextUnformatted($"Files for {kvp.Key}");
{ ImGui.TableNextColumn();
string text = ""; ImGui.TextUnformatted(kvp.Value.Count.ToString());
text = string.Join(Environment.NewLine, groupedfiles
.Select(f => f.Key + ": " + f.Count() + " files, size: " + UiSharedService.ByteToString(f.Sum(v => v.OriginalSize))
+ ", compressed: " + UiSharedService.ByteToString(f.Sum(v => v.CompressedSize))));
ImGui.SetTooltip(text);
}
ImGui.TextUnformatted($"{kvp.Key} size (actual):");
ImGui.SameLine();
ImGui.TextUnformatted(UiSharedService.ByteToString(kvp.Value.Sum(c => c.Value.OriginalSize)));
ImGui.TextUnformatted($"{kvp.Key} size (compressed for up/download only):");
ImGui.SameLine();
ImGui.TextUnformatted(UiSharedService.ByteToString(kvp.Value.Sum(c => c.Value.CompressedSize)));
ImGui.Separator();
var vramUsage = groupedfiles.SingleOrDefault(v => string.Equals(v.Key, "tex", StringComparison.Ordinal));
if (vramUsage != null)
{
var actualVramUsage = vramUsage.Sum(f => f.OriginalSize);
ImGui.TextUnformatted($"{kvp.Key} VRAM usage:");
ImGui.SameLine(); ImGui.SameLine();
ImGui.TextUnformatted(UiSharedService.ByteToString(actualVramUsage)); using (var font = ImRaii.PushFont(UiBuilder.IconFont))
ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString());
if (ImGui.IsItemHovered())
{
string text = string.Join(Environment.NewLine, groupedfiles.Select(f =>
$"{f.Key}: {f.Count()} files, size: {UiSharedService.ByteToString(f.Sum(v => v.OriginalSize))}, compressed: {UiSharedService.ByteToString(f.Sum(v => v.CompressedSize))}"));
ImGui.SetTooltip(text);
}
ImGui.TableNextColumn();
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{kvp.Key} size (actual):");
ImGui.TableNextColumn();
ImGui.TextUnformatted(UiSharedService.ByteToString(kvp.Value.Sum(c => c.Value.OriginalSize)));
ImGui.TableNextColumn();
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{kvp.Key} size (compressed for up/download only):");
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TableNextColumn();
ImGui.TextUnformatted(UiSharedService.ByteToString(kvp.Value.Sum(c => c.Value.CompressedSize)));
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TableNextColumn();
var vramUsage = groupedfiles.SingleOrDefault(v => string.Equals(v.Key, "tex", StringComparison.Ordinal));
if (vramUsage != null)
{
var actualVramUsage = vramUsage.Sum(f => f.OriginalSize);
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{kvp.Key} VRAM usage:");
ImGui.TableNextColumn();
ImGui.TextUnformatted(UiSharedService.ByteToString(actualVramUsage));
ImGui.TableNextColumn();
if (_playerPerformanceConfig.Current.WarnOnExceedingThresholds
|| _playerPerformanceConfig.Current.ShowPerformanceIndicator)
{
var currentVramWarning = _playerPerformanceConfig.Current.VRAMSizeWarningThresholdMiB;
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted("Configured VRAM threshold:");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{currentVramWarning} MiB.");
ImGui.TableNextColumn();
if (currentVramWarning * 1024 * 1024 < actualVramUsage)
{
UiSharedService.ColorText(
$"You exceed your own threshold by {UiSharedService.ByteToString(actualVramUsage - (currentVramWarning * 1024 * 1024))}",
UIColors.Get("LightlessYellow"));
}
}
}
var actualTriCount = kvp.Value.Sum(f => f.Value.Triangles);
ImGui.TableNextRow();
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{kvp.Key} modded model triangles:");
ImGui.TableNextColumn();
ImGui.TextUnformatted(actualTriCount.ToString());
ImGui.TableNextColumn();
if (_playerPerformanceConfig.Current.WarnOnExceedingThresholds if (_playerPerformanceConfig.Current.WarnOnExceedingThresholds
|| _playerPerformanceConfig.Current.ShowPerformanceIndicator) || _playerPerformanceConfig.Current.ShowPerformanceIndicator)
{ {
using var _ = ImRaii.PushIndent(10f); var currentTriWarning = _playerPerformanceConfig.Current.TrisWarningThresholdThousands;
var currentVramWarning = _playerPerformanceConfig.Current.VRAMSizeWarningThresholdMiB;
ImGui.TextUnformatted($"Configured VRAM warning threshold: {currentVramWarning} MiB."); ImGui.TableNextRow();
if (currentVramWarning * 1024 * 1024 < actualVramUsage) ImGui.TableNextColumn();
ImGui.TextUnformatted("Configured triangle threshold:");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{currentTriWarning * 1000} triangles.");
ImGui.TableNextColumn();
if (currentTriWarning * 1000 < actualTriCount)
{ {
UiSharedService.ColorText($"You exceed your own threshold by " + UiSharedService.ColorText(
$"{UiSharedService.ByteToString(actualVramUsage - (currentVramWarning * 1024 * 1024))}.", $"You exceed your own threshold by {actualTriCount - (currentTriWarning * 1000)}",
UIColors.Get("LightlessYellow")); UIColors.Get("LightlessYellow"));
} }
} }
ImGui.EndTable();
} }
var actualTriCount = kvp.Value.Sum(f => f.Value.Triangles); ImGui.PopStyleVar(2);
ImGui.TextUnformatted($"{kvp.Key} modded model triangles: {actualTriCount}");
if (_playerPerformanceConfig.Current.WarnOnExceedingThresholds _uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
|| _playerPerformanceConfig.Current.ShowPerformanceIndicator)
_uiSharedService.MediumText("Selected file:", UIColors.Get("LightlessBlue"));
ImGui.SameLine();
_uiSharedService.MediumText(_selectedHash, UIColors.Get("LightlessYellow"));
if (_cachedAnalysis[_selectedObjectTab].TryGetValue(_selectedHash, out CharacterAnalyzer.FileDataEntry? item))
{ {
using var _ = ImRaii.PushIndent(10f); var filePaths = item.FilePaths;
var currentTriWarning = _playerPerformanceConfig.Current.TrisWarningThresholdThousands; UiSharedService.ColorText("Local file path:", UIColors.Get("LightlessBlue"));
ImGui.TextUnformatted($"Configured triangle warning threshold: {currentTriWarning * 1000} triangles."); ImGui.SameLine();
if (currentTriWarning * 1000 < actualTriCount) UiSharedService.TextWrapped(filePaths[0]);
if (filePaths.Count > 1)
{ {
UiSharedService.ColorText($"You exceed your own threshold by " + ImGui.SameLine();
$"{actualTriCount - (currentTriWarning * 1000)} triangles.", ImGui.TextUnformatted($"(and {filePaths.Count - 1} more)");
UIColors.Get("LightlessYellow")); ImGui.SameLine();
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, filePaths.Skip(1)));
}
var gamepaths = item.GamePaths;
UiSharedService.ColorText("Used by game path:", UIColors.Get("LightlessBlue"));
ImGui.SameLine();
UiSharedService.TextWrapped(gamepaths[0]);
if (gamepaths.Count > 1)
{
ImGui.SameLine();
ImGui.TextUnformatted($"(and {gamepaths.Count - 1} more)");
ImGui.SameLine();
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, gamepaths.Skip(1)));
} }
} }
ImGui.Separator(); ImGui.Separator();
if (_selectedObjectTab != kvp.Key) if (_selectedObjectTab != kvp.Key)
{ {
_selectedHash = string.Empty; _selectedHash = string.Empty;
@@ -692,41 +766,6 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
} }
} }
} }
ImGui.Separator();
ImGui.TextUnformatted("Selected file:");
ImGui.SameLine();
UiSharedService.ColorText(_selectedHash, UIColors.Get("LightlessYellow"));
if (_cachedAnalysis[_selectedObjectTab].TryGetValue(_selectedHash, out CharacterAnalyzer.FileDataEntry? item))
{
var filePaths = item.FilePaths;
ImGui.TextUnformatted("Local file path:");
ImGui.SameLine();
UiSharedService.TextWrapped(filePaths[0]);
if (filePaths.Count > 1)
{
ImGui.SameLine();
ImGui.TextUnformatted($"(and {filePaths.Count - 1} more)");
ImGui.SameLine();
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, filePaths.Skip(1)));
}
var gamepaths = item.GamePaths;
ImGui.TextUnformatted("Used by game path:");
ImGui.SameLine();
UiSharedService.TextWrapped(gamepaths[0]);
if (gamepaths.Count > 1)
{
ImGui.SameLine();
ImGui.TextUnformatted($"(and {gamepaths.Count - 1} more)");
ImGui.SameLine();
_uiSharedService.IconText(FontAwesomeIcon.InfoCircle);
UiSharedService.AttachToolTip(string.Join(Environment.NewLine, gamepaths.Skip(1)));
}
}
} }
public override void OnOpen() public override void OnOpen()
@@ -855,7 +894,7 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
} }
var filePath = item.FilePaths[0]; var filePath = item.FilePaths[0];
bool toConvert = _texturesToConvert.ContainsKey(filePath); bool toConvert = _texturesToConvert.ContainsKey(filePath);
if (ImGui.Checkbox("###convert" + item.Hash, ref toConvert)) if (UiSharedService.CheckboxWithBorder("###convert" + item.Hash, ref toConvert, UIColors.Get("LightlessPurple"), 1.5f))
{ {
if (toConvert && !_texturesToConvert.ContainsKey(filePath)) if (toConvert && !_texturesToConvert.ContainsKey(filePath))
{ {

View File

@@ -979,9 +979,17 @@ public class SettingsUi : WindowMediatorSubscriberBase
var colorNames = new[] var colorNames = new[]
{ {
("LightlessPurple", "Lightless Purple", "Primary colors"), ("LightlessPurple", "Lightless Purple", "Primary colors"),
("LightlessPurpleActive", "Lightless Purple Active", "Primary colors"),
("LightlessPurpleDefault", "Lightless Purple Inactive", "Primary colors"),
("LightlessBlue", "Lightless Blue", "Secondary colors"), ("LightlessBlue", "Lightless Blue", "Secondary colors"),
("LightlessGreen", "Lightless Green", "Active elements"),
("LightlessYellow", "Lightless Yellow", "Warning colors"), ("LightlessYellow", "Lightless Yellow", "Warning colors"),
("LightlessYellow2", "Lightless Yellow 2", "Warning colors"),
("PairBlue", "Pair Blue", "Pair UI elements"), ("PairBlue", "Pair Blue", "Pair UI elements"),
("DimRed", "Dim Red", "Error and offline") ("DimRed", "Dim Red", "Error and offline")
}; };
@@ -1020,6 +1028,8 @@ public class SettingsUi : WindowMediatorSubscriberBase
ImGui.Spacing(); ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Server Info Bar Colors"); ImGui.TextUnformatted("Server Info Bar Colors");
if (ImGui.Checkbox("Color-code the Server Info Bar entry according to status", ref useColorsInDtr)) if (ImGui.Checkbox("Color-code the Server Info Bar entry according to status", ref useColorsInDtr))
@@ -1054,6 +1064,9 @@ public class SettingsUi : WindowMediatorSubscriberBase
} }
ImGui.Spacing(); ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
ImGui.TextUnformatted("Nameplate Colors"); ImGui.TextUnformatted("Nameplate Colors");
var nameColorsEnabled = _configService.Current.IsNameplateColorsEnabled; var nameColorsEnabled = _configService.Current.IsNameplateColorsEnabled;
@@ -1092,6 +1105,10 @@ public class SettingsUi : WindowMediatorSubscriberBase
} }
} }
ImGui.Spacing();
_uiShared.ColoredSeparator(UIColors.Get("LightlessPurpleDefault"), 1.5f);
if (ImGui.Checkbox("Use the complete redesign of the UI for Lightless client.", ref useLightlessRedesign)) if (ImGui.Checkbox("Use the complete redesign of the UI for Lightless client.", ref useLightlessRedesign))
{ {
_configService.Current.UseLightlessRedesign = useLightlessRedesign; _configService.Current.UseLightlessRedesign = useLightlessRedesign;

View File

@@ -512,6 +512,21 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
ImGui.Dummy(new Vector2(0, thickness * scale)); ImGui.Dummy(new Vector2(0, thickness * scale));
} }
public static bool CheckboxWithBorder(string label, ref bool value, Vector4? borderColor = null, float borderThickness = 1.0f, float rounding = 3.0f)
{
var pos = ImGui.GetCursorScreenPos();
bool changed = ImGui.Checkbox(label, ref value);
var min = pos;
var max = ImGui.GetItemRectMax();
var col = ImGui.GetColorU32(borderColor ?? ImGuiColors.DalamudGrey);
ImGui.GetWindowDrawList().AddRect(min, max, col, rounding, ImDrawFlags.None, borderThickness);
return changed;
}
public void MediumText(string text, Vector4? color = null) public void MediumText(string text, Vector4? color = null)
{ {
FontText(text, MediumFont, color); FontText(text, MediumFont, color);