Error messages and minor changes

- Changed labeling in __init__.py to reflect new workflow
- Updated Checks.py to stop throwing weird error and to now catch Script_Ignore collection error
- Added error message if you change collection name after data is created and you generate your nfts
- Added more info in comments and relocated Change Text Object in Scene
- Metadata no longer contains order number and rarity number
pull/117/head
Torrin Leonard 2022-05-30 22:45:39 -04:00
rodzic 75600e973d
commit 643c2f1819
4 zmienionych plików z 34 dodań i 25 usunięć

Wyświetl plik

@ -1,15 +1,15 @@
bl_info = {
"name": "Blend_My_NFTs V4 Alpha",
"author": "Torrin Leonard, This Cozy Studio Inc",
"version": (4, 0, 0),
"version": (4, 0, 1),
"blender": (3, 2, 0),
"location": "View3D",
"description": "An open source, free to use Blender add-on that enables you to create thousands of unique images, animations, and 3D models.",
"category": "Development",
}
BMNFTS_VERSION = "v4.0.0 - Alpha"
LAST_UPDATED = "7:55PM, May 25, 2022"
BMNFTS_VERSION = "v4.0.1 - Alpha"
LAST_UPDATED = "10:43PM, May 30th, 2022"
# ======== Import handling ======== #
@ -87,7 +87,6 @@ def Refresh_UI(dummy1, dummy2):
# Add panel classes that require refresh to this refresh_panels tuple:
refresh_panel_classes = (
BMNFTS_PT_CreateData,
BMNFTS_PT_GenerateNFTs,
)
def redraw_panel(refresh_panel_classes):
@ -778,7 +777,7 @@ class BMNFTS_PT_CreateData(bpy.types.Panel):
class BMNFTS_PT_GenerateNFTs(bpy.types.Panel):
bl_label = "Generate NFTs"
bl_label = "Generate NFTs & Create Metadata"
bl_idname = "BMNFTS_PT_GenerateNFTs"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@ -878,7 +877,7 @@ class BMNFTS_PT_GenerateNFTs(bpy.types.Panel):
if fail_state:
row = layout.row()
self.layout.operator("exporter.nfts", icon='RENDER_RESULT', text="Generate NFTs")
self.layout.operator("exporter.nfts", icon='RENDER_RESULT', text="Generate NFTs & Create Metadata")
row = layout.row()
row.alert = True
@ -886,11 +885,11 @@ class BMNFTS_PT_GenerateNFTs(bpy.types.Panel):
if not fail_state:
row = layout.row()
self.layout.operator("exporter.nfts", icon='RENDER_RESULT', text="Generate NFTs")
self.layout.operator("exporter.nfts", icon='RENDER_RESULT', text="Generate NFTs & Create Metadata")
class BMNFTS_PT_Refactor(bpy.types.Panel):
bl_label = "Refactor Batches & Create Metadata"
bl_label = "Refactor Batches"
bl_idname = "BMNFTS_PT_Refactor"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@ -907,7 +906,7 @@ class BMNFTS_PT_Refactor(bpy.types.Panel):
row = layout.row()
self.layout.operator("refactor.batches", icon='FOLDER_REDIRECT', text="Refactor Batches & Create Metadata")
self.layout.operator("refactor.batches", icon='FOLDER_REDIRECT', text="Refactor Batches")
class BMNFTS_PT_Other(bpy.types.Panel):

Wyświetl plik

@ -27,23 +27,20 @@ def check_Scene(): # Not complete
variant_naming_conventions = None # True if all variants in Blender scene follow BMNFTs naming conventions
object_placing_conventions = None # True if all objects are within either Script_Ignore or a variant collection
hierarchy = DNA_Generator.get_hierarchy()
# script_ignore_exists:
try:
scriptIgnoreCollection = bpy.data.collections["Script_Ignore"]
script_ignore_exists = True
except KeyError:
raise TypeError(
f"\n{bcolors.ERROR}Blend_My_NFTs Error:\n"
f"collection to your Blender scene and ensure the name is exactly 'Script_Ignore'. For more information, "
f"Add a Script_Ignore collection to your Blender scene and ensure the name is exactly 'Script_Ignore'. For more information, "
f"see:"
f"\nhttps://github.com/torrinworx/Blend_My_NFTs#blender-file-organization-and-structure\n{bcolors.RESET}"
)
else:
script_ignore_exists = True
hierarchy = DNA_Generator.get_hierarchy()
collections = bpy.context.scene.collection
print(collections)
# attribute_naming_conventions
@ -147,7 +144,7 @@ def check_FailedBatches(batch_json_save_path):
NFTs_in_Batch = batch["NFTs_in_Batch"]
if "Generation Save" in batch:
dna_generated = batch["Generation Save"][-1]["DNA Generated"]
if dna_generated < NFTs_in_Batch:
if dna_generated is not None and dna_generated < NFTs_in_Batch:
fail_state = True
failed_batch = int(i.removeprefix("Batch").removesuffix(".json"))
failed_dna = dna_generated

