Closed sk33z3r closed 2 years ago
Seems like it might be breaking down somewhere around these lines https://github.com/sk33z3r/LooPyGen/blob/main/generator/generate.py#L166-L169
But I don't see how exactly. Otherwise I don't really see how it's mis-matching in the code unless I have something set wrong in traits. Just for posterity, here's the whole file. I'm baffled why layer00-layer03 works, but layer04 fails.
## Give the collection a name
COLLECTION_NAME="Tropical JEFF"
## Layers dictionary
layers = [
{ # Background color
"layer_name": "Background color",
"rgba": {
"Red": (192, 54, 54, 255),
"Green": ( 54, 192, 54, 255),
"Blue": ( 54, 54, 192, 255),
"None": ( 0, 0, 0, 0),
"Black": ( 0, 0, 0, 255),
"White": (255, 255, 255, 255)
},
"weights": [
2,
2,
2,
1,
3,
4
],
"size": (4820, 4873) # Adjust to the size of your images
},
{ # layer01
"layer_name": "Body",
"filenames": {
"JEFF": "01-base.png"
},
"weights": [
100
]
},
{ # layer02
"layer_name": "Top",
"filenames": {
"Purple Bra": "05-shirt.png",
"Green Bra": "06-shirt.png",
"Peach Bra": "07-shirt.png",
"Yellow Bra": "08-shirt.png",
"Red Bra": "09-shirt.png",
"Pink Bra": "10-shirt.png",
"Pink Shirt": "11-shirt.png",
"Green Shirt": "12-shirt.png",
"Blue Shirt": "13-shirt.png",
"Purple Shirt": "14-shirt.png",
"Orange Shirt": "15-shirt.png"
},
"weights": [
1,
2,
4,
3,
2,
2,
4,
3,
1,
1,
2
]
},
{ # layer03
"layer_name": "Pants",
"filenames": {
"Blue Swimpants": "swimpants/01-swimpant.png",
"Green Speedo": "swimpants/02-swimpant.png",
"Pink Speedo": "swimpants/03-swimpant.png",
"Orange Speedo": "swimpants/04-swimpant.png",
"Red Speedo": "swimpants/05-swimpant.png",
"Blue Speedo": "swimpants/06-swimpant.png",
"Green Swimpants": "swimpants/07-swimpant.png",
"Yellow Swimpants": "swimpants/08-swimpant.png",
"Orange Swimpants": "swimpants/09-swimpant.png",
"Red Swimpants": "swimpants/10-swimpant.png",
"Hula Skirt 01": "hula-skirt/01-skirt.png",
"Hula Skirt 02": "hula-skirt/02-skirt.png",
"Hula Skirt 03": "hula-skirt/03-skirt.png",
"Hula Skirt 04": "hula-skirt/04-skirt.png",
"Hula Skirt 05": "hula-skirt/05-skirt.png",
"Hula Skirt 06": "hula-skirt/06-skirt.png",
"Hula Skirt 07": "hula-skirt/07-skirt.png",
"Hula Skirt 08": "hula-skirt/08-skirt.png",
"Hula Skirt 09": "hula-skirt/09-skirt.png",
"Hula Skirt 10": "hula-skirt/10-skirt.png",
"Hula Skirt 11": "hula-skirt/11-skirt.png",
"Hula Skirt 12": "hula-skirt/12-skirt.png",
"Hula Skirt 13": "hula-skirt/13-skirt.png",
"Hula Skirt 14": "hula-skirt/14-skirt.png",
"Hula Skirt 15": "hula-skirt/15-skirt.png",
"Hula Skirt 16": "hula-skirt/16-skirt.png",
"Green Pants": "pants/01-pants.png",
"Teal Pants": "pants/02-pants.png",
"Purple Pants": "pants/03-pants.png",
"Red Pants": "pants/04-pants.png",
"Yellow Pants": "pants/05-pants.png",
"Orange Pants": "pants/06-pants.png",
"Blue Pants": "pants/07-pants.png"
},
"weights": [
25,
15,
15,
15,
15,
15,
25,
25,
25,
25,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
10,
40,
40,
40,
40,
40,
40,
40
]
},
{ # layer04
"layer_name": "Belt",
"filenames": {
"Black Belt": "01-belt.png",
"Purple Belt": "02-belt.png",
"Red Belt": "03-belt.png",
"Green Belt": "04-belt.png",
"Yellow Belt": "05-belt.png",
"Purple Belt": "06-belt.png"
},
"weights": [
1,
2,
4,
3,
2,
2
]
}
]
def get_variation_cnt():
cnt = 1
for l in layers:
cnt *= len(l["weights"])
return cnt
I am testing a fix for #25 and noticed that even when I take out layer00 (Background Color), the weights still seem to be mismatched if I have layer04 in there. So it doesn't seem to have anything to do with the actual amount of layers. Still thinking there's an issue I am overlooking in my layer04 syntax, though.
Dictionary keys need to be unique. You have 2 "Purple belts" in your layer04 definition
"filenames": {
"Black Belt": "01-belt.png",
"Purple Belt": "02-belt.png",
"Red Belt": "03-belt.png",
"Green Belt": "04-belt.png",
"Yellow Belt": "05-belt.png",
"Purple Belt": "06-belt.png"
},
Some times a second pair of eyes is all you need, closing
I'm running some test generations for a PG thing, and running into an issue I can't seem to sort out.
Using the new Background setup, I have traits from Background to layer03 setup. Generates without issue all the way through.
However, as soon as I add layer04, I get the following error:
I've triple checked my new layer, but I am quite sure the syntax is right, and the weights to filenames ratio is 1:1. When I remove this layer from traits, the script generates without issue. Here is the layer that causes the error, maybe I am missing something obvious: