kopia lustrzana https://github.com/torrinworx/Blend_My_NFTs
Pulled out code into Intermediate module
rodzic
ffc216798e
commit
ce8a04f5f9
49
__init__.py
49
__init__.py
|
@ -450,39 +450,6 @@ class createData(bpy.types.Operator):
|
||||||
if input.enable_Logic_Json and not input.logicFile:
|
if input.enable_Logic_Json and not input.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:
|
|
||||||
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
|
|
||||||
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
|
|
||||||
|
|
||||||
DNA_Generator.send_To_Record_JSON(collectionSize, nftsPerBatch, save_path, enableRarity, enableLogic, logicFile, enableMaterials,
|
|
||||||
materialsFile, Blend_My_NFTs_Output, batch_json_save_path)
|
|
||||||
Intermediate.send_To_Record_JSON(input)
|
Intermediate.send_To_Record_JSON(input)
|
||||||
|
|
||||||
self.report({'INFO'}, f"NFT Data created!")
|
self.report({'INFO'}, f"NFT Data created!")
|
||||||
|
@ -506,22 +473,6 @@ class exportNFTs(bpy.types.Operator):
|
||||||
|
|
||||||
input = getBMNFTData()
|
input = getBMNFTData()
|
||||||
# Handling Custom Fields UIList input:
|
# Handling Custom Fields UIList input:
|
||||||
if input.enableCustomFields:
|
|
||||||
scn = context.scene
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
Intermediate.render_and_save_NFTs(input)
|
Intermediate.render_and_save_NFTs(input)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,47 @@
|
||||||
import json
|
import json
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
def send_To_Record_JSON(input):
|
|
||||||
from main import DNA_Generator, Exporter
|
from main import DNA_Generator, Exporter
|
||||||
|
|
||||||
def send_To_Record_JSON(input, reverse_order=False):
|
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,
|
DNA_Generator.send_To_Record_JSON( input.collectionSize,
|
||||||
input.nftsPerBatch,
|
input.nftsPerBatch,
|
||||||
|
@ -20,3 +57,20 @@ def send_To_Record_JSON(input, reverse_order=False):
|
||||||
|
|
||||||
def render_and_save_NFTs(input, reverse_order=False):
|
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