MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / export_animated_mesh

Function export_animated_mesh

scripts/fbx_output_smplx.py:306–328  ·  view source on GitHub ↗
(output_path)

Source from the content-addressed store, hash-verified

304
305
306def export_animated_mesh(output_path):
307 # Create output directory if needed
308 output_dir = os.path.dirname(output_path)
309 if not os.path.isdir(output_dir):
310 os.makedirs(output_dir, exist_ok=True)
311
312 # Select only skinned mesh and rig
313 bpy.ops.object.select_all(action='DESELECT')
314 bpy.data.objects[ROOT_NAME].select_set(True)
315 bpy.data.objects[ROOT_NAME].children[0].select_set(True)
316
317 if output_path.endswith('.glb'):
318 print('Exporting to glTF binary (.glb)')
319 # Currently exporting without shape/pose shapes for smaller file sizes
320 bpy.ops.export_scene.gltf(filepath=output_path, export_format='GLB', export_selected=True, export_morph=False)
321 elif output_path.endswith('.fbx'):
322 print('Exporting to FBX binary (.fbx)')
323 bpy.ops.export_scene.fbx(filepath=output_path, use_selection=True, add_leaf_bones=False)
324 else:
325 print('ERROR: Unsupported export format: ' + output_path)
326 sys.exit(1)
327
328 return
329
330
331if __name__ == '__main__':

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected