thepeanutgalleryandco/create-and-mint-nft-collection

[FEATURE] Add Maximum Repeatability For All Items In A Layer In A Single Configuration

Closed this issue · 2 comments

Summary

Add the ability to specify the maximum repeatability for all items in a layer. At the moment, only the layer's repeatability can be set.

Basic example

Layer X with 10 layer items.
Each layer item should generate a maximum of 2 times.
Grow edition size to 20.
Set the maximum repeatability of layer X to 2.

20 Images should be generated with each layer X item only added twice. Any other generated attempts with the layer X item should be discarded and added to the fail count as the maximum repeatability has been reached.

Motivation

Instead of adding a maximum repeatability of 2 for each of layer X's items, the repeatability can be set once off for all layer items.

A new "layerItemsMaxRepeatedTrait" setting has been added. This setting can be set on a layer level along with any other filtration rules. Please note that if multiple rule sets are used, then whichever rule "violates" first, will trigger the filtration. With the below example, the layer's maxRepeatedTrait limit will trigger before the layerItemsMaxRepeatedTrait. Since the Eye color's maxRepeatedTrait is set even lower, this will trigger before both of the previous limits. The global maxRepeatedTraits limit is set even lower, this will trigger before all three previous limits and this will be written out into the logs.

Take care not to overlap your rules.

Example:

const layerConfigurations = [
    {
      growEditionSizeTo: 2,
      maxRepeatedTraits: 1,
      layersOrder: [
        { name: "Background" },
        { name: "Eyeball" },
        { name: "Eye color", maxRepeatedTrait: 2 },
        { name: "Iris" },
        { name: "Shine", layerItemsMaxRepeatedTrait: 4 },
        { name: "Bottom lid", layerItemsMaxRepeatedTrait: 4, maxRepeatedTrait: 3 },
        { name: "Top lid" },
      ],
      layerItemsMaxRepeatedTraits: [
        { name: "Background/Black", layerItemMaxRepeatedTrait: 4 },
        { name: "Eyeball/Red", layerItemMaxRepeatedTrait: 5 }
      ],
      incompatibleTraits: {
        "Eye color/Cyan": [
          "Eyeball/Red",
        ],
        "Iris/Large": [
          "Bottom lid/High",
          "Top lid/High"
        ],
      },
      dependentTraits: {
        "Eye color/Cyan": [
          "Eyeball/White",
        ],
        "Background/Blue": [
          "Eyeball/Red",
          "Top lid/low"
        ],
      }
    },
];

Tried it, and it works like a charm!
If I have 90 layer items in "body 3" layer and I want no duplicates, here is my config:

const layerConfigurations = [
{
growEditionSizeTo: 90,
layersOrder: [
{ name: "Background" },
{ name: "Body 3", options: { displayName: "Body", }, layerItemsMaxRepeatedTrait: 1 },
{ name: "Hair" },
{ name: "Hat" },
{ name: "Beard" },
{ name: "Glasses Special", options: { displayName: "Glasses", }, },
],
},
];

No need to specify each layerItem (png) in every single layer (folder).
I appreciate your work, thank you!