Skip to content

Commit

Permalink
Add schematic browser tag prune
Browse files Browse the repository at this point in the history
  • Loading branch information
sbxte committed Jan 28, 2024
1 parent 5057bc1 commit 87ab85a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/mindustry/client/ui/SchematicBrowserDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@ void tagsChanged(){
Core.settings.putJson("schematic-tags", String.class, tags);
}

public void pruneTags() {
tags.removeAll(t -> { // Remove tags not attached to any schematics
for (var ss: loadedRepositories.values()) {
if (ss.find(s -> s.labels.contains(t)) != null) return false;
}
return true;
});
}

void showAllTags(){
var dialog = new BaseDialog("@schematic.edittags");
dialog.addCloseButton();
Expand All @@ -365,6 +374,7 @@ void showAllTags(){
p.table(t -> {
t.left().defaults().fillX().height(tagh).pad(2);
t.button("@client.schematic.cleartags", Icon.refresh, selectedTags::clear).wrapLabel(false).get().getLabelCell().padLeft(5);
t.button("@client.schematic.prunetags", Icon.trash, this::pruneTags).wrapLabel(false).get().getLabelCell().padLeft(5);
});
p.row();

Expand Down

0 comments on commit 87ab85a

Please sign in to comment.