Updating DNA_Generator.py

Setting False as default for useModels in config.py
Added test.py for PC test of phantom collections
pull/11/head
Torrin Leonard 2021-11-06 16:45:44 -04:00
rodzic 6ef95260f3
commit f4e5a9271d
6 zmienionych plików z 72 dodań i 2 usunięć

Wyświetl plik

@ -341,7 +341,7 @@ def turnAll(toggle):
# ONLY FOR TESTING, DO NOT EVER USE IF RECORD IS FULL OF REAL DATA
# THIS WILL DELETE THE RECORD:
# Not - NFTRecrod.json will be created the next time you run main.py
# Note - NFTRecrod.json will be created the next time you run main.py
def clearNFTRecord(AREYOUSURE):
if AREYOUSURE == True:
os.remove("NFTRecord.json")

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -54,7 +54,7 @@ batch_save_path = save_path + slash + 'Batch_Json_files' # The output path for b
images_save_path = save_path + slash + 'NFT_Image_Output' # The output path for images generated by Image_Generator.py
# 3D model imports and exports variables:
useModels = True # Set to True if useing external models as attributes instead of Blender objects
useModels = False # Set to True if useing external models as attributes instead of Blender objects
objectFormatImport = 'gltf' # The file format of the objects you would like to import
objectFormatExport = 'gltf' # The file format of the objects you would like to export

70
test.py 100644
Wyświetl plik

@ -0,0 +1,70 @@
import bpy
import os
import sys
import importlib
dir = os.path.dirname(bpy.data.filepath)
sys.path.append(dir)
sys.modules.values()
from src.main import config
importlib.reload(config)
from src.main.config import *
coll = bpy.context.scene.collection
scriptIgnore = bpy.data.collections["Script_Ignore"]
listAllCollInScene = []
listAllCollections = []
def traverse_tree(t):
yield t
for child in t.children:
yield from traverse_tree(child)
for c in traverse_tree(coll):
listAllCollInScene.append(c)
def listSubIgnoreCollections():
def getParentSubCollections(collection):
yield collection
for child in collection.children:
yield from getParentSubCollections(child)
collList = []
for c in getParentSubCollections(scriptIgnore):
collList.append(c.name)
return collList
ignoreList = listSubIgnoreCollections()
for i in listAllCollInScene:
if generateColors:
if i.name in colorList:
for j in range(len(colorList[i.name])):
if i.name[-1].isdigit() and i.name not in ignoreList:
listAllCollections.append(i.name + "_" + str(j + 1))
elif j == 0:
listAllCollections.append(i.name)
elif i.name[-1].isdigit() and i.name not in ignoreList:
listAllCollections.append(i.name + "_0")
else:
listAllCollections.append(i.name)
else:
listAllCollections.append(i.name)
listAllCollections.remove(scriptIgnore.name)
listAllCollections.remove("Master Collection")
def allScriptIgnore(collection):
'''
Removes all collections, sub collections in Script_Ignore collection from listAllCollections.
'''
for coll in list(collection.children):
listAllCollections.remove(coll.name)
listColl = list(coll.children)
if len(listColl) > 0:
allScriptIgnore(coll)
allScriptIgnore(scriptIgnore)
listAllCollections.sort()
print(listAllCollections)