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

Fixed bug where z ordering was not parsing correctly in the layer name #262

Closed advra closed 1 year ago

advra commented 1 year ago

Specific case Z layer ordering is a key feature with art engine but is currently broken. Users defining a layer such as "z-10,Cozy Jacket" should evaluate that "Cozy Jacket" would move the item to z index -10 despite its parents structure. The offending method is parseZIndex within src/main.js which attempts to extract and parse an in value with z# Ex. Although "z10," is valid it is fed into theparseInt with z still prepended such as z10 rather than 10.

The function will always evaluate to null. This fix allows for the 3 possible cases below as described in the docs:

Case 1: User defines no override for Cozy Jacket which uses default value from config.js layerConfigurations[] Directory Input:

- Clothing
    - Cozy Jacket

Output:

Case 2: User defines override for Cozy Jacket at -10 Directory Input:

- Clothing
    - z-10,Cozy Jacket

Output:

Case 3: User defines override for Cozy Jacket at 10 Directory Input:

- Clothing
    - z10,Cozy Jacket

Output:

advra commented 1 year ago

Could not reproduce. Closing for now.