function to remove all characters except the seleced ones (for creating small swfs to reproduce a bug).. added to debug menu category

This commit is contained in:
honfika@gmail.com
2016-02-12 09:03:48 +01:00
parent 4e6476dad5
commit 4d886bc688
2 changed files with 34 additions and 0 deletions

View File

@@ -2414,6 +2414,35 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
refreshTree(swf);
}
public void removeExceptSelected(SWF swf) {
if (swf == null) {
return;
}
List<TreeItem> sel = tagTree.getAllSelected();
Set<Integer> needed = new HashSet<>();
for (TreeItem item : sel) {
if (item instanceof CharacterTag) {
CharacterTag characterTag = (CharacterTag) item;
characterTag.getNeededCharactersDeep(needed);
needed.add(characterTag.getCharacterId());
}
}
List<Tag> tagsToRemove = new ArrayList<>();
for (Tag tag : swf.getTags()) {
if (tag instanceof CharacterTag) {
CharacterTag characterTag = (CharacterTag) tag;
if (!needed.contains(characterTag.getCharacterId())) {
tagsToRemove.add(tag);
}
}
}
swf.removeTags(tagsToRemove, true);
refreshTree(swf);
}
private void clear() {
dumpViewPanel.clear();
previewPanel.clear();