kopia lustrzana https://github.com/torrinworx/Blend_My_NFTs
Adding support for importing and exporting multiple file types
Files to be imported are now automatically imported without specifying file type. Files to be exported now can be exported as .fbx, .obj, .x3d, or .glb. This setting can be configured in config.py.pull/13/head
rodzic
bf0a5b8f3c
commit
fa80cdacf3
Plik binarny nie jest wyświetlany.
|
@ -49,6 +49,8 @@ def generate3DModels():
|
|||
o.select_set(True)
|
||||
bpy.ops.object.delete()
|
||||
|
||||
deleteAllObjects()
|
||||
|
||||
attributeList = os.listdir(modelAssetPath)
|
||||
removeList = [".gitignore", ".DS_Store", "Script_Ignore_Folder"]
|
||||
attributeList = [x for x in attributeList if (x not in removeList)]
|
||||
|
@ -79,12 +81,18 @@ def generate3DModels():
|
|||
|
||||
count = 1
|
||||
for i in allCombinationsNames:
|
||||
if objectFormatImport == "gltf":
|
||||
|
||||
path1 = modelAssetPath + slash + "Script_Ignore_Folder"
|
||||
Script_Ignore_Folder = os.listdir(path1)
|
||||
|
||||
for h in Script_Ignore_Folder:
|
||||
fileName, fileExtension = os.path.splitext(h)
|
||||
if fileExtension == ".glb":
|
||||
bpy.ops.import_scene.gltf(filepath=path1 + slash + h)
|
||||
elif fileExtension == ".fbx":
|
||||
bpy.ops.import_scene.fbx(filepath=path1 + slash + h)
|
||||
elif fileExtension == ".obj":
|
||||
bpy.ops.import_scene.obj(filepath=path1 + slash + h)
|
||||
|
||||
for j in i:
|
||||
def getParent(hierarchy):
|
||||
|
@ -96,12 +104,29 @@ def generate3DModels():
|
|||
parent = getParent(hierarchy)
|
||||
path2 = modelAssetPath + slash + parent + slash + j
|
||||
|
||||
if objectFormatImport == "gltf":
|
||||
fileName, fileExtension = os.path.splitext(j)
|
||||
if fileExtension == ".glb":
|
||||
bpy.ops.import_scene.gltf(filepath=path2)
|
||||
elif fileExtension == ".fbx":
|
||||
bpy.ops.import_scene.fbx(filepath=path2)
|
||||
elif fileExtension == ".obj":
|
||||
bpy.ops.import_scene.obj(filepath=path2)
|
||||
|
||||
if objectFormatExport == 'glb':
|
||||
bpy.ops.export_scene.gltf(filepath=model_save_path + slash + imageName + str(count),
|
||||
check_existing=True, export_format='GLB')
|
||||
elif objectFormatExport == 'fbx':
|
||||
bpy.ops.export_scene.fbx(filepath=model_save_path + slash + imageName + str(count),
|
||||
check_existing=True)
|
||||
elif objectFormatExport == 'obj':
|
||||
bpy.ops.export_scene.obj(filepath=model_save_path + slash + imageName + str(count),
|
||||
check_existing=True)
|
||||
elif objectFormatExport == 'x3d':
|
||||
bpy.ops.export_scene.x3d(filepath=model_save_path + slash + imageName + str(count),
|
||||
check_existing=True)
|
||||
|
||||
deleteAllObjects()
|
||||
|
||||
count += 1
|
||||
|
||||
print("Generated .glb files in %.4f seconds" % (time.time() - time_start))
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -1,8 +1,7 @@
|
|||
import platform
|
||||
|
||||
# NFT configurations:
|
||||
maxNFTs = 0 # The maximum number of NFTs you want to generate - doesn't do anything yet
|
||||
nftsPerBatch = 2 # Number of NFTs per batch
|
||||
nftsPerBatch = 3 # Number of NFTs per batch
|
||||
renderBatch = 1 # The batch number to render in PNG-Generator
|
||||
imageName = "ThisCozyPlace_" # The name of the NFT image produces by PNG-Generator
|
||||
fileFormat = 'JPEG' # Dictate the image extension when Blender renders the images
|
||||
|
@ -10,13 +9,30 @@ fileFormat = 'JPEG' # Dictate the image extension when Blender renders the image
|
|||
# for a list of file formats supported by Blender. Enter the file extension exactly as specified in
|
||||
# the Blender API documentation above.
|
||||
|
||||
includeRarity = False
|
||||
# True = include weighted rarity percentages in NFTRecord.json calculations,
|
||||
# False = Pure random selection of variants
|
||||
# The path to Blend_My_NFTs folder:
|
||||
save_path_mac = '/Users/torrinleonard/Desktop/Blend_My_NFTs'
|
||||
save_path_windows = r''
|
||||
# Example mac: /Users/Path/to/Blend_My_NFTs
|
||||
# Example windows: C:\Users\Path\to\Blend_My_NFTs
|
||||
|
||||
enableMaxNFTs = True # Turn on the maximum number of NFTs, use this to limit the number of DNA sent to NFTRecord, and subsequent batches
|
||||
maxNFTs = 100 # The maximum number of NFTs you want to generate - doesn't do anything yet
|
||||
|
||||
resetViewport = True # If True: turns all viewport and render cameras on after Image_Generator is finished operations
|
||||
|
||||
# 3D model imports and exports variables:
|
||||
use3DModels = True # Set to True if using external models as attributes instead of Blender objects
|
||||
|
||||
objectFormatExport = 'glb' # The file format of the objects you would like to export
|
||||
# The following are file formats Blender accepts for exporting object files.
|
||||
# Please type the exact name provided below in the '' above:
|
||||
# fbx - The .FBX file format
|
||||
# glb - The .glb file format
|
||||
# obj - The .obj file format *Exports both a .obj and a .mtl files for the same generated object
|
||||
# x3d - The .x3d file format
|
||||
|
||||
# Object colour options:
|
||||
# Doesn't work with 3D model generator
|
||||
generateColors = True # When set to true this applies the sets of colors listed below to the objects in the collections named below
|
||||
|
||||
# The collections below are RGBA Color values. You can put as many or as little color values in these lists as you would like.
|
||||
|
@ -29,12 +45,6 @@ rgbaColorList2 = [(1,1,0,1),(0,1,1,1),(.5,0,1,1),(.5,1,1,1),(0,.5,0,1)]
|
|||
# The collection named can only contain objects and not sub collections. Every object in the collection will be set to the colors you assigned above for each attribute
|
||||
colorList = {"Cube_2_0":rgbaColorList1,"Sphere_1_0":rgbaColorList2}
|
||||
|
||||
# The path to Blend_My_NFTs folder:
|
||||
save_path_mac = '/Users/torrinleonard/Desktop/Blend_My_NFTs'
|
||||
save_path_windows = r''
|
||||
# Example mac: /Users/Path/to/Blend_My_NFTs
|
||||
# Example windows: C:\Users\Path\to\Blend_My_NFTs
|
||||
|
||||
# Utilities - DO NOT TOUCH:
|
||||
mac = 'Darwin' # Mac OS
|
||||
windows = 'Windows' # Windows
|
||||
|
@ -52,26 +62,16 @@ elif platform.system() == windows:
|
|||
# Paths to folders
|
||||
batch_save_path = save_path + slash + 'Batch_Json_files' # The output path for batches genreated by Batch_Sorter.py
|
||||
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:
|
||||
use3DModels = False # Set to True if using 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
|
||||
|
||||
# The following are file formats Blender accepts for importing and exporting object files.
|
||||
# Please use the exact name provided below in the '' above:
|
||||
# fbx - The .FBX file format
|
||||
# gltf - The .glb file format
|
||||
# obj - The .obj file format
|
||||
# x3d - The .x3d file format
|
||||
|
||||
# Specify the XYZ location for objects imported as external files:
|
||||
locationObjectAttribute = {
|
||||
"Cone": {"x":0, "y":0, "z":0},
|
||||
"Cube": {"x":0, "y":0, "z":0}
|
||||
}
|
||||
|
||||
# Utilities - DO NOT TOUCH:
|
||||
modelAssetPath = save_path + slash + "3D_Model_Input" # The input path for 3D models
|
||||
model_save_path = save_path + slash + "3D_Model_Output" # The output path for 3D models generated by Model_Generator.py
|
||||
|
||||
# FEATURES THAT ARE EXPERIMENTAL AND/OR DO NOT WORK YET:
|
||||
# Specify the XYZ location for objects imported as external files:
|
||||
locationObjectAttribute = {
|
||||
"Cone": {"x": 0, "y": 0, "z": 0},
|
||||
"Cube": {"x": 0, "y": 0, "z": 0}
|
||||
}
|
||||
|
||||
enableRarity = False
|
||||
# True = include weighted rarity percentages in NFTRecord.json calculations,
|
||||
# False = Pure random selection of variants
|
||||
|
|
Ładowanie…
Reference in New Issue