Icon generation improvements

This commit is contained in:
Anuken
2020-06-12 19:41:06 -04:00
parent 2bd3bc0e13
commit 27522ae494
39 changed files with 7473 additions and 7085 deletions

View File

@@ -99,10 +99,11 @@ public class Generators{
Image colors = new Image(content.blocks().size, 1);
for(Block block : content.blocks()){
block.load();
TextureRegion[] regions = block.getGeneratedIcons();
if(block instanceof Floor){
block.load();
for(TextureRegion region : block.variantRegions()){
GenRegion gen = (GenRegion)region;
if(gen.path == null) continue;
@@ -198,7 +199,7 @@ public class Generators{
}catch(IllegalArgumentException e){
Log.info("Skipping &ly'@'", block.name);
}catch(NullPointerException e){
Log.err("Block &ly'@'&lr has an null region!");
Log.err("Block &ly'@'&lr has an null region!", block);
}
}
@@ -229,7 +230,7 @@ public class Generators{
});
ImagePacker.generate("item-icons", () -> {
for(UnlockableContent item : (Seq<? extends UnlockableContent>)(Seq)Seq.withArrays(content.items(), content.liquids())){
for(UnlockableContent item : Seq.<UnlockableContent>withArrays(content.items(), content.liquids())){
Image base = ImagePacker.get(item.getContentType().name() + "-" + item.name);
for(Cicon icon : Cicon.scaled){
//if(icon.size == base.width) continue;
@@ -339,7 +340,7 @@ public class Generators{
}
try{
Image image = gens.get(floor, ImagePacker.get(floor.generateIcons()[0]));
Image image = gens.get(floor, ImagePacker.get(floor.getGeneratedIcons()[0]));
Image edge = ImagePacker.get("edge-stencil");
Image result = new Image(edge.width, edge.height);

View File

@@ -86,6 +86,14 @@ public class ImagePacker{
return (AtlasRegion)regionCache.get(name);
}
@Override
public AtlasRegion find(String name, String def){
if(!regionCache.containsKey(name)){
return (AtlasRegion)regionCache.get(def);
}
return (AtlasRegion)regionCache.get(name);
}
@Override
public boolean has(String s){
return regionCache.containsKey(s);