Ajout des catalogues d'asset pour Blender

This commit is contained in:
Philippe Roy 2023-04-13 15:03:47 +02:00
parent 6ea976aaae
commit e8fef432ee
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,21 @@
# This is an Asset Catalog Definition file for Blender.
#
# Empty lines and lines starting with `#` will be ignored.
# The first non-ignored line should be the version indicator.
# Other lines are of the format "UUID:catalog/path/for/assets:simple catalog name"
VERSION 1
31868ea6-0401-422e-a4d2-678e05338bb0:1 fenetre:1 fenetre
1591e8b0-fb46-471c-a394-0e08c73d1a63:2 fenetres:2 fenetres
44aab365-d214-435c-be4c-9bb372564875:Baie vitree:Baie vitree
b4833c7d-07c2-4590-9372-0b7250b8a82f:Bloc:Bloc
8e517d06-8258-4f89-871c-9ade9e9aa5b5:Cadre Fenetres:Cadre Fenetres
56286d72-e111-40d7-a07a-cd7eded67f72:Cadre Porte:Cadre Porte
d8cf6a1e-199b-45ce-aa90-4057647f5cf7:Cadre Porte:Cadre Porte
0fd3fdda-3023-4501-a82a-c5fa3d4e2675:Climatisation:Climatisation
1af5edfa-0b8b-41e4-be86-3ba2e1e2fcd4:Coin:Coin
3ae0c7b9-2e01-4893-8a7f-0b13c93c0bf5:Niveau:Niveau
c826bdf4-f96a-4e38-a17c-3879298475f8:Porte:Porte
0dd7c83c-1c61-487e-9e8d-e7240d79e0b9:Toit:Toit
b780bba0-9f35-465f-ab71-365ba0498982:Toit plat:Toit plat

View File

@ -0,0 +1,21 @@
import os
import bpy
# put the location to the folder where the objs are located here in this fashion
# this line will only work on windows ie C:\objects
path_to_obj_dir = os.path.join('/home/phroy/Bureau/seriousgames/blender-edutech/git/climway2/asset/kenney_modular-buildings/Models/')
# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))
print (file_list)
# get a list of files ending in 'dae'
obj_list = [item for item in file_list if item.endswith('.obj')]
# loop through the strings in obj_list and add the files to the scene
for item in obj_list:
path_to_file = os.path.join(path_to_obj_dir, item)
print (path_to_file)
bpy.ops.wm.obj_import(filepath = path_to_file)
# if heavy importing is expected
# you may want use saving to main file after every import
bpy.ops.wm.save_mainfile(filepath = "/home/phroy/file.blend")