Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Yafc.UI/ImGui/ImGuiBuildCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ public void Skip() {
private int buildGroupsIndex = -1;
private readonly List<BuildGroup> buildGroups = [];

public void ClearBuildGroupCache() {
buildGroups.Clear();
buildGroupsIndex = -1;
}

private void TrimUnusedBuildGroups() {
int usedCount = buildGroupsIndex + 1;
if (usedCount < buildGroups.Count) {
buildGroups.RemoveRange(usedCount, buildGroups.Count - usedCount);
}
}

public bool ShouldBuildGroup(object o, [MaybeNullWhen(false)] out BuildGroup group) {
buildGroupsIndex++;
BuildGroup current;
Expand Down
1 change: 1 addition & 0 deletions Yafc.UI/ImGui/ImGuiBuilding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ private void BuildGui(float width) {
rebuildRequested = false;
ClearDrawCommandList();
_ = DoGui(ImGuiAction.Build);
TrimUnusedBuildGroups();
contentSize = new Vector2(lastContentRect.Right, lastContentRect.Height);

if (boxColor != SchemeColor.None) {
Expand Down
Loading