nftchef / art-engine

An advanced fork of the HashLips Art Engine with additional features to generate complex art from provided layers using the familiar Hashlips setup.
MIT License
427 stars 203 forks source link

rarityDelimiter bug for folders #248

Closed jaghachi closed 1 year ago

jaghachi commented 2 years ago

Changing the rarity delimiter from "#" to a different one doesn't get registered for directories with the new delimiter.

The culprit is in "line 62" of "main.js"

const exp = /#(\d*)/;

Although I manually changed the "#" to my custom delimiter and fixed my issue, I wasn't able to figure out how to insert the variable "rarityDelimiter" into that regex for a proper solution.

null-prophet commented 1 year ago

The fix for this breaks probability/rarity configured folders in a nested structure.

After trying this out I get only random layers appearing from the hierarchy and not the full set.

my dir structure:

Type
 - Type1#150
    -- 010 (this is done to order my layers so I can adjust the orders of compatibility)
      -- Fur
         -- fur_1#150
         ... so on
   -- 020 (this has sub layers etc)

I think the regex is somehow skipping these folders with numbers on them. when it has the # its fine.

What about making the regex a template string passing the delimiter value?

const exp = new RegExp(`${rarityDelimiter}(\\d*)`);

one line fix. tested and works for me.

nftchef commented 1 year ago

Thank you for catching this. Will implement

nftchef commented 1 year ago

Fixed in 884bc739678ee07e0d14297738d015e712bbac66