kopia lustrzana https://github.com/torrinworx/Blend_My_NFTs
Adding image, model, animation, and data support
rodzic
965073a349
commit
2dedbc1829
|
@ -2,6 +2,7 @@
|
|||
*.blend1
|
||||
*.json
|
||||
|
||||
Complete_Collection
|
||||
.idea
|
||||
__pycache__
|
||||
NFTRecord.json
|
||||
|
|
BIN
Example.blend
BIN
Example.blend
Plik binarny nie jest wyświetlany.
|
@ -107,9 +107,9 @@ def render_and_save_NFTs():
|
|||
|
||||
batchFolder = os.path.join(config.nft_save_path, "Batch" + str(config.renderBatch))
|
||||
|
||||
imagePath = os.path.join(batchFolder, "Images", "Image_" + name)
|
||||
animationPath = os.path.join(batchFolder, "Animations", "Animation_" + name)
|
||||
modelPath = os.path.join(batchFolder, "Models", "Model_" + name)
|
||||
imagePath = os.path.join(batchFolder, "Images", name)
|
||||
animationPath = os.path.join(batchFolder, "Animations", name)
|
||||
modelPath = os.path.join(batchFolder, "Models", name)
|
||||
|
||||
imageFolder = os.path.join(batchFolder, "Images")
|
||||
animationFolder = os.path.join(batchFolder, "Animations")
|
||||
|
|
|
@ -7,6 +7,7 @@ import sys
|
|||
import copy
|
||||
import time
|
||||
import json
|
||||
import shutil
|
||||
import importlib
|
||||
|
||||
dir = os.path.dirname(bpy.data.filepath)
|
||||
|
@ -19,7 +20,7 @@ importlib.reload(config)
|
|||
|
||||
def getNFType():
|
||||
batchListDirty = os.listdir(config.nft_save_path)
|
||||
removeList = [".gitignore", ".DS_Store", "Script_Ignore_Folder"]
|
||||
removeList = [".gitignore", ".DS_Store"]
|
||||
batchList = [x for x in batchListDirty if (x not in removeList)]
|
||||
|
||||
images = False
|
||||
|
@ -43,50 +44,101 @@ def getNFType():
|
|||
def reformatBatches():
|
||||
images, animations, models, metaData = getNFType()
|
||||
|
||||
completeCollPath = os.path.join(config.nft_save_path, "Complete_Collection")
|
||||
completeCollPath = os.path.join(config.save_path, "Complete_Collection")
|
||||
completeImagePath = os.path.join(completeCollPath, "Images")
|
||||
completeAnimationsPath = os.path.join(completeCollPath, "Animations")
|
||||
completeModelsPath = os.path.join(completeCollPath, "Models")
|
||||
completeMetaDataPath = os.path.join(completeCollPath, "NFT_metaData")
|
||||
|
||||
os.mkdir(completeCollPath)
|
||||
|
||||
if images:
|
||||
if not os.path.exists(completeCollPath):
|
||||
os.mkdir(completeCollPath)
|
||||
if images and not os.path.exists(completeImagePath):
|
||||
os.mkdir(completeImagePath)
|
||||
if animations:
|
||||
if animations and not os.path.exists(completeAnimationsPath):
|
||||
os.mkdir(completeAnimationsPath)
|
||||
if models:
|
||||
if models and not os.path.exists(completeModelsPath):
|
||||
os.mkdir(completeModelsPath)
|
||||
if metaData:
|
||||
if metaData and not os.path.exists(completeMetaDataPath):
|
||||
os.mkdir(completeMetaDataPath)
|
||||
|
||||
batchListDirty = os.listdir(config.nft_save_path)
|
||||
removeList = [".gitignore", ".DS_Store", "Script_Ignore_Folder"]
|
||||
removeList = [".gitignore", ".DS_Store"]
|
||||
batchList = [x for x in batchListDirty if (x not in removeList)]
|
||||
|
||||
count = 1
|
||||
imageCount = 1
|
||||
animationCount = 1
|
||||
modelCount = 1
|
||||
dataCount = 1
|
||||
for i in batchList:
|
||||
if images:
|
||||
imagesDir = os.path.join(config.nft_save_path, i, "Images")
|
||||
imagesList = sorted(os.listdir(imagesDir))
|
||||
print(imagesList)
|
||||
|
||||
for j in imagesList:
|
||||
k = copy.deepcopy(j.removeprefix("Image_"))
|
||||
extension = os.path.splitext(k)[1]
|
||||
nameDirty = os.path.splitext(k)[0]
|
||||
imageOldPath = os.path.join(config.nft_save_path, i, "Images", j)
|
||||
nameOldDirty = copy.deepcopy(os.path.splitext(j)[0])
|
||||
extension = copy.deepcopy(os.path.splitext(j)[1])
|
||||
nameOldClean = nameOldDirty.split("_")[0]
|
||||
|
||||
name = nameDirty.split("_")[0]
|
||||
nameNew = nameOldClean + "_" + str(imageCount)
|
||||
imageNewPath = os.path.join(completeImagePath, nameNew + extension)
|
||||
|
||||
os.rename(os.path.join(imagesDir, j), os.path.join(completeImagePath, "Image_" + name + "_" + str(count) + extension))
|
||||
os.rename(imageOldPath, imageNewPath)
|
||||
|
||||
count += 1
|
||||
imageCount += 1
|
||||
|
||||
'''
|
||||
if animations:
|
||||
if models:
|
||||
if metaData:'''
|
||||
animationsDir = os.path.join(config.nft_save_path, i, "Animations")
|
||||
animationsList = sorted(os.listdir(animationsDir))
|
||||
|
||||
for j in animationsList:
|
||||
animationOldPath = os.path.join(config.nft_save_path, i, "Animations", j)
|
||||
nameOldDirty = copy.deepcopy(os.path.splitext(j)[0])
|
||||
extension = copy.deepcopy(os.path.splitext(j)[1])
|
||||
nameOldClean = nameOldDirty.split("_")[0]
|
||||
|
||||
nameNew = nameOldClean + "_" + str(animationCount)
|
||||
animationNewPath = os.path.join(completeAnimationsPath, nameNew + extension)
|
||||
|
||||
os.rename(animationOldPath, animationNewPath)
|
||||
|
||||
animationCount += 1
|
||||
|
||||
if models:
|
||||
modelsDir = os.path.join(config.nft_save_path, i, "Models")
|
||||
modelsList = sorted(os.listdir(modelsDir))
|
||||
|
||||
for j in modelsList:
|
||||
modelOldPath = os.path.join(config.nft_save_path, i, "Models", j)
|
||||
nameOldDirty = copy.deepcopy(os.path.splitext(j)[0])
|
||||
extension = copy.deepcopy(os.path.splitext(j)[1])
|
||||
nameOldClean = nameOldDirty.split("_")[0]
|
||||
|
||||
nameNew = nameOldClean + "_" + str(modelCount)
|
||||
modelsNewPath = os.path.join(completeModelsPath, nameNew + extension)
|
||||
|
||||
os.rename(modelOldPath, modelsNewPath)
|
||||
|
||||
modelCount += 1
|
||||
|
||||
if metaData:
|
||||
dataDir = os.path.join(config.nft_save_path, i, "NFT_metaData")
|
||||
dataList = sorted(os.listdir(dataDir))
|
||||
|
||||
for j in dataList:
|
||||
dataOldPath = os.path.join(config.nft_save_path, i, "NFT_metaData", j)
|
||||
nameOldDirty = copy.deepcopy(os.path.splitext(j)[0])
|
||||
extension = copy.deepcopy(os.path.splitext(j)[1])
|
||||
nameOldClean = nameOldDirty.split("_")[0]
|
||||
|
||||
nameNew = nameOldClean + "_" + str(dataCount)
|
||||
dataNewPath = os.path.join(completeMetaDataPath, nameNew + extension)
|
||||
|
||||
os.rename(dataOldPath, dataNewPath)
|
||||
|
||||
dataCount += 1
|
||||
|
||||
print("All NFT files stored and sorted to the Complete_Collection folder in {}".format(config.save_path))
|
||||
|
||||
if __name__ == '__main__':
|
||||
reformatBatches()
|
||||
|
|
|
@ -154,4 +154,9 @@ maxNFTsTest = 5 # Increase to get a more accurate reading of the render time. T
|
|||
checkDups = False
|
||||
|
||||
# EXPERIMENTAL FEATURE:
|
||||
refactorBatchOrder = True
|
||||
refactorBatchOrder = True # When set to True, sorts, renames, and moves all NFTs files in all batches in NFT_Output
|
||||
# folder to the Complete_Collection folder.
|
||||
# After you generate all batches move them all to one computer and place them in the NFT_Output folder of Blend_My_NFTs.
|
||||
# Run main.py with refactorBatchOrder set to True and all NFT files will be renamed and sorted into a folder called Complete_Collection.
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue