24 from __future__
import print_function
30 argv = argv[argv.index(
"--") + 1:]
34 print(
"Exporting ogre meshes to <%s>." % output_dir)
36 scene = bpy.context.scene
39 for ob
in scene.objects:
41 bpy.ops.object.delete()
44 file_list = sorted(os.listdir(mesh_dir))
45 for file
in file_list:
46 if file.endswith(
'.dae') ==
True :
48 bpy.ops.wm.collada_import(filepath= os.path.join(mesh_dir , file))
50 for ob
in scene.objects:
53 if ob.name.find(
"_skip") ==-1:
54 bpy.context.scene.objects.active = ob
59 for ob
in scene.objects:
62 bpy.ops.ogre.export(filepath=os.path.join(output_dir, file) +
".scene",
63 EX_COPY_SHADER_PROGRAMS=
False,
67 EX_MESH_OVERWRITE=
True,
69 EX_EXPORT_HIDDEN=
False,
70 EX_FORCE_CAMERA=
False,
75 EX_optimiseAnimations=
False)
77 bpy.ops.object.select_all(action=
"SELECT")
78 bpy.ops.object.delete()
79 print (
"\n\n removed all objects")
80 for ob
in scene.objects:
84 for material
in bpy.data.materials:
85 bpy.data.materials[material.name].user_clear()
86 bpy.data.materials.remove(material)
88 bpy.ops.wm.quit_blender()