Jon-Becker / nft-generator-py

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

Issue with recently introduced incompatibilities layer #43

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi Jon,

The incompatibilities layer causes some unwanted behavior that I've been trying to sort out but couldn't find the underlying reason. My collection consists of 6 trait layers (accessory, backgrounds, body, clothing, eyes, head).

Here's an example of an incompatibilities layer configuration:

      "layer": "Clothing",
      "value": "Grey Hoodie",
      "incompatible_with": ["Alien Bucket","Alien Hat","Autism","Bear Bucket","Black Beanie","Bunny","Chairman Der","Che","Coby","Cock Bucket","Commander","Comrad","Crowley","Curli","Dope","Dubai","Durag","Fiddler Cap","Fidela","Fish Cap","Fur Hat","Geeza","General Soggafi","Green Beanie","High Hat","Hippie","Itamae","Khaki Bucket","Killa","Kufi","Le Chique","Mara","Neet","Orange Beanie","Pastafarian","Peak Cap","Propeller Hat","Racer","Slayer","Soggelz","Thizz Cap","Thot Police","Tinfoil Hat","Trapper","Wizard","Yellow Beanie"],
      "default": {
        "value": "None",
        "filename": "./trait-layers/head/None"
      }
    },

However, upon generating, in random occasions whenever the "Grey Hoodie" is drafted it also updates the "Eyes" trait layer and sets it to none, this also happens on other layers such as "Body" of which both should always be compatible (and are not configured in the incompatibilities section).

Below is a metadata example:

    "image": "./images/3.png",
    "tokenId": 3,
    "name": "NFT #03",
    "description": "This is a description for this NFT series.",
    "attributes": [
        {
            "trait_type": "Background",
            "value": "Carentan"
        },
        {
            "trait_type": "Body",
            "value": "None"
        },
        {
            "trait_type": "Eyes",
            "value": "Samsquanch"
        },
        {
            "trait_type": "Clothing",
            "value": "Grey Hoodie"
        },
        {
            "trait_type": "Head",
            "value": "None"
        },
        {
            "trait_type": "Accessory",
            "value": "Phone"
        }
    ]

Notice how the trait type "Body" is set to a value of "None" upon picking the "Grey Hoodie" attribute. Any idea why this might be happening?

Jon-Becker commented 1 year ago

Taking a look. Thank you for bringing this to my attention!

Jon-Becker commented 1 year ago

Is it possible for you to send me your config.json? I am unable to reproduce this issue. You can do so privately through email if you wish ( jonathan@jbecker.dev ). Sorry for the very late reply, just moved in to a new apartment

Defaults for incompatibilities currently work this way:

IF an incompatible layer is selected and is incompatible with an already selected layer, AND a default is set, pick the default. It is possible that one of:

"incompatible_with": ["Alien Bucket","Alien Hat","Autism","Bear Bucket","Black Beanie","Bunny","Chairman Der","Che","Coby","Cock Bucket","Commander","Comrad","Crowley","Curli","Dope","Dubai","Durag","Fiddler Cap","Fidela","Fish Cap","Fur Hat","Geeza","General Soggafi","Green Beanie","High Hat","Hippie","Itamae","Khaki Bucket","Killa","Kufi","Le Chique","Mara","Neet","Orange Beanie","Pastafarian","Peak Cap","Propeller Hat","Racer","Slayer","Soggelz","Thizz Cap","Thot Police","Tinfoil Hat","Trapper","Wizard","Yellow Beanie"],

was the same name for the Head or Eyes layer, and was selected, setting the default for the incompatibility.