Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
+ Support for incompatible layers (#5)
  • Loading branch information
Jon-Becker committed Nov 2, 2021
1 parent 01245d2 commit 4c59099
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ def create_new_image(all_images, config):
new_image = {}
for layer in config["layers"]:
new_image[layer["name"]] = random.choices(layer["values"], layer["weights"])[0]


for incomp in config["incompatibilities"]:
for attr in new_image:
if new_image[incomp["layer"]] == incomp["value"] and new_image[attr] in incomp["incompatible_with"]:
return create_new_image(all_images, config)

if new_image in all_images:
return create_new_image(all_images, config)
else:
Expand Down Expand Up @@ -82,7 +87,7 @@ def generate_unique_images(amount, config):
"values": ["Blue", "Orange", "Purple", "Red", "Yellow"],
"trait_path": "./trait-layers/backgrounds",
"filename": ["blue", "orange", "purple", "red", "yellow"],
"weights": [30, 45, 15, 5, 10]
"weights": [20,20,20,20,20]
},
{
"name": "Foreground",
Expand All @@ -99,6 +104,13 @@ def generate_unique_images(amount, config):
"weights": [100]
}
],
"incompatibilities": [
{
"layer": "Background",
"value": "Blue",
"incompatible_with": ["Python Logo 2"]
}, # Blue backgrounds will never have the attribute "Python Logo 2".
],
"baseURI": ".",
"name": "NFT #"
})
Expand Down

0 comments on commit 4c59099

Please sign in to comment.