MCPcopy Create free account
hub / github.com/OpenMotionLab/MotionGPT / export_animated_mesh

Function export_animated_mesh

scripts/fbx_output.py:233–255  ·  view source on GitHub ↗
(output_path)

Source from the content-addressed store, hash-verified

231
232
233def export_animated_mesh(output_path):
234 # Create output directory if needed
235 output_dir = os.path.dirname(output_path)
236 if not os.path.isdir(output_dir):
237 os.makedirs(output_dir, exist_ok=True)
238
239 # Select only skinned mesh and rig
240 bpy.ops.object.select_all(action='DESELECT')
241 bpy.data.objects['Armature'].select_set(True)
242 bpy.data.objects['Armature'].children[0].select_set(True)
243
244 if output_path.endswith('.glb'):
245 print('Exporting to glTF binary (.glb)')
246 # Currently exporting without shape/pose shapes for smaller file sizes
247 bpy.ops.export_scene.gltf(filepath=output_path, export_format='GLB', export_selected=True, export_morph=False)
248 elif output_path.endswith('.fbx'):
249 print('Exporting to FBX binary (.fbx)')
250 bpy.ops.export_scene.fbx(filepath=output_path, use_selection=True, add_leaf_bones=False)
251 else:
252 print('ERROR: Unsupported export format: ' + output_path)
253 sys.exit(1)
254
255 return
256
257
258if __name__ == '__main__':

Callers 1

fbx_output.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected