Jon-Becker / nft-generator-py

This tool allows users to generate sets of unique images and metadata using weighted layer collections.
MIT License
301 stars 127 forks source link

Multiple incompatibilities? #47

Closed Visual917 closed 1 year ago

Visual917 commented 1 year ago

If I have 30 of each layers and I want one whole category to be incompatible with the other, my incompatibilities array would be full! Any way to achieve this fast? I need it tomorrow :(

Jon-Becker commented 1 year ago

Duplicate of #42.

"Resolved in https://github.com/Jon-Becker/nft-generator-py/commit/8c005077ba69206f829acbd3d8424e6d463c465b

A new default optional value has been added to incompatibilities. For example:

"incompatibilities": [
    {
      "layer": "Background",
      "value": "Blue",
      "incompatible_with": ["Python Logo 2"],
      "default": {
        "value": "Default Incompatibility",
        "filename": "./trait-layers/foreground/logo"
      }
    }
  ],

If a blue Background is selected with Python Logo 2, the program will replace it with Default Incompatibility with the image path ./trait-layers/foreground/logo.png.

You can use this with a blank layer to achieve your results. Just make incompatibilities with every item in the incompatible layer, and add a default None with a blank image."

Visual917 commented 1 year ago

@Jon-Becker Hey :) What I meant was how would I get out of 'making incompatibilities with EVERY ITEM in the incompatible layer'. But I found an easy fix!

In Line 22 of generate.py: I switched if new_image[incomp["layer"]] == incomp["value"] and new_image[attr] in incomp["incompatible_with"]: with if new_image[incomp["layer"]] in incomp["value"] and new_image[attr] in incomp["incompatible_with"]:

So it treats both entries as an array and checks if they overlap! It works so far for me with a slight outage!