Closed Ponda1 closed 3 years ago
Am wondering how to fix this also
use v3 branch.
you can find the code on line 63 here. https://github.com/HashLips/generative-art-opensource/blob/v3/index.js
Thank you for reply i tried this and it will not return the name of the layer ie the folder name
Ok Im a complete noob but I managed to solve this issue after a lot work. Basically what I did is add
var path = require('path')
to the beginning of the index file and changed the const getAttributeForElement to
const getAttributeForElement = (_element) => { let selectedElement = _element.layer.selectedElement; var parentDir = path.dirname(_element.layer.selectedElement.path); var baseDir = require('path').resolve(parentDir, '..'); var traitName = path.basename(baseDir); let attribute = { trait_type: traitName, value: selectedElement.name, rarity: selectedElement.rarity, }; return attribute; };
This now outputs the trait_type and value for each nft. :D
Ok Im a complete noob but I managed to solve this issue after a lot work. Basically what I did is add
var path = require('path')
to the beginning of the index file and changed the const getAttributeForElement to
const getAttributeForElement = (_element) => { let selectedElement = _element.layer.selectedElement; var parentDir = path.dirname(_element.layer.selectedElement.path); var baseDir = require('path').resolve(parentDir, '..'); var traitName = path.basename(baseDir); let attribute = { trait_type: traitName, value: selectedElement.name, rarity: selectedElement.rarity, }; return attribute; };
This now outputs the trait_type and value for each nft. :D
this worked for me you are a LEGEND Ponda1
Legend!
Lol thanks guys i appreciate it. Just trynna help everyone out as much as I can
Ok Im a complete noob but I managed to solve this issue after a lot work. Basically what I did is add
var path = require('path')
to the beginning of the index file and changed the const getAttributeForElement to
const getAttributeForElement = (_element) => { let selectedElement = _element.layer.selectedElement; var parentDir = path.dirname(_element.layer.selectedElement.path); var baseDir = require('path').resolve(parentDir, '..'); var traitName = path.basename(baseDir); let attribute = { trait_type: traitName, value: selectedElement.name, rarity: selectedElement.rarity, }; return attribute; };
This now outputs the trait_type and value for each nft. :D
Sorry I know this was closed a while ago! I'm working on a macro for opensea in selenium and was wondering if it's possible in code for the traitName string to sit where "trait_type" is? So in the metadata it may show as "traitName: selectedElement.name"
Thank you for your hard work!!
How do you include the attribute trait_type in the metadata? currently, only the name of the layer element shows up and not the name of the layer. This removes the ability to add property tags to the nft when minting.