kopia lustrzana https://github.com/torrinworx/Blend_My_NFTs
Merge pull request #131 from matt-159/headless-update
Using BMNFTs headless has feature parity with using the UIpull/135/head
commit
138e1b967b
534
__init__.py
534
__init__.py
|
@ -23,8 +23,10 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import importlib
|
import importlib
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
# "a little hacky bs" - Matthew TheBrochacho ;)
|
# "a little hacky bs" - matt159 ;)
|
||||||
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
|
||||||
from main import \
|
from main import \
|
||||||
|
@ -33,6 +35,7 @@ from main import \
|
||||||
Exporter, \
|
Exporter, \
|
||||||
get_combinations, \
|
get_combinations, \
|
||||||
HeadlessUtil, \
|
HeadlessUtil, \
|
||||||
|
Intermediate, \
|
||||||
loading_animation, \
|
loading_animation, \
|
||||||
Logic, \
|
Logic, \
|
||||||
Material_Generator, \
|
Material_Generator, \
|
||||||
|
@ -52,6 +55,7 @@ if "bpy" in locals():
|
||||||
"get_combinations": get_combinations,
|
"get_combinations": get_combinations,
|
||||||
"HeadlessUtil": HeadlessUtil,
|
"HeadlessUtil": HeadlessUtil,
|
||||||
"loading_animation": loading_animation,
|
"loading_animation": loading_animation,
|
||||||
|
"Intermediate": Intermediate,
|
||||||
"Logic": Logic,
|
"Logic": Logic,
|
||||||
"Material_Generator": Material_Generator,
|
"Material_Generator": Material_Generator,
|
||||||
"Metadata": Metadata,
|
"Metadata": Metadata,
|
||||||
|
@ -71,6 +75,100 @@ if "bpy" in locals():
|
||||||
combinations: int = 0
|
combinations: int = 0
|
||||||
recommended_limit: int = 0
|
recommended_limit: int = 0
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class BMNFTData:
|
||||||
|
nftName: str
|
||||||
|
save_path: str
|
||||||
|
nftsPerBatch: int
|
||||||
|
batchToGenerate: int
|
||||||
|
collectionSize: int
|
||||||
|
|
||||||
|
Blend_My_NFTs_Output: str
|
||||||
|
batch_json_save_path: str
|
||||||
|
nftBatch_save_path: str
|
||||||
|
|
||||||
|
enableImages: bool
|
||||||
|
imageFileFormat: str
|
||||||
|
|
||||||
|
enableAnimations: bool
|
||||||
|
animationFileFormat: str
|
||||||
|
|
||||||
|
enableModelsBlender: bool
|
||||||
|
modelFileFormat: str
|
||||||
|
|
||||||
|
enableCustomFields: bool
|
||||||
|
|
||||||
|
cardanoMetaDataBool: bool
|
||||||
|
solanaMetaDataBool: bool
|
||||||
|
erc721MetaData: bool
|
||||||
|
|
||||||
|
cardano_description: str
|
||||||
|
solana_description: str
|
||||||
|
erc721_description: str
|
||||||
|
|
||||||
|
enableMaterials: bool
|
||||||
|
materialsFile: str
|
||||||
|
|
||||||
|
enableLogic: bool
|
||||||
|
enable_Logic_Json: bool
|
||||||
|
logicFile: str
|
||||||
|
|
||||||
|
enableRarity: bool
|
||||||
|
|
||||||
|
custom_Fields: dict = None
|
||||||
|
fail_state: Any = False
|
||||||
|
failed_batch: Any = None
|
||||||
|
failed_dna: Any = None
|
||||||
|
failed_dna_index: Any = None
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
self.custom_Fields = {}
|
||||||
|
|
||||||
|
def getBMNFTData():
|
||||||
|
_save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
||||||
|
_Blend_My_NFTs_Output, _batch_json_save_path, _nftBatch_save_path = make_directories(_save_path)
|
||||||
|
|
||||||
|
data = BMNFTData (
|
||||||
|
nftName = bpy.context.scene.input_tool.nftName,
|
||||||
|
save_path = _save_path,
|
||||||
|
nftsPerBatch = bpy.context.scene.input_tool.nftsPerBatch,
|
||||||
|
batchToGenerate = bpy.context.scene.input_tool.batchToGenerate,
|
||||||
|
collectionSize = bpy.context.scene.input_tool.collectionSize,
|
||||||
|
|
||||||
|
enableRarity = bpy.context.scene.input_tool.enableRarity,
|
||||||
|
|
||||||
|
Blend_My_NFTs_Output = _Blend_My_NFTs_Output,
|
||||||
|
batch_json_save_path = _batch_json_save_path,
|
||||||
|
nftBatch_save_path = _nftBatch_save_path,
|
||||||
|
|
||||||
|
enableLogic = bpy.context.scene.input_tool.enableLogic,
|
||||||
|
enable_Logic_Json = bpy.context.scene.input_tool.enable_Logic_Json,
|
||||||
|
logicFile = bpy.context.scene.input_tool.logicFile,
|
||||||
|
|
||||||
|
enableImages = bpy.context.scene.input_tool.imageBool,
|
||||||
|
imageFileFormat = bpy.context.scene.input_tool.imageEnum,
|
||||||
|
|
||||||
|
enableAnimations = bpy.context.scene.input_tool.animationBool,
|
||||||
|
animationFileFormat = bpy.context.scene.input_tool.animationEnum,
|
||||||
|
|
||||||
|
enableModelsBlender = bpy.context.scene.input_tool.modelBool,
|
||||||
|
modelFileFormat = bpy.context.scene.input_tool.modelEnum,
|
||||||
|
|
||||||
|
enableCustomFields = bpy.context.scene.input_tool.enableCustomFields,
|
||||||
|
|
||||||
|
cardanoMetaDataBool = bpy.context.scene.input_tool.cardanoMetaDataBool,
|
||||||
|
solanaMetaDataBool = bpy.context.scene.input_tool.solanaMetaDataBool,
|
||||||
|
erc721MetaData = bpy.context.scene.input_tool.erc721MetaData,
|
||||||
|
|
||||||
|
cardano_description = bpy.context.scene.input_tool.cardano_description,
|
||||||
|
solana_description = bpy.context.scene.input_tool.solana_description,
|
||||||
|
erc721_description = bpy.context.scene.input_tool.erc721_description,
|
||||||
|
|
||||||
|
enableMaterials = bpy.context.scene.input_tool.enableMaterials,
|
||||||
|
materialsFile = bpy.path.abspath(bpy.context.scene.input_tool.materialsFile)
|
||||||
|
)
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def Refresh_UI(dummy1, dummy2):
|
def Refresh_UI(dummy1, dummy2):
|
||||||
|
@ -124,32 +222,43 @@ def runAsHeadless():
|
||||||
"""
|
"""
|
||||||
For use when running from the command line.
|
For use when running from the command line.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# force CUDA device usage with cycles renderer
|
||||||
|
cprefs = bpy.context.preferences.addons['cycles'].preferences
|
||||||
|
cprefs.compute_device_type = 'CUDA'
|
||||||
|
cprefs.get_devices()
|
||||||
|
print(cprefs.devices.keys())
|
||||||
|
|
||||||
|
for key in cprefs.devices.keys():
|
||||||
|
cprefs.devices[key].use = True
|
||||||
|
|
||||||
|
print('Using {} devices for rendering!'.format(cprefs.get_num_gpu_devices()))
|
||||||
|
|
||||||
def dumpSettings(settings):
|
def dumpSettings(settings):
|
||||||
output = (
|
output = (
|
||||||
f"nftName={settings.nftName}\n"
|
f"nftName={ settings.nftName }\n"
|
||||||
f"collectionSize={str(settings.collectionSize)}\n"
|
f"collectionSize={ str(settings.collectionSize) }\n"
|
||||||
f"nftsPerBatch={str(settings.nftsPerBatch)}\n"
|
f"nftsPerBatch={ str(settings.nftsPerBatch) }\n"
|
||||||
f"save_path={settings.save_path}\n"
|
f"save_path={ settings.save_path }\n"
|
||||||
f"enableRarity={(settings.enableRarity)}\n"
|
f"enableRarity={ (settings.enableRarity) }\n"
|
||||||
f"enableLogic={str(settings.enableLogic)}\n"
|
f"enableLogic={ str(settings.enableLogic) }\n"
|
||||||
f"imageBool={str(settings.imageBool)}\n"
|
f"imageBool={ str(settings.imageBool) }\n"
|
||||||
f"imageEnum={settings.imageEnum}\n"
|
f"imageEnum={ settings.imageEnum }\n"
|
||||||
f"animationBool={str(settings.animationBool)}\n"
|
f"animationBool={ str(settings.animationBool) }\n"
|
||||||
f"animationEnum={settings.animationEnum}\n"
|
f"animationEnum={ settings.animationEnum }\n"
|
||||||
f"modelBool={str(settings.modelBool)}\n"
|
f"modelBool={ str(settings.modelBool) }\n"
|
||||||
f"modelEnum={settings.modelEnum}\n"
|
f"modelEnum={ settings.modelEnum }\n"
|
||||||
f"batchToGenerate={str(settings.batchToGenerate)}\n"
|
f"batchToGenerate={ str(settings.batchToGenerate) }\n"
|
||||||
f"cardanoMetaDataBool={str(settings.cardanoMetaDataBool)}\n"
|
f"cardanoMetaDataBool={ str(settings.cardanoMetaDataBool) }\n"
|
||||||
f"cardano_description={settings.cardano_description}\n"
|
f"cardano_description={ settings.cardano_description }\n"
|
||||||
f"erc721MetaData={str(settings.erc721MetaData)}\n"
|
f"erc721MetaData={ str(settings.erc721MetaData) }\n"
|
||||||
f"erc721_description={settings.erc721_description}\n"
|
f"erc721_description={ settings.erc721_description }\n"
|
||||||
f"solanaMetaDataBool={str(settings.solanaMetaDataBool)}\n"
|
f"solanaMetaDataBool={ str(settings.solanaMetaDataBool) }\n"
|
||||||
f"solana_description={settings.solana_description}\n"
|
f"solana_description={ settings.solana_description }\n"
|
||||||
f"enableCustomFields={str(settings.enableCustomFields)}\n"
|
f"enableCustomFields={ str(settings.enableCustomFields) }\n"
|
||||||
f"customfieldsFile={settings.customfieldsFile}\n"
|
f"customfieldsFile={ settings.customfieldsFile }\n"
|
||||||
f"enableMaterials={str(settings.customfieldsFile)}\n"
|
f"enableMaterials={ str(settings.customfieldsFile) }\n"
|
||||||
f"materialsFile={settings.materialsFile}\n"
|
f"materialsFile={ settings.materialsFile }\n"
|
||||||
)
|
)
|
||||||
print(output)
|
print(output)
|
||||||
|
|
||||||
|
@ -166,29 +275,31 @@ def runAsHeadless():
|
||||||
|
|
||||||
# print(pairs)
|
# print(pairs)
|
||||||
|
|
||||||
settings.nftName = pairs[0][1]
|
settings.nftName = pairs[0][1]
|
||||||
settings.collectionSize = int(pairs[1][1])
|
settings.collectionSize = int(pairs[1][1])
|
||||||
settings.nftsPerBatch = int(pairs[2][1])
|
settings.nftsPerBatch = int(pairs[2][1])
|
||||||
settings.save_path = pairs[3][1]
|
settings.save_path = pairs[3][1]
|
||||||
settings.enableRarity = pairs[4][1] == 'True'
|
settings.enableRarity = pairs[4][1] == 'True'
|
||||||
settings.enableLogic = pairs[5][1] == 'True'
|
settings.enableLogic = pairs[5][1] == 'True'
|
||||||
settings.imageBool = pairs[6][1] == 'True'
|
settings.enableLogicJson = pairs[6][1] == 'True'
|
||||||
settings.imageEnum = pairs[7][1]
|
settings.logicFile = pairs[7][1]
|
||||||
settings.animationBool = pairs[8][1] == 'True'
|
settings.imageBool = pairs[8][1] == 'True'
|
||||||
settings.animationEnum = pairs[9][1]
|
settings.imageEnum = pairs[9][1]
|
||||||
settings.modelBool = pairs[10][1] == 'True'
|
settings.animationBool = pairs[10][1] == 'True'
|
||||||
settings.modelEnum = pairs[11][1]
|
settings.animationEnum = pairs[11][1]
|
||||||
settings.batchToGenerate = int(pairs[12][1])
|
settings.modelBool = pairs[12][1] == 'True'
|
||||||
settings.cardanoMetaDataBool = pairs[13][1] == 'True'
|
settings.modelEnum = pairs[13][1]
|
||||||
settings.cardano_description = pairs[14][1]
|
settings.batchToGenerate = int(pairs[14][1])
|
||||||
settings.erc721MetaData = pairs[15][1] == 'True'
|
settings.cardanoMetaDataBool = pairs[15][1] == 'True'
|
||||||
settings.erc721_description = pairs[16][1]
|
settings.cardano_description = pairs[16][1]
|
||||||
settings.solanaMetaDataBool = pairs[17][1] == 'True'
|
settings.erc721MetaData = pairs[17][1] == 'True'
|
||||||
settings.solanaDescription = pairs[18][1]
|
settings.erc721_description = pairs[18][1]
|
||||||
settings.enableCustomFields = pairs[19][1] == 'True'
|
settings.solanaMetaDataBool = pairs[19][1] == 'True'
|
||||||
settings.customfieldsFile = pairs[20][1]
|
settings.solanaDescription = pairs[20][1]
|
||||||
settings.enableMaterials = pairs[21][1] == 'True'
|
settings.enableCustomFields = pairs[21][1] == 'True'
|
||||||
settings.materialsFile = pairs[22][1]
|
settings.customfieldsFile = pairs[22][1]
|
||||||
|
settings.enableMaterials = pairs[23][1] == 'True'
|
||||||
|
settings.materialsFile = pairs[24][1]
|
||||||
|
|
||||||
if args.save_path:
|
if args.save_path:
|
||||||
settings.save_path = args.save_path
|
settings.save_path = args.save_path
|
||||||
|
@ -196,80 +307,19 @@ def runAsHeadless():
|
||||||
if args.batch_number:
|
if args.batch_number:
|
||||||
settings.batchToGenerate = args.batch_number
|
settings.batchToGenerate = args.batch_number
|
||||||
|
|
||||||
# dumpSettings(settings)
|
input = getBMNFTData()
|
||||||
|
|
||||||
|
if args.batch_data_path:
|
||||||
|
input.batch_json_save_path = args.batch_data_path
|
||||||
|
|
||||||
# don't mind me, just copy-pasting code around...
|
|
||||||
if args.operation == 'create-dna':
|
if args.operation == 'create-dna':
|
||||||
nftName = settings.nftName
|
Intermediate.send_To_Record_JSON(input)
|
||||||
collectionSize = settings.collectionSize
|
|
||||||
nftsPerBatch = settings.nftsPerBatch
|
|
||||||
save_path = bpy.path.abspath(settings.save_path)
|
|
||||||
logicFile = bpy.path.abspath(settings.logicFile)
|
|
||||||
|
|
||||||
enableRarity = settings.enableRarity
|
|
||||||
enableLogic = settings.enableLogic
|
|
||||||
|
|
||||||
enableMaterials = settings.enableMaterials
|
|
||||||
materialsFile = settings.materialsFile
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
|
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
|
|
||||||
elif args.operation == 'generate-nfts':
|
elif args.operation == 'generate-nfts':
|
||||||
nftName = settings.nftName
|
Intermediate.render_and_save_NFTs(input)
|
||||||
save_path = bpy.path.abspath(settings.save_path)
|
|
||||||
batchToGenerate = settings.batchToGenerate
|
|
||||||
collectionSize = settings.collectionSize
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
|
|
||||||
if args.batch_data_path:
|
|
||||||
batch_json_save_path = args.batch_data_path;
|
|
||||||
|
|
||||||
enableImages = settings.imageBool
|
|
||||||
imageFileFormat = settings.imageEnum
|
|
||||||
|
|
||||||
enableAnimations = settings.animationBool
|
|
||||||
animationFileFormat = settings.animationEnum
|
|
||||||
|
|
||||||
enableModelsBlender = settings.modelBool
|
|
||||||
modelFileFormat = settings.modelEnum
|
|
||||||
|
|
||||||
enableMaterials = settings.enableMaterials
|
|
||||||
materialsFile = settings.materialsFile
|
|
||||||
|
|
||||||
# fail state variables, set to no fail due to resume_failed_batch() Operator in BMNFTS_PT_GenerateNFTs Panel
|
|
||||||
fail_state = False
|
|
||||||
failed_batch = None
|
|
||||||
failed_dna = None
|
|
||||||
failed_dna_index = None
|
|
||||||
|
|
||||||
Exporter.render_and_save_NFTs(nftName, collectionSize, batchToGenerate, batch_json_save_path,
|
|
||||||
nftBatch_save_path, enableImages,
|
|
||||||
imageFileFormat, enableAnimations, animationFileFormat, enableModelsBlender,
|
|
||||||
modelFileFormat, fail_state, failed_batch, failed_dna, failed_dna_index,
|
|
||||||
enableMaterials, materialsFile
|
|
||||||
)
|
|
||||||
elif args.operation == 'refactor-batches':
|
elif args.operation == 'refactor-batches':
|
||||||
class refactorData:
|
Refactorer.reformatNFTCollection(input)
|
||||||
save_path = bpy.path.abspath(settings.save_path)
|
|
||||||
|
|
||||||
custom_Fields_File = bpy.path.abspath(settings.customfieldsFile)
|
|
||||||
enableCustomFields = settings.enableCustomFields
|
|
||||||
|
|
||||||
cardanoMetaDataBool = settings.cardanoMetaDataBool
|
|
||||||
solanaMetaDataBool = settings.solanaMetaDataBool
|
|
||||||
erc721MetaData = settings.erc721MetaData
|
|
||||||
|
|
||||||
cardano_description = settings.cardano_description
|
|
||||||
solana_description = settings.solana_description
|
|
||||||
erc721_description = settings.erc721_description
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
|
|
||||||
Refactorer.reformatNFTCollection(refactorData)
|
|
||||||
|
|
||||||
|
|
||||||
# ======== User input Property Group ======== #
|
# ======== User input Property Group ======== #
|
||||||
|
@ -393,73 +443,15 @@ class createData(bpy.types.Operator):
|
||||||
name="Reverse Order")
|
name="Reverse Order")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
nftName = bpy.context.scene.input_tool.nftName
|
|
||||||
collectionSize = bpy.context.scene.input_tool.collectionSize
|
|
||||||
nftsPerBatch = bpy.context.scene.input_tool.nftsPerBatch
|
|
||||||
save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
|
||||||
|
|
||||||
enableRarity = bpy.context.scene.input_tool.enableRarity
|
|
||||||
|
|
||||||
enableLogic = bpy.context.scene.input_tool.enableLogic
|
|
||||||
enable_Logic_Json = bpy.context.scene.input_tool.enable_Logic_Json
|
|
||||||
logicFile = bpy.path.abspath(bpy.context.scene.input_tool.logicFile)
|
|
||||||
|
|
||||||
enableMaterials = bpy.context.scene.input_tool.enableMaterials
|
|
||||||
materialsFile = bpy.path.abspath(bpy.context.scene.input_tool.materialsFile)
|
|
||||||
|
|
||||||
# Handling Custom Fields UIList input:
|
# Handling Custom Fields UIList input:
|
||||||
if enableLogic:
|
input = getBMNFTData()
|
||||||
if enable_Logic_Json and logicFile:
|
|
||||||
logicFile = json.load(open(logicFile))
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
if input.enableLogic:
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
if input.enable_Logic_Json and not input.logicFile:
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
|
|
||||||
if enable_Logic_Json and not logicFile:
|
|
||||||
self.report({'ERROR'}, f"No Logic.json file path set. Please set the file path to your Logic.json file.")
|
self.report({'ERROR'}, f"No Logic.json file path set. Please set the file path to your Logic.json file.")
|
||||||
|
|
||||||
if not enable_Logic_Json:
|
Intermediate.send_To_Record_JSON(input)
|
||||||
scn = context.scene
|
|
||||||
if self.reverse_order:
|
|
||||||
logicFile = {}
|
|
||||||
num = 1
|
|
||||||
for i in range(scn.logic_fields_index, -1, -1):
|
|
||||||
item = scn.logic_fields[i]
|
|
||||||
|
|
||||||
item_list1 = item.item_list1
|
|
||||||
rule_type = item.rule_type
|
|
||||||
item_list2 = item.item_list2
|
|
||||||
logicFile[f"Rule-{num}"] = {
|
|
||||||
"Items-1": item_list1.split(','),
|
|
||||||
"Rule-Type": rule_type,
|
|
||||||
"Items-2": item_list2.split(',')
|
|
||||||
}
|
|
||||||
num += 1
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
else:
|
|
||||||
logicFile = {}
|
|
||||||
num = 1
|
|
||||||
for item in scn.logic_fields:
|
|
||||||
item_list1 = item.item_list1
|
|
||||||
rule_type = item.rule_type
|
|
||||||
item_list2 = item.item_list2
|
|
||||||
logicFile[f"Rule-{num}"] = {
|
|
||||||
"Items-1": item_list1.split(','),
|
|
||||||
"Rule-Type": rule_type,
|
|
||||||
"Items-2": item_list2.split(',')
|
|
||||||
}
|
|
||||||
num += 1
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
|
|
||||||
if not enableLogic:
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
self.report({'INFO'}, f"NFT Data created!")
|
self.report({'INFO'}, f"NFT Data created!")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
@ -478,61 +470,11 @@ class exportNFTs(bpy.types.Operator):
|
||||||
name="Reverse Order")
|
name="Reverse Order")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
class input:
|
|
||||||
nftName = bpy.context.scene.input_tool.nftName
|
|
||||||
save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
|
||||||
batchToGenerate = bpy.context.scene.input_tool.batchToGenerate
|
|
||||||
collectionSize = bpy.context.scene.input_tool.collectionSize
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
|
|
||||||
enableImages = bpy.context.scene.input_tool.imageBool
|
|
||||||
imageFileFormat = bpy.context.scene.input_tool.imageEnum
|
|
||||||
|
|
||||||
enableAnimations = bpy.context.scene.input_tool.animationBool
|
|
||||||
animationFileFormat = bpy.context.scene.input_tool.animationEnum
|
|
||||||
|
|
||||||
enableModelsBlender = bpy.context.scene.input_tool.modelBool
|
|
||||||
modelFileFormat = bpy.context.scene.input_tool.modelEnum
|
|
||||||
|
|
||||||
enableCustomFields = bpy.context.scene.input_tool.enableCustomFields
|
|
||||||
custom_Fields = {}
|
|
||||||
|
|
||||||
cardanoMetaDataBool = bpy.context.scene.input_tool.cardanoMetaDataBool
|
|
||||||
solanaMetaDataBool = bpy.context.scene.input_tool.solanaMetaDataBool
|
|
||||||
erc721MetaData = bpy.context.scene.input_tool.erc721MetaData
|
|
||||||
|
|
||||||
cardano_description = bpy.context.scene.input_tool.cardano_description
|
|
||||||
solana_description = bpy.context.scene.input_tool.solana_description
|
|
||||||
erc721_description = bpy.context.scene.input_tool.erc721_description
|
|
||||||
|
|
||||||
enableMaterials = bpy.context.scene.input_tool.enableMaterials
|
|
||||||
materialsFile = bpy.path.abspath(bpy.context.scene.input_tool.materialsFile)
|
|
||||||
|
|
||||||
# fail state variables, set to no fail due to resume_failed_batch() Operator in BMNFTS_PT_GenerateNFTs Panel
|
|
||||||
fail_state = False
|
|
||||||
failed_batch = None
|
|
||||||
failed_dna = None
|
|
||||||
failed_dna_index = None
|
|
||||||
|
|
||||||
|
input = getBMNFTData()
|
||||||
# Handling Custom Fields UIList input:
|
# Handling Custom Fields UIList input:
|
||||||
if input.enableCustomFields:
|
|
||||||
scn = context.scene
|
Intermediate.render_and_save_NFTs(input)
|
||||||
if self.reverse_order:
|
|
||||||
for i in range(scn.custom_metadata_fields_index, -1, -1):
|
|
||||||
item = scn.custom_metadata_fields[i]
|
|
||||||
if item.field_name in list(input.custom_Fields.keys()):
|
|
||||||
raise ValueError(f"A duplicate of '{item.field_name}' was found. Please ensure all Custom Metadata field Names are unique.")
|
|
||||||
else:
|
|
||||||
input.custom_Fields[item.field_name] = item.field_value
|
|
||||||
else:
|
|
||||||
for item in scn.custom_metadata_fields:
|
|
||||||
if item.field_name in list(input.custom_Fields.keys()):
|
|
||||||
raise ValueError(f"A duplicate of '{item.field_name}' was found. Please ensure all Custom Metadata field Names are unique.")
|
|
||||||
else:
|
|
||||||
input.custom_Fields[item.field_name] = item.field_value
|
|
||||||
|
|
||||||
Exporter.render_and_save_NFTs(input)
|
|
||||||
|
|
||||||
self.report({'INFO'}, f"All NFTs generated for batch {input.batchToGenerate}!")
|
self.report({'INFO'}, f"All NFTs generated for batch {input.batchToGenerate}!")
|
||||||
|
|
||||||
|
@ -546,42 +488,53 @@ class resume_failed_batch(bpy.types.Operator):
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
class input:
|
_save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
||||||
save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
_Blend_My_NFTs_Output, _batch_json_save_path, _nftBatch_save_path = make_directories(_save_path)
|
||||||
batchToGenerate = bpy.context.scene.input_tool.batchToGenerate
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
_batchToGenerate = bpy.context.scene.input_tool.batchToGenerate
|
||||||
file_name = os.path.join(batch_json_save_path, "Batch{}.json".format(batchToGenerate))
|
|
||||||
batch = json.load(open(file_name))
|
|
||||||
|
|
||||||
nftName = batch["Generation Save"][-1]["Render_Settings"]["nftName"]
|
file_name = os.path.join(_batch_json_save_path, "Batch{}.json".format(_batchToGenerate))
|
||||||
collectionSize = batch["Generation Save"][-1]["Render_Settings"]["collectionSize"]
|
batchData = json.load(open(file_name))
|
||||||
nftBatch_save_path = batch["Generation Save"][-1]["Render_Settings"]["nftBatch_save_path"]
|
|
||||||
|
|
||||||
enableImages = batch["Generation Save"][-1]["Render_Settings"]["enableImages"]
|
_fail_state, _failed_batch, _failed_dna, _failed_dna_index = Checks.check_FailedBatches(_batch_json_save_path)
|
||||||
imageFileFormat = batch["Generation Save"][-1]["Render_Settings"]["imageFileFormat"]
|
|
||||||
|
|
||||||
enableAnimations = batch["Generation Save"][-1]["Render_Settings"]["enableAnimations"]
|
input = BMNFTData (
|
||||||
animationFileFormat = batch["Generation Save"][-1]["Render_Settings"]["animationFileFormat"]
|
nftName = batchData["Generation Save"][-1]["Render_Settings"]["nftName"],
|
||||||
|
save_path = _save_path,
|
||||||
|
collectionSize = batchData["Generation Save"][-1]["Render_Settings"]["collectionSize"],
|
||||||
|
|
||||||
enableModelsBlender = batch["Generation Save"][-1]["Render_Settings"]["enableModelsBlender"]
|
Blend_My_NFTs_Output = _Blend_My_NFTs_Output,
|
||||||
modelFileFormat = batch["Generation Save"][-1]["Render_Settings"]["modelFileFormat"]
|
batch_json_save_path = _batch_json_save_path,
|
||||||
|
nftBatch_save_path = batchData["Generation Save"][-1]["Render_Settings"]["nftBatch_save_path"],
|
||||||
|
|
||||||
enableCustomFields = batch["Generation Save"][-1]["Render_Settings"]["enableCustomFields"]
|
enableImages = batchData["Generation Save"][-1]["Render_Settings"]["enableImages"],
|
||||||
custom_Fields = batch["Generation Save"][-1]["Render_Settings"]["custom_Fields"]
|
imageFileFormat = batchData["Generation Save"][-1]["Render_Settings"]["imageFileFormat"],
|
||||||
|
|
||||||
cardanoMetaDataBool = batch["Generation Save"][-1]["Render_Settings"]["cardanoMetaDataBool"]
|
enableAnimations = batchData["Generation Save"][-1]["Render_Settings"]["enableAnimations"],
|
||||||
solanaMetaDataBool = batch["Generation Save"][-1]["Render_Settings"]["solanaMetaDataBool"]
|
animationFileFormat = batchData["Generation Save"][-1]["Render_Settings"]["animationFileFormat"],
|
||||||
erc721MetaData = batch["Generation Save"][-1]["Render_Settings"]["erc721MetaData"]
|
|
||||||
|
|
||||||
cardano_description = batch["Generation Save"][-1]["Render_Settings"]["cardano_description"]
|
enableModelsBlender = batchData["Generation Save"][-1]["Render_Settings"]["enableModelsBlender"],
|
||||||
solana_description = batch["Generation Save"][-1]["Render_Settings"]["solana_description"]
|
modelFileFormat = batchData["Generation Save"][-1]["Render_Settings"]["modelFileFormat"],
|
||||||
erc721_description = batch["Generation Save"][-1]["Render_Settings"]["erc721_description"]
|
|
||||||
|
|
||||||
enableMaterials = batch["Generation Save"][-1]["Render_Settings"]["enableMaterials"]
|
enableCustomFields = batchData["Generation Save"][-1]["Render_Settings"]["enableCustomFields"],
|
||||||
materialsFile = batch["Generation Save"][-1]["Render_Settings"]["materialsFile"]
|
custom_Fields = batchData["Generation Save"][-1]["Render_Settings"]["custom_Fields"],
|
||||||
|
|
||||||
fail_state, failed_batch, failed_dna, failed_dna_index = Checks.check_FailedBatches(batch_json_save_path)
|
cardanoMetaDataBool = batchData["Generation Save"][-1]["Render_Settings"]["cardanoMetaDataBool"],
|
||||||
|
solanaMetaDataBool = batchData["Generation Save"][-1]["Render_Settings"]["solanaMetaDataBool"],
|
||||||
|
erc721MetaData = batchData["Generation Save"][-1]["Render_Settings"]["erc721MetaData"],
|
||||||
|
|
||||||
|
cardano_description = batchData["Generation Save"][-1]["Render_Settings"]["cardano_description"],
|
||||||
|
solana_description = batchData["Generation Save"][-1]["Render_Settings"]["solana_description"],
|
||||||
|
erc721_description = batchData["Generation Save"][-1]["Render_Settings"]["erc721_description"],
|
||||||
|
|
||||||
|
enableMaterials = batchData["Generation Save"][-1]["Render_Settings"]["enableMaterials"],
|
||||||
|
materialsFile = batchData["Generation Save"][-1]["Render_Settings"]["materialsFile"],
|
||||||
|
|
||||||
|
fail_state = _fail_state,
|
||||||
|
failed_batch = _failed_batch,
|
||||||
|
failed_dna = _failed_dna,
|
||||||
|
failed_dna_index = _failed_dna_index
|
||||||
|
)
|
||||||
|
|
||||||
Exporter.render_and_save_NFTs(input)
|
Exporter.render_and_save_NFTs(input)
|
||||||
|
|
||||||
|
@ -602,25 +555,8 @@ class refactor_Batches(bpy.types.Operator):
|
||||||
name="Reverse Order")
|
name="Reverse Order")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
class input:
|
|
||||||
|
|
||||||
save_path = bpy.path.abspath(bpy.context.scene.input_tool.save_path)
|
|
||||||
|
|
||||||
enableCustomFields = bpy.context.scene.input_tool.enableCustomFields
|
|
||||||
custom_Fields = {}
|
|
||||||
|
|
||||||
cardanoMetaDataBool = bpy.context.scene.input_tool.cardanoMetaDataBool
|
|
||||||
solanaMetaDataBool = bpy.context.scene.input_tool.solanaMetaDataBool
|
|
||||||
erc721MetaData = bpy.context.scene.input_tool.erc721MetaData
|
|
||||||
|
|
||||||
cardano_description = bpy.context.scene.input_tool.cardano_description
|
|
||||||
solana_description = bpy.context.scene.input_tool.solana_description
|
|
||||||
erc721_description = bpy.context.scene.input_tool.erc721_description
|
|
||||||
|
|
||||||
Blend_My_NFTs_Output, batch_json_save_path, nftBatch_save_path = make_directories(save_path)
|
|
||||||
|
|
||||||
# Passing info to main functions for refactoring:
|
# Passing info to main functions for refactoring:
|
||||||
Refactorer.reformatNFTCollection(input)
|
Refactorer.reformatNFTCollection(getBMNFTData())
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
@ -646,49 +582,51 @@ class export_settings(bpy.types.Operator):
|
||||||
"#when running Blend_My_NFTs in a headless environment.\n"
|
"#when running Blend_My_NFTs in a headless environment.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#The name of your nft project\n"
|
"#The name of your nft project\n"
|
||||||
f"nftName={settings.nftName}\n"
|
f"nftName={ settings.nftName }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#NFT Collection Size\n"
|
"#NFT Collection Size\n"
|
||||||
f"collectionSize={settings.collectionSize}\n"
|
f"collectionSize={ settings.collectionSize }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#The number of NFTs to generate per batch\n"
|
"#The number of NFTs to generate per batch\n"
|
||||||
f"nftsPerBatch={str(settings.nftsPerBatch)}\n"
|
f"nftsPerBatch={ str(settings.nftsPerBatch) }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Save path for your NFT files\n"
|
"#Save path for your NFT files\n"
|
||||||
f"save_path={settings.save_path}\n"
|
f"save_path={ settings.save_path }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Enable Rarity\n"
|
"#Enable Rarity\n"
|
||||||
f"enableRarity={(settings.enableRarity)}\n"
|
f"enableRarity={ (settings.enableRarity) }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Enable Logic\n"
|
"#Enable Logic\n"
|
||||||
f"enableLogic={str(settings.enableLogic)}\n"
|
f"enableLogic={ str(settings.enableLogic) }\n"
|
||||||
|
f"enableLogicJson={ str(settings.enable_Logic_Json) }\n"
|
||||||
|
f"logicFilePath={ settings.logicFile }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#NFT Media output type(s):\n"
|
"#NFT Media output type(s):\n"
|
||||||
f"imageBool={str(settings.imageBool)}\n"
|
f"imageBool={ str(settings.imageBool) }\n"
|
||||||
f"imageEnum={settings.imageEnum}\n"
|
f"imageEnum={ settings.imageEnum }\n"
|
||||||
f"animationBool={str(settings.animationBool)}\n"
|
f"animationBool={ str(settings.animationBool) }\n"
|
||||||
f"animationEnum={settings.animationEnum}\n"
|
f"animationEnum={ settings.animationEnum }\n"
|
||||||
f"modelBool={str(settings.modelBool)}\n"
|
f"modelBool={ str(settings.modelBool) }\n"
|
||||||
f"modelEnum={settings.modelEnum}\n"
|
f"modelEnum={ settings.modelEnum }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Batch to generate\n"
|
"#Batch to generate\n"
|
||||||
f"batchToGenerate={str(settings.batchToGenerate)}\n"
|
f"batchToGenerate={ str(settings.batchToGenerate) }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Metadata Format\n"
|
"#Metadata Format\n"
|
||||||
f"cardanoMetaDataBool={str(settings.cardanoMetaDataBool)}\n"
|
f"cardanoMetaDataBool={ str(settings.cardanoMetaDataBool) }\n"
|
||||||
f"cardano_description={settings.cardano_description}\n"
|
f"cardano_description={ settings.cardano_description }\n"
|
||||||
f"erc721MetaData={str(settings.erc721MetaData)}\n"
|
f"erc721MetaData={ str(settings.erc721MetaData) }\n"
|
||||||
f"erc721_description={settings.erc721_description}\n"
|
f"erc721_description={ settings.erc721_description }\n"
|
||||||
f"solanaMetaDataBool={str(settings.solanaMetaDataBool)}\n"
|
f"solanaMetaDataBool={ str(settings.solanaMetaDataBool) }\n"
|
||||||
f"solana_description={settings.solana_description}\n"
|
f"solana_description={ settings.solana_description }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Enable Custom Fields\n"
|
"#Enable Custom Fields\n"
|
||||||
f"enableCustomFields={str(settings.enableCustomFields)}\n"
|
f"enableCustomFields={ str(settings.enableCustomFields) }\n"
|
||||||
f"customfieldsFile={settings.customfieldsFile}\n"
|
f"customfieldsFile={ settings.customfieldsFile }\n"
|
||||||
"\n"
|
"\n"
|
||||||
"#Enable Materials\n"
|
"#Enable Materials\n"
|
||||||
f"enableMaterials={str(settings.enableMaterials)}\n"
|
f"enableMaterials={ str(settings.enableMaterials) }\n"
|
||||||
f"materialsFile={settings.materialsFile}\n"
|
f"materialsFile={ settings.materialsFile }\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
print(output, file=config)
|
print(output, file=config)
|
||||||
|
|
|
@ -41,37 +41,37 @@ def save_generation_state(input):
|
||||||
"Generation Start Date and Time": [CURRENT_TIME, CURRENT_DATE, LOCAL_TIMEZONE],
|
"Generation Start Date and Time": [CURRENT_TIME, CURRENT_DATE, LOCAL_TIMEZONE],
|
||||||
"Render_Settings": {
|
"Render_Settings": {
|
||||||
|
|
||||||
"nftName": input.nftName,
|
"nftName": input.nftName,
|
||||||
"save_path": input.save_path,
|
"save_path": input.save_path,
|
||||||
"batchToGenerate": input.batchToGenerate,
|
"batchToGenerate": input.batchToGenerate,
|
||||||
"collectionSize": input.collectionSize,
|
"collectionSize": input.collectionSize,
|
||||||
|
|
||||||
"Blend_My_NFTs_Output": input.Blend_My_NFTs_Output,
|
"Blend_My_NFTs_Output": input.Blend_My_NFTs_Output,
|
||||||
"batch_json_save_path": input.batch_json_save_path,
|
"batch_json_save_path": input.batch_json_save_path,
|
||||||
"nftBatch_save_path": input.nftBatch_save_path,
|
"nftBatch_save_path": input.nftBatch_save_path,
|
||||||
|
|
||||||
"enableImages": input.enableImages,
|
"enableImages": input.enableImages,
|
||||||
"imageFileFormat": input.imageFileFormat,
|
"imageFileFormat": input.imageFileFormat,
|
||||||
|
|
||||||
"enableAnimations": input.enableAnimations,
|
"enableAnimations": input.enableAnimations,
|
||||||
"animationFileFormat": input.animationFileFormat,
|
"animationFileFormat": input.animationFileFormat,
|
||||||
|
|
||||||
"enableModelsBlender": input.enableModelsBlender,
|
"enableModelsBlender": input.enableModelsBlender,
|
||||||
"modelFileFormat": input.modelFileFormat,
|
"modelFileFormat": input.modelFileFormat,
|
||||||
|
|
||||||
"enableCustomFields": input.enableCustomFields,
|
"enableCustomFields": input.enableCustomFields,
|
||||||
"custom_Fields": input.custom_Fields,
|
"custom_Fields": input.custom_Fields,
|
||||||
|
|
||||||
"cardanoMetaDataBool": input.cardanoMetaDataBool,
|
"cardanoMetaDataBool": input.cardanoMetaDataBool,
|
||||||
"solanaMetaDataBool": input.solanaMetaDataBool,
|
"solanaMetaDataBool": input.solanaMetaDataBool,
|
||||||
"erc721MetaData": input.erc721MetaData,
|
"erc721MetaData": input.erc721MetaData,
|
||||||
|
|
||||||
"cardano_description": input.cardano_description,
|
"cardano_description": input.cardano_description,
|
||||||
"solana_description": input.solana_description,
|
"solana_description": input.solana_description,
|
||||||
"erc721_description": input.erc721_description,
|
"erc721_description": input.erc721_description,
|
||||||
|
|
||||||
"enableMaterials": input.enableMaterials,
|
"enableMaterials": input.enableMaterials,
|
||||||
"materialsFile": input.materialsFile,
|
"materialsFile": input.materialsFile,
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -250,20 +250,20 @@ def render_and_save_NFTs(input):
|
||||||
time_start_2 = time.time()
|
time_start_2 = time.time()
|
||||||
|
|
||||||
# Main paths for batch subfolders:
|
# Main paths for batch subfolders:
|
||||||
batchFolder = os.path.join(input.nftBatch_save_path, "Batch" + str(input.batchToGenerate))
|
batchFolder = os.path.join(input.nftBatch_save_path, "Batch" + str(input.batchToGenerate))
|
||||||
|
|
||||||
imageFolder = os.path.join(batchFolder, "Images")
|
imageFolder = os.path.join(batchFolder, "Images")
|
||||||
animationFolder = os.path.join(batchFolder, "Animations")
|
animationFolder = os.path.join(batchFolder, "Animations")
|
||||||
modelFolder = os.path.join(batchFolder, "Models")
|
modelFolder = os.path.join(batchFolder, "Models")
|
||||||
BMNFT_metaData_Folder = os.path.join(batchFolder, "BMNFT_metadata")
|
BMNFT_metaData_Folder = os.path.join(batchFolder, "BMNFT_metadata")
|
||||||
|
|
||||||
imagePath = os.path.join(imageFolder, name)
|
imagePath = os.path.join(imageFolder, name)
|
||||||
animationPath = os.path.join(animationFolder, name)
|
animationPath = os.path.join(animationFolder, name)
|
||||||
modelPath = os.path.join(modelFolder, name)
|
modelPath = os.path.join(modelFolder, name)
|
||||||
|
|
||||||
cardanoMetadataPath = os.path.join(batchFolder, "Cardano_metadata")
|
cardanoMetadataPath = os.path.join(batchFolder, "Cardano_metadata")
|
||||||
solanaMetadataPath = os.path.join(batchFolder, "Solana_metadata")
|
solanaMetadataPath = os.path.join(batchFolder, "Solana_metadata")
|
||||||
erc721MetadataPath = os.path.join(batchFolder, "Erc721_metadata")
|
erc721MetadataPath = os.path.join(batchFolder, "Erc721_metadata")
|
||||||
|
|
||||||
# Generation/Rendering:
|
# Generation/Rendering:
|
||||||
if input.enableImages:
|
if input.enableImages:
|
||||||
|
|
|
@ -56,5 +56,12 @@ def getPythonArgs():
|
||||||
required=False,
|
required=False,
|
||||||
help="Use pre-existing batch data for rendering"
|
help="Use pre-existing batch data for rendering"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument("--logic-file",
|
||||||
|
dest="logic_file",
|
||||||
|
metavar='FILE',
|
||||||
|
required=False,
|
||||||
|
help="Overwrite the logic file path in the config file"
|
||||||
|
)
|
||||||
|
|
||||||
return (parser.parse_args(argv), parser)
|
return (parser.parse_args(argv), parser)
|
|
@ -0,0 +1,76 @@
|
||||||
|
import json
|
||||||
|
import bpy
|
||||||
|
|
||||||
|
from main import DNA_Generator, Exporter
|
||||||
|
|
||||||
|
def send_To_Record_JSON(input, reverse_order=False):
|
||||||
|
|
||||||
|
if input.enableLogic:
|
||||||
|
if input.enable_Logic_Json and input.logicFile:
|
||||||
|
input.logicFile = json.load(open(input.logicFile))
|
||||||
|
|
||||||
|
if input.enable_Logic_Json and not input.logicFile:
|
||||||
|
print({'ERROR'}, f"No Logic.json file path set. Please set the file path to your Logic.json file.")
|
||||||
|
|
||||||
|
if not input.enable_Logic_Json:
|
||||||
|
scn = bpy.context.scene
|
||||||
|
if reverse_order:
|
||||||
|
input.logicFile = {}
|
||||||
|
num = 1
|
||||||
|
for i in range(scn.logic_fields_index, -1, -1):
|
||||||
|
item = scn.logic_fields[i]
|
||||||
|
|
||||||
|
item_list1 = item.item_list1
|
||||||
|
rule_type = item.rule_type
|
||||||
|
item_list2 = item.item_list2
|
||||||
|
input.logicFile[f"Rule-{num}"] = {
|
||||||
|
"Items-1": item_list1.split(','),
|
||||||
|
"Rule-Type": rule_type,
|
||||||
|
"Items-2": item_list2.split(',')
|
||||||
|
}
|
||||||
|
num += 1
|
||||||
|
else:
|
||||||
|
input.logicFile = {}
|
||||||
|
num = 1
|
||||||
|
for item in scn.logic_fields:
|
||||||
|
item_list1 = item.item_list1
|
||||||
|
rule_type = item.rule_type
|
||||||
|
item_list2 = item.item_list2
|
||||||
|
input.logicFile[f"Rule-{num}"] = {
|
||||||
|
"Items-1": item_list1.split(','),
|
||||||
|
"Rule-Type": rule_type,
|
||||||
|
"Items-2": item_list2.split(',')
|
||||||
|
}
|
||||||
|
num += 1
|
||||||
|
|
||||||
|
DNA_Generator.send_To_Record_JSON( input.collectionSize,
|
||||||
|
input.nftsPerBatch,
|
||||||
|
input.save_path,
|
||||||
|
input.enableRarity,
|
||||||
|
input.enableLogic,
|
||||||
|
input.logicFile,
|
||||||
|
input.enableMaterials,
|
||||||
|
input.materialsFile,
|
||||||
|
input.Blend_My_NFTs_Output,
|
||||||
|
input.batch_json_save_path
|
||||||
|
)
|
||||||
|
|
||||||
|
def render_and_save_NFTs(input, reverse_order=False):
|
||||||
|
|
||||||
|
if input.enableCustomFields:
|
||||||
|
scn = bpy.context.scene
|
||||||
|
if reverse_order:
|
||||||
|
for i in range(scn.custom_metadata_fields_index, -1, -1):
|
||||||
|
item = scn.custom_metadata_fields[i]
|
||||||
|
if item.field_name in list(input.custom_Fields.keys()):
|
||||||
|
raise ValueError(f"A duplicate of '{item.field_name}' was found. Please ensure all Custom Metadata field Names are unique.")
|
||||||
|
else:
|
||||||
|
input.custom_Fields[item.field_name] = item.field_value
|
||||||
|
else:
|
||||||
|
for item in scn.custom_metadata_fields:
|
||||||
|
if item.field_name in list(input.custom_Fields.keys()):
|
||||||
|
raise ValueError(f"A duplicate of '{item.field_name}' was found. Please ensure all Custom Metadata field Names are unique.")
|
||||||
|
else:
|
||||||
|
input.custom_Fields[item.field_name] = item.field_value
|
||||||
|
|
||||||
|
Exporter.render_and_save_NFTs(input)
|
Ładowanie…
Reference in New Issue