From 74852ad837ededfffe2c3a26045ac6b1c4f1c653 Mon Sep 17 00:00:00 2001 From: Torrin Leonard <82110564+torrinworx@users.noreply.github.com> Date: Fri, 19 Nov 2021 18:39:20 -0500 Subject: [PATCH] Added DuplicateChecker.py --- src/main/DuplicateChecker.py | 48 ++++++++++++++++++++++++++++++++++++ src/main/config.py | 12 ++++----- 2 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 src/main/DuplicateChecker.py diff --git a/src/main/DuplicateChecker.py b/src/main/DuplicateChecker.py new file mode 100644 index 0000000..bfa3546 --- /dev/null +++ b/src/main/DuplicateChecker.py @@ -0,0 +1,48 @@ +import bpy +import os +import sys +import json +import platform +import importlib + +dir = os.path.dirname(bpy.data.filepath) +sys.path.append(dir) +sys.modules.values() + +from src.main import config +importlib.reload(config) + +listBatchFolder = os.listdir(config.batch_save_path) +numInBatchFolder = len(listBatchFolder) + +removeList = [".gitignore", ".DS_Store", "Script_Ignore_Folder"] +batchList = [x for x in listBatchFolder if (x not in removeList)] + + +def checkIfBatchDup(i): + file_name = os.path.join(config.batch_save_path, i) + DataDictionary = json.load(open(file_name)) + + nftsInBatch = DataDictionary["NFTs_in_Batch"] + hierarchy = DataDictionary["hierarchy"] + DNAList = DataDictionary["BatchDNAList"] + + + + def countDups(thelist): + numOfDupDNA = 0 + seen = set() + for x in thelist: + if x in seen: numOfDupDNA += 1 + seen.add(x) + return numOfDupDNA + + duplicates = countDups(DNAList) + + return duplicates + + +for i in batchList: + print("\nThis is the duplication result for " + i + ":") + print(checkIfBatchDup(i)) + print("\n") diff --git a/src/main/config.py b/src/main/config.py index 7722c49..696e7be 100644 --- a/src/main/config.py +++ b/src/main/config.py @@ -1,22 +1,22 @@ import platform # NFT configurations: -nftsPerBatch = 0 # Number of NFTs per batch -renderBatch = 0 # The batch number to render in PNG-Generator -imageName = '' # The name of the NFT image produces by PNG-Generator +nftsPerBatch = 100000 # Number of NFTs per batch +renderBatch = 1 # The batch number to render in PNG-Generator +imageName = 'TestImage' # The name of the NFT image produces by PNG-Generator imageFileFormat = '' # Dictate the image extension when Blender renders the images # Visit https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.file_format # for a list of file formats supported by Blender. Enter the file extension exactly as specified in # the Blender API documentation above. # The path to Blend_My_NFTs folder: -save_path_mac = '/Users/Path/to/Blend_My_NFTs' +save_path_mac = '/Users/torrinleonard/Desktop/Blend_My_NFTs' 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 = 0 # The maximum number of NFTs you want to generate - does not work with enable3DModels set to True. +maxNFTs = 1000000 # The maximum number of NFTs you want to generate - does not work with enable3DModels set to True. # 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. @@ -40,7 +40,7 @@ objectFormatExport = '' # The file format of the objects you would like to expo # Object generation options: enableGeneration = True # When set to true this applies the sets of colors listed below to the objects in the collections named below -generationType = 'material' #You can either set 'color' or 'material' here. Type you set will correspond to following options. +generationType = 'color' #You can either set 'color' or 'material' here. Type you set will correspond to following options. #generationType = 'material' mode is experimental. Be sure that you back-up your file. #You need to set materials as "fake user". Do not miss this step. Or your materials going to vanish after running this script.