Wyświetl plik

@ -135,10 +135,6 @@ def render_and_save_NFTs(input):
full_single_dna = list(a.keys())[0]
Order_Num = a[full_single_dna]['Order_Num']
# Change Text Object in Scene to match DNA string:
# ob = bpy.data.objects['Text'] # Object name
# ob.data.body = str(f"DNA: {full_single_dna}") # Set text of Text Object ob
# Material handling:
if input.enableMaterials:
single_dna, material_dna = full_single_dna.split(':')
@ -222,12 +218,26 @@ def render_and_save_NFTs(input):
# Turn off render camera and viewport camera for all collections in hierarchy
for i in hierarchy:
for j in hierarchy[i]:
bpy.data.collections[j].hide_render = True
bpy.data.collections[j].hide_viewport = True
try:
bpy.data.collections[j].hide_render = True
bpy.data.collections[j].hide_viewport = True
except KeyError:
raise TypeError(
f"\n{bcolors.ERROR}Blend_My_NFTs Error:\n"
f"The Collection '{j}' appears to be missing or has been renamed. If you made any changes to "
f"your .blned file scene, ensure you re-create your NFT Data so Blend_My_NFTs can read your scene."
f"For more information see:{bcolors.RESET}"
f"\nhttps://github.com/torrinworx/Blend_My_NFTs#blender-file-organization-and-structure\n"
)
dnaDictionary = match_DNA_to_Variant(single_dna)
name = input.nftName + "_" + str(Order_Num)
# Change Text Object in Scene to match DNA string:
# Variables that can be used: full_single_dna, name, Order_Num
# ob = bpy.data.objects['Text'] # Object name
# ob.data.body = str(f"DNA: {full_single_dna}") # Set text of Text Object ob
print(f"\n{bcolors.OK}|--- Generating NFT {x}/{NFTs_in_Batch}: {name} ---|{bcolors.RESET}")
print(f"DNA attribute list:\n{dnaDictionary}\nDNA Code:{single_dna}")

Wyświetl plik

@ -14,6 +14,9 @@ def sendMetaDataToJson(metaDataDict, save_path, file_name):
with open(os.path.join(save_path, f"{file_name}.json"), 'w') as outfile:
outfile.write(jsonMetaData + '\n')
def stripNums(variant):
variant = str(variant).split('_')[0]
return variant
# Cardano Template
def createCardanoMetadata(name, Order_Num, NFT_DNA, NFT_Variants, Material_Attributes,
@ -33,7 +36,7 @@ def createCardanoMetadata(name, Order_Num, NFT_DNA, NFT_Variants, Material_Attri
# Variants and Attributes:
for i in NFT_Variants:
metaDataDictCardano["721"]["<policy_id>"][name][i] = NFT_Variants[i]
metaDataDictCardano["721"]["<policy_id>"][name][i] = stripNums(NFT_Variants[i])
# Material Variants and Attributes:
for i in Material_Attributes:
@ -59,7 +62,7 @@ def createSolanaMetaData(name, Order_Num, NFT_DNA, NFT_Variants, Material_Attrib
for i in NFT_Variants:
dictionary = {
"trait_type": i,
"value": NFT_Variants[i]
"value": stripNums(NFT_Variants[i])
}
attributes.append(dictionary)
@ -111,7 +114,7 @@ def createErc721MetaData(name, Order_Num, NFT_DNA, NFT_Variants, Material_Attrib
for i in NFT_Variants:
dictionary = {
"trait_type": i,
"value": NFT_Variants[i]
"value": stripNums(NFT_Variants[i])
}
attributes.append(dictionary)