Support empty export

This commit is contained in:
2024-05-09 16:00:41 +02:00
parent e959960e42
commit c000fae4a8
+1 -4
View File
@@ -40,19 +40,16 @@ class ExportForFange(bpy.types.Operator):
print(f'[Pipeline] Update "{coll.name}" mesh') print(f'[Pipeline] Update "{coll.name}" mesh')
child = bpy.data.collections.get(coll.name) child = bpy.data.collections.get(coll.name)
print(f'[Pipeline] Select all mesh inside the collection "{child.name}"')
for ob in child.all_objects: for ob in child.all_objects:
print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"') print(f'\tLook "{ob.name}", his type are "{type(ob.data)}"')
# TODO Support another type object, not only SM/SK # TODO Support another type object, not only SM/SK
if isinstance(ob.data, bpy.types.Mesh): if ob.type == 'MESH' or 'EMPTY':
ob.select_set(True) ob.select_set(True)
abs_export = self.category.joinpath(self.asset, "Meshes") abs_export = self.category.joinpath(self.asset, "Meshes")
if not abs_export.exists(): if not abs_export.exists():
abs_export.mkdir() abs_export.mkdir()
print(f'[Pipeline] Export fbx here "{abs_export.joinpath(f"SM_{coll.name}.fbx").as_posix()}"')
# TODO Use a preset system # TODO Use a preset system
bpy.ops.export_scene.fbx(filepath=abs_export.joinpath(f"SM_{coll.name}.fbx").as_posix(), bpy.ops.export_scene.fbx(filepath=abs_export.joinpath(f"SM_{coll.name}.fbx").as_posix(),
use_selection=True, use_selection=True,