Added debug mode for lightfinder IMGUI, added caching of file cache entries to reduce load of loading all entries again.
This commit is contained in:
@@ -968,20 +968,25 @@ public class DataAnalysisUi : WindowMediatorSubscriberBase
|
||||
Dictionary<ObjectKind, Dictionary<string, CharacterAnalyzer.FileDataEntry>> source)
|
||||
{
|
||||
var clone = new Dictionary<ObjectKind, Dictionary<string, CharacterAnalyzer.FileDataEntry>>(source.Count);
|
||||
|
||||
foreach (var (objectKind, entries) in source)
|
||||
{
|
||||
var entryClone = new Dictionary<string, CharacterAnalyzer.FileDataEntry>(entries.Count, entries.Comparer);
|
||||
|
||||
foreach (var (hash, entry) in entries)
|
||||
{
|
||||
entryClone[hash] = new CharacterAnalyzer.FileDataEntry(
|
||||
hash,
|
||||
entry.FileType,
|
||||
entry.GamePaths.ToList(),
|
||||
entry.FilePaths.ToList(),
|
||||
entry.OriginalSize,
|
||||
entry.CompressedSize,
|
||||
entry.Triangles);
|
||||
hash: hash,
|
||||
fileType: entry.FileType,
|
||||
gamePaths: entry.GamePaths?.ToList() ?? [],
|
||||
filePaths: entry.FilePaths?.ToList() ?? [],
|
||||
originalSize: entry.OriginalSize,
|
||||
compressedSize: entry.CompressedSize,
|
||||
triangles: entry.Triangles,
|
||||
cacheEntries: entry.CacheEntries
|
||||
);
|
||||
}
|
||||
|
||||
clone[objectKind] = entryClone;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace LightlessSync.UI
|
||||
private readonly LightFinderService _broadcastService;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private readonly LightFinderScannerService _broadcastScannerService;
|
||||
private readonly LightFinderPlateHandler _lightFinderPlateHandler;
|
||||
|
||||
private IReadOnlyList<GroupFullInfoDto> _allSyncshells = Array.Empty<GroupFullInfoDto>();
|
||||
private string _userUid = string.Empty;
|
||||
@@ -38,7 +39,8 @@ namespace LightlessSync.UI
|
||||
UiSharedService uiShared,
|
||||
ApiController apiController,
|
||||
LightFinderScannerService broadcastScannerService
|
||||
) : base(logger, mediator, "Lightfinder###LightlessLightfinderUI", performanceCollectorService)
|
||||
,
|
||||
LightFinderPlateHandler lightFinderPlateHandler) : base(logger, mediator, "Lightfinder###LightlessLightfinderUI", performanceCollectorService)
|
||||
{
|
||||
_broadcastService = broadcastService;
|
||||
_uiSharedService = uiShared;
|
||||
@@ -50,6 +52,7 @@ namespace LightlessSync.UI
|
||||
WindowBuilder.For(this)
|
||||
.SetSizeConstraints(new Vector2(600, 465), new Vector2(750, 525))
|
||||
.Apply();
|
||||
_lightFinderPlateHandler = lightFinderPlateHandler;
|
||||
}
|
||||
|
||||
private void RebuildSyncshellDropdownOptions()
|
||||
@@ -380,9 +383,47 @@ namespace LightlessSync.UI
|
||||
#if DEBUG
|
||||
if (ImGui.BeginTabItem("Debug"))
|
||||
{
|
||||
if (ImGui.CollapsingHeader("LightFinder Plates", ImGuiTreeNodeFlags.DefaultOpen))
|
||||
{
|
||||
var h = _lightFinderPlateHandler;
|
||||
|
||||
var enabled = h.DebugEnabled;
|
||||
if (ImGui.Checkbox("Enable LightFinder debug", ref enabled))
|
||||
h.DebugEnabled = enabled;
|
||||
|
||||
if (h.DebugEnabled)
|
||||
{
|
||||
ImGui.Indent();
|
||||
|
||||
var disableOcc = h.DebugDisableOcclusion;
|
||||
if (ImGui.Checkbox("Disable occlusion (force draw)", ref disableOcc))
|
||||
h.DebugDisableOcclusion = disableOcc;
|
||||
|
||||
var drawUiRects = h.DebugDrawUiRects;
|
||||
if (ImGui.Checkbox("Draw UI rects", ref drawUiRects))
|
||||
h.DebugDrawUiRects = drawUiRects;
|
||||
|
||||
var drawLabelRects = h.DebugDrawLabelRects;
|
||||
if (ImGui.Checkbox("Draw label rects", ref drawLabelRects))
|
||||
h.DebugDrawLabelRects = drawLabelRects;
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.TextUnformatted($"Labels last frame: {h.DebugLabelCountLastFrame}");
|
||||
ImGui.TextUnformatted($"UI rects last frame: {h.DebugUiRectCountLastFrame}");
|
||||
ImGui.TextUnformatted($"Occluded last frame: {h.DebugOccludedCountLastFrame}");
|
||||
ImGui.TextUnformatted($"Last NamePlate frame: {h.DebugLastNameplateFrame}");
|
||||
|
||||
ImGui.Unindent();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.Text("Broadcast Cache");
|
||||
|
||||
if (ImGui.BeginTable("##BroadcastCacheTable", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY, new Vector2(-1, 225f)))
|
||||
if (ImGui.BeginTable("##BroadcastCacheTable", 4,
|
||||
ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders | ImGuiTableFlags.ScrollY,
|
||||
new Vector2(-1, 225f)))
|
||||
{
|
||||
ImGui.TableSetupColumn("CID", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableSetupColumn("IsBroadcasting", ImGuiTableColumnFlags.WidthStretch);
|
||||
|
||||
@@ -2587,7 +2587,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
var selected = i == _lightfinderIconPresetIndex;
|
||||
if (ImGui.Selectable(preview, selected))
|
||||
{
|
||||
_lightfinderIconInput = LightFinderPlateHandler.ToIconEditorString(optionGlyph);
|
||||
_lightfinderIconInput = LightFinderPlateHandler.NormalizeIconGlyph(optionGlyph);
|
||||
_lightfinderIconPresetIndex = i;
|
||||
}
|
||||
}
|
||||
@@ -4063,7 +4063,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
private void RefreshLightfinderIconState()
|
||||
{
|
||||
var normalized = LightFinderPlateHandler.NormalizeIconGlyph(_configService.Current.LightfinderLabelIconGlyph);
|
||||
_lightfinderIconInput = LightFinderPlateHandler.ToIconEditorString(normalized);
|
||||
_lightfinderIconInput = LightFinderPlateHandler.NormalizeIconGlyph(normalized);
|
||||
_lightfinderIconInputInitialized = true;
|
||||
|
||||
_lightfinderIconPresetIndex = -1;
|
||||
@@ -4081,7 +4081,7 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
_configService.Current.LightfinderLabelIconGlyph = normalizedGlyph;
|
||||
_configService.Save();
|
||||
_lightfinderIconInput = LightFinderPlateHandler.ToIconEditorString(normalizedGlyph);
|
||||
_lightfinderIconInput = LightFinderPlateHandler.NormalizeIconGlyph(normalizedGlyph);
|
||||
_lightfinderIconPresetIndex = presetIndex;
|
||||
_lightfinderIconInputInitialized = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user