kopia lustrzana https://github.com/torrinworx/Blend_My_NFTs
commit
0e556e7f5f
|
@ -6,5 +6,6 @@ Complete_Collection
|
|||
.idea
|
||||
__pycache__
|
||||
NFTRecord.json
|
||||
RarityData.json
|
||||
3D_Model_Test.blend
|
||||
.Ds_Store
|
|
@ -169,8 +169,8 @@ def returnData():
|
|||
print(bcolors.ERROR + "\nERROR:" + bcolors.RESET)
|
||||
print("The collection " + str(i) + " doesn't follow the naming conventions of attributes. Please move this \n"
|
||||
"colleciton to Script_Ignore or review proper collection format in README.md")
|
||||
|
||||
return
|
||||
|
||||
elif len(orderRarity) > 0:
|
||||
number = orderRarity[0]
|
||||
if config.enableGeneration:
|
||||
|
@ -338,8 +338,15 @@ def generateNFT_DNA():
|
|||
possibleCombinations = config.maxNFTs
|
||||
DNAList = Rarity_Sorter.sortRarityWeights(hierarchy, listOptionVariant, DNAList)
|
||||
|
||||
if len(DNAList) < config.maxNFTs:
|
||||
print(f"{bcolors.ERROR} \nWARNING: \n"
|
||||
f"You are seeing this warning because the program cannot generate {config.maxNFTs} NFTs with rarity enabled. "
|
||||
f"Only {len(DNAList)} NFT DNA were generated."
|
||||
f"Either A) Lower the number of NFTs you wish to create, or B) Increase the maximum number of possible NFTs by"
|
||||
f" creating more variants and attributes in your .blend file.{bcolors.RESET}")
|
||||
|
||||
# Data stored in batchDataDictionary:
|
||||
DataDictionary["numNFTsGenerated"] = possibleCombinations
|
||||
DataDictionary["numNFTsGenerated"] = len(DNAList)
|
||||
DataDictionary["hierarchy"] = hierarchy
|
||||
DataDictionary["DNAList"] = DNAList
|
||||
|
||||
|
|
|
@ -19,6 +19,14 @@ from src.Main_Generators import metaData
|
|||
importlib.reload(config)
|
||||
importlib.reload(metaData)
|
||||
|
||||
class bcolors:
|
||||
'''
|
||||
The colour of console messages.
|
||||
'''
|
||||
OK = '\033[92m' # GREEN
|
||||
WARNING = '\033[93m' # YELLOW
|
||||
ERROR = '\033[91m' # RED
|
||||
RESET = '\033[0m' # RESET COLOR
|
||||
|
||||
if config.runPreview:
|
||||
config.nftsPerBatch = config.maxNFTsTest
|
||||
|
|
|
@ -8,7 +8,6 @@ import bpy
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import platform
|
||||
import importlib
|
||||
|
||||
dir = os.path.dirname(bpy.data.filepath)
|
||||
|
@ -19,6 +18,14 @@ from src import config
|
|||
|
||||
importlib.reload(config)
|
||||
|
||||
class bcolors:
|
||||
'''
|
||||
The colour of console messages.
|
||||
'''
|
||||
OK = '\033[92m' # GREEN
|
||||
WARNING = '\033[93m' # YELLOW
|
||||
ERROR = '\033[91m' # RED
|
||||
RESET = '\033[0m' # RESET COLOR
|
||||
|
||||
def checkIfBatchDup():
|
||||
file_name = os.path.join(config.save_path, "NFTRecord.json")
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
# Purpose:
|
||||
# This file is run after the NFTRecord.json and Batch#.json files have been generated. It checks the percentage
|
||||
# each variant is chosen in the NFTRecord, then compares it with its rarity percentage set in the .blend file.
|
||||
|
||||
# Note - This file is provided for transparency. The accuracy of the rarity values you set in your .blend file as outlined
|
||||
# in the README.md file are dependent on the maxNFTs, and the maximum number of combinations of your NFT collection.
|
||||
|
||||
import bpy
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import importlib
|
||||
from collections import Counter
|
||||
from collections import defaultdict
|
||||
|
||||
dir = os.path.dirname(bpy.data.filepath)
|
||||
sys.path.append(dir)
|
||||
sys.modules.values()
|
||||
|
||||
from src import config
|
||||
|
||||
importlib.reload(config)
|
||||
|
||||
class bcolors:
|
||||
'''
|
||||
The colour of console messages.
|
||||
'''
|
||||
OK = '\033[92m' # GREEN
|
||||
WARNING = '\033[93m' # YELLOW
|
||||
ERROR = '\033[91m' # RED
|
||||
RESET = '\033[0m' # RESET COLOR
|
||||
|
||||
def getRealRarity():
|
||||
file_name = os.path.join(config.save_path, "NFTRecord.json")
|
||||
DataDictionary = json.load(open(file_name))
|
||||
numNFTsGenerated = DataDictionary["numNFTsGenerated"]
|
||||
hierarchy = DataDictionary["hierarchy"]
|
||||
DNAList = DataDictionary["DNAList"]
|
||||
|
||||
attributeNames = []
|
||||
numDict = defaultdict(list)
|
||||
|
||||
for i in hierarchy:
|
||||
attributeNames.append(i)
|
||||
|
||||
for i in DNAList:
|
||||
dnaSplitList = i.split("-")
|
||||
|
||||
for j, k in zip(dnaSplitList, attributeNames):
|
||||
numDict[k].append(j)
|
||||
|
||||
numDict = dict(numDict)
|
||||
|
||||
for i in numDict:
|
||||
count = dict(Counter(numDict[i]))
|
||||
numDict[i] = count
|
||||
|
||||
fullNumName = {}
|
||||
|
||||
for i in hierarchy:
|
||||
fullNumName[i] = {}
|
||||
for j in hierarchy[i]:
|
||||
variantNum = hierarchy[i][j]["number"]
|
||||
|
||||
fullNumName[i][variantNum] = j
|
||||
|
||||
completeData = {}
|
||||
|
||||
for i, j in zip(fullNumName, numDict):
|
||||
x = {}
|
||||
|
||||
for k in fullNumName[i]:
|
||||
|
||||
for l in numDict[j]:
|
||||
if l == k:
|
||||
name = fullNumName[i][k]
|
||||
num = numDict[j][l]
|
||||
x[name] = str(round(((num/numNFTsGenerated)*100), 2)) + "%"
|
||||
|
||||
completeData[i] = x
|
||||
|
||||
print(bcolors.OK + "Rarity Checker is active. These are the percentages for each variant per attribute you set in your .blend file:" + bcolors.RESET)
|
||||
|
||||
for i in completeData:
|
||||
print(i + ":")
|
||||
for j in completeData[i]:
|
||||
print(" " + j + ": " + completeData[i][j])
|
||||
|
||||
jsonMetaData = json.dumps(completeData, indent=1, ensure_ascii=True)
|
||||
|
||||
with open(os.path.join(config.save_path, "RarityData.json"), 'w') as outfile:
|
||||
outfile.write(jsonMetaData + '\n')
|
||||
path = os.path.join(config.save_path, "RarityData.json")
|
||||
print(bcolors.OK + f"Rarity Data has been saved to {path}.")
|
||||
|
||||
return
|
||||
|
||||
if __name__ == '__main__':
|
||||
getRealRarity()
|
|
@ -2,9 +2,9 @@
|
|||
# This file determines the settings of your NFT collection. Please read the README.md file to understand how to run this
|
||||
# program.
|
||||
|
||||
nftName = 'Test' # The name of the NFT image produces by PNG-Generator
|
||||
nftName = '' # The name of the NFT image produces by PNG-Generator
|
||||
|
||||
imageFileFormat = 'JPEG' # Dictate the image extension when Blender renders the images
|
||||
imageFileFormat = '' # Dictate the image extension when Blender renders the images
|
||||
# Type the exact name provided below in the '' above:
|
||||
# JPEG - Exports the .jpeg format
|
||||
# PNG - Exports the .png format
|
||||
|
@ -31,21 +31,21 @@ modelFileFormat = '' # The file format of the objects you would like to export
|
|||
# for a complete list of object formats supported by Blender.
|
||||
|
||||
# The path to Blend_My_NFTs folder:
|
||||
save_path_mac = '/Users/torrinleonard/Desktop/ThisCozyStudio/Blend_My_NFTs'
|
||||
save_path_mac = ''
|
||||
save_path_windows = r''
|
||||
# Place the path in the '', e.g: save_path_mac = '/Users/Path/to/Blend_My_NFTs'
|
||||
# Example mac: /Users/Path/to/Blend_My_NFTs
|
||||
# Example windows: C:\Users\Path\to\Blend_My_NFTs
|
||||
|
||||
maxNFTs = 10 # The maximum number of NFTs you want to generate.
|
||||
nftsPerBatch = 10 # Number of NFTs per batch
|
||||
renderBatch = 1 # The batch number to render in Exporter.py
|
||||
maxNFTs = 0 # The maximum number of NFTs you want to generate.
|
||||
nftsPerBatch = 0 # Number of NFTs per batch
|
||||
renderBatch = 0 # The batch number to render in Exporter.py
|
||||
|
||||
# Set to True to generate images or 3D models depending on your settings below when main.py is run in Blender. Only works
|
||||
# if you have already generated NFTRecord.json and all batches.
|
||||
enableExporter = False
|
||||
|
||||
enableImages = True # Renders and exports Images when main.py is run in Blender if enableExporter = True
|
||||
enableImages = False # Renders and exports Images when main.py is run in Blender if enableExporter = True
|
||||
enableAnimations = False # Renders and exports Animations when main.py is run in Blender if enableExporter = True
|
||||
enableModelsBlender = False # Generates 3D models when main.py is run in Blender if enableExporter = True
|
||||
# ^^ Generates models with .blend file NOT external object library.
|
||||
|
@ -65,7 +65,7 @@ refactorBatchOrder = False # When set to True, sorts, renames, and moves all NF
|
|||
|
||||
# Meta Data Templates - Run after refactorBatchOrder
|
||||
# Set the following to True to generate the format of the Meta Data template for your NFTs blockchain. (You can use multiple)
|
||||
cardanoMetaData = True # Cardano - Format Source: https://cips.cardano.org/cips/cip25/
|
||||
cardanoMetaData = False # Cardano - Format Source: https://cips.cardano.org/cips/cip25/
|
||||
solanaMetaData = False # Solana - Format Source: https://docs.metaplex.com/nft-standard
|
||||
erc721MetaData = False # Ethereum ERC721 - Format Source: https://eips.ethereum.org/EIPS/eip-721
|
||||
|
||||
|
@ -133,6 +133,11 @@ maxNFTsTest = 5 # Increase to get a more accurate reading of the render time. T
|
|||
# DNA_Generator.py.
|
||||
checkDups = False
|
||||
|
||||
# Turn this on when running main.py to generate NFTRecord.json and Batch#.json files to record the rarity percentage of each variant.
|
||||
# Note - This file is provided for transparency. The accuracy of the rarity values you set in your .blend file as outlined
|
||||
# in the README.md file are dependent on the maxNFTs, and the maximum number of combinations of your NFT collection.
|
||||
checkRarity = False
|
||||
|
||||
# Utilities - DO NOT TOUCH:
|
||||
import platform
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ sys.path.append(dir)
|
|||
sys.modules.values()
|
||||
|
||||
from src import config
|
||||
from src.Utility_Scripts import DuplicateChecker, RenderTest, Preview, BatchRefactorer
|
||||
from src.Utility_Scripts import DuplicateChecker, RenderTest, Preview, BatchRefactorer, RarityChecker
|
||||
from src.Model_Generators import Model_Generator
|
||||
from src.Main_Generators import Batch_Sorter, DNA_Generator, Exporter
|
||||
|
||||
|
@ -24,6 +24,7 @@ importlib.reload(Preview)
|
|||
importlib.reload(RenderTest)
|
||||
importlib.reload(Exporter)
|
||||
importlib.reload(BatchRefactorer)
|
||||
importlib.reload(RarityChecker)
|
||||
|
||||
|
||||
if not config.enableExporter and not config.runPreview and not config.refactorBatchOrder:
|
||||
|
@ -44,3 +45,6 @@ if config.runPreview:
|
|||
|
||||
if config.refactorBatchOrder:
|
||||
BatchRefactorer.reformatNFTCollection()
|
||||
|
||||
if config.checkRarity:
|
||||
RarityChecker.getRealRarity()
|
||||
|
|
Ładowanie…
Reference in New Issue