diff --git a/src/Generator_room/Batch-Sorter.py b/Batch-Sorter.py similarity index 100% rename from src/Generator_room/Batch-Sorter.py rename to Batch-Sorter.py diff --git a/src/Generator_room/DNA-Generator.py b/DNA-Generator.py similarity index 80% rename from src/Generator_room/DNA-Generator.py rename to DNA-Generator.py index 2cf2854..56f5134 100644 --- a/src/Generator_room/DNA-Generator.py +++ b/DNA-Generator.py @@ -46,15 +46,48 @@ def returnData(): attributeVariants = [x for x in listAllCollections if x not in attributeCollections] attributeCollections1 = copy.deepcopy(attributeCollections) + def attributeData(attributeVariants): + allAttDataList = {} + for i in attributeVariants: + + def getStr(i): + name_1 = re.sub(r'[^a-zA-Z]', "", i) + return name_1 + + def getOrder_rarity(i): + x = re.sub(r'[a-zA-Z]', "", i) + a = x.split("_") + del a[0] + return list(a) + + name = getStr(i) + orderRarity = getOrder_rarity(i) + number = orderRarity[0] + rarity = orderRarity[1] + + eachObject = {"name": name, "number": number, "rarity": rarity} + + allAttDataList[i] = eachObject + return allAttDataList + + variantMetaData = attributeData(attributeVariants) + def getChildren(): - parentDictionary = {} + hierarchy = {} for i in attributeCollections1: colParLong = list(bpy.data.collections[str(i)].children) - colParShort =[] + colParShort = {} for x in colParLong: - colParShort.append(x.name) - parentDictionary[i] = colParShort - return parentDictionary + colParShort[x.name] = None + hierarchy[i] = colParShort + + for a in hierarchy: + for b in hierarchy[a]: + for x in variantMetaData: + if str(x) == str(b): + (hierarchy[a])[b] = variantMetaData[x] + + return hierarchy hierarchy = getChildren() @@ -69,56 +102,18 @@ def returnData(): possibleCombinations = numOfCombinations(hierarchy) - def attributeData(attributeVariants): - allAttDataList = {} - for i in attributeVariants: - - def getParent(i): - parent = "" - for w in hierarchy: - listChild = hierarchy[w] - if i in listChild: - parent = w - - return parent - - def getStr(i): - name_1 = re.sub(r'[^a-zA-Z]', "", i) - return name_1 - - def getOrder_rarity(i): - x = re.sub(r'[a-zA-Z]', "", i) - a = x.split("_") - del a[0] - return list(a) - - fullName = i - name = getStr(i) - orderRarity = getOrder_rarity(i) - number = orderRarity[0] - rarity = orderRarity[1] - parentCollection = getParent(i) - - eachObject = {"fullName": fullName, "name": name, "number": number, "rarity": rarity, "parentCollection": parentCollection} - - allAttDataList[fullName] = eachObject - return allAttDataList - - variantMetaData = attributeData(attributeVariants) - for i in variantMetaData: def cameraToggle(i,toggle = True): bpy.data.collections[i].hide_render = toggle bpy.data.collections[i].hide_viewport = toggle cameraToggle(i) - return listAllCollections, attributeCollections, attributeCollections1, hierarchy, variantMetaData, possibleCombinations -listAllCollections, attributeCollections, attributeCollections1, hierarchy, variantMetaData, possibleCombinations = returnData() + return listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations +listAllCollections, attributeCollections, attributeCollections1, hierarchy, possibleCombinations = returnData() -def generateNFT_DNA(variantMetaData, possibleCombinations): +def generateNFT_DNA(possibleCombinations): ''' - :param variantMetaData: The variantMetaData :return: the batch dictionary of the NFT's being created, there dna, and attributes ''' batchDataDictionary = {} @@ -149,28 +144,23 @@ def generateNFT_DNA(variantMetaData, possibleCombinations): #Data stored in batchDataDictionary: batchDataDictionary["numNFTsGenerated"] = possibleCombinations batchDataDictionary["hierarchy"] = hierarchy - batchDataDictionary["variantMetaData"] = variantMetaData batchDataDictionary["DNAList"] = allDNAstr return batchDataDictionary -DataDictionary = generateNFT_DNA(variantMetaData, possibleCombinations) +DataDictionary = generateNFT_DNA(possibleCombinations) -def sendToJSON(): +print(DataDictionary) + +def send_To_Record_JSON(): ''' Sends 'batchDataDictionary' dictionary to the NFTRecord.json file. ''' - file_name = os.path.join(save_path, "NFTRecord.json") - ledger = json.load(open(file_name)) - num = 1 - for i in ledger: - num += 1 - ledger[num] = DataDictionary + ledger = json.dumps(DataDictionary, indent=1, ensure_ascii=True) - ledger = json.dumps(ledger, indent=1, ensure_ascii=True) - - with open(file_name, 'w') as outfile: + with open(os.path.join(save_path, "NFTRecord.json"), 'w') as outfile: outfile.write(ledger + '\n') + print("") print("All possible combinations of DNA sent to NFTRecord.json with " + str(possibleCombinations) + "\nNFT DNA sequences generated in %.4f seconds" % (time.time() - time_start)) print("") @@ -179,7 +169,7 @@ def sendToJSON(): print("༼ ºل͟º ༼ ºل͟º ༼ ºل͟º ༽ ºل͟º ༽ ºل͟º ༽") print("") -#sendToJSON() +send_To_Record_JSON() '''Utility functions:''' diff --git a/NFTCozy.blend b/NFTCozy.blend new file mode 100644 index 0000000..2498d59 Binary files /dev/null and b/NFTCozy.blend differ diff --git a/NFTRecord.json b/NFTRecord.json new file mode 100644 index 0000000..fd38ad0 --- /dev/null +++ b/NFTRecord.json @@ -0,0 +1,143 @@ +{ + "numNFTsGenerated": 64, + "hierarchy": { + "AreaLight": { + "BobisAlive_1_0": { + "name": "BobisAlive", + "number": "1", + "rarity": "0" + }, + "AreaLight_2_0": { + "name": "AreaLight", + "number": "2", + "rarity": "0" + } + }, + "Cube": { + "Cube_1_0": { + "name": "Cube", + "number": "1", + "rarity": "0" + }, + "Cube_2_0": { + "name": "Cube", + "number": "2", + "rarity": "0" + } + }, + "Curve": { + "Curve_1_0": { + "name": "Curve", + "number": "1", + "rarity": "0" + }, + "Curve_2_0": { + "name": "Curve", + "number": "2", + "rarity": "0" + } + }, + "PointLight": { + "PointLight_1_0": { + "name": "PointLight", + "number": "1", + "rarity": "0" + }, + "PointLight_2_0": { + "name": "PointLight", + "number": "2", + "rarity": "0" + } + }, + "Sphere": { + "Sphere_1_0": { + "name": "Sphere", + "number": "1", + "rarity": "0" + }, + "Sphere_2_0": { + "name": "Sphere", + "number": "2", + "rarity": "0" + } + }, + "Text": { + "Text_1_0": { + "name": "Text", + "number": "1", + "rarity": "0" + }, + "Text_2_0": { + "name": "Text", + "number": "2", + "rarity": "0" + } + } + }, + "DNAList": [ + "1-1-1-1-1-1", + "1-1-1-1-1-2", + "1-1-1-1-2-1", + "1-1-1-1-2-2", + "1-1-1-2-1-1", + "1-1-1-2-1-2", + "1-1-1-2-2-1", + "1-1-1-2-2-2", + "1-1-2-1-1-1", + "1-1-2-1-1-2", + "1-1-2-1-2-1", + "1-1-2-1-2-2", + "1-1-2-2-1-1", + "1-1-2-2-1-2", + "1-1-2-2-2-1", + "1-1-2-2-2-2", + "1-2-1-1-1-1", + "1-2-1-1-1-2", + "1-2-1-1-2-1", + "1-2-1-1-2-2", + "1-2-1-2-1-1", + "1-2-1-2-1-2", + "1-2-1-2-2-1", + "1-2-1-2-2-2", + "1-2-2-1-1-1", + "1-2-2-1-1-2", + "1-2-2-1-2-1", + "1-2-2-1-2-2", + "1-2-2-2-1-1", + "1-2-2-2-1-2", + "1-2-2-2-2-1", + "1-2-2-2-2-2", + "2-1-1-1-1-1", + "2-1-1-1-1-2", + "2-1-1-1-2-1", + "2-1-1-1-2-2", + "2-1-1-2-1-1", + "2-1-1-2-1-2", + "2-1-1-2-2-1", + "2-1-1-2-2-2", + "2-1-2-1-1-1", + "2-1-2-1-1-2", + "2-1-2-1-2-1", + "2-1-2-1-2-2", + "2-1-2-2-1-1", + "2-1-2-2-1-2", + "2-1-2-2-2-1", + "2-1-2-2-2-2", + "2-2-1-1-1-1", + "2-2-1-1-1-2", + "2-2-1-1-2-1", + "2-2-1-1-2-2", + "2-2-1-2-1-1", + "2-2-1-2-1-2", + "2-2-1-2-2-1", + "2-2-1-2-2-2", + "2-2-2-1-1-1", + "2-2-2-1-1-2", + "2-2-2-1-2-1", + "2-2-2-1-2-2", + "2-2-2-2-1-1", + "2-2-2-2-1-2", + "2-2-2-2-2-1", + "2-2-2-2-2-2" + ] +} diff --git a/src/Generator_room/PNG-Gerneator.py b/PNG-Gerneator.py similarity index 100% rename from src/Generator_room/PNG-Gerneator.py rename to PNG-Gerneator.py diff --git a/conFig.py b/conFig.py index 57c30ea..c87ed18 100644 --- a/conFig.py +++ b/conFig.py @@ -4,11 +4,10 @@ # The number of NFTs desired to be minted: numNFTs = 96 -batch_file_name = 'Batch1' nftsPerBatch = None # The path to the "Blender_Image_Generator" file -save_path = '/Users/torrinleonard/Desktop/Blender_Image_Generator' -json_save_path = '/Users/torrinleonard/Desktop/Blender_Image_Generator/Json-folder' -batch_path = '/Users/torrinleonard/Desktop/Blender_Image_Generator/Json-folder/{}'.format(batch_file_name) \ No newline at end of file +save_path = '/Users/torrinleonard/Desktop/Blend_My_NFTs' +batch_path = '/Users/torrinleonard/Desktop/Blend_My_NFTs/Batch_Json_files' +images_path = '/Users/torrinleonard/Desktop/Blend_My_NFTs/Images from PNG Generator' \ No newline at end of file diff --git a/src/Json_files/NFTRecord.json b/src/Json_files/NFTRecord.json deleted file mode 100644 index 2c63c08..0000000 --- a/src/Json_files/NFTRecord.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -}