| import bpy |
| import os |
|
|
| |
| output_dir = "blender/kitchen/plys" |
|
|
| |
| if not os.path.exists(output_dir): |
| os.makedirs(output_dir) |
|
|
| |
| start_frame = bpy.context.scene.frame_start |
| end_frame = bpy.context.scene.frame_end |
|
|
| |
| object_name = "step-000019999_means" |
|
|
| |
| bpy.ops.object.select_all(action='DESELECT') |
|
|
| |
| obj = bpy.data.objects[object_name] |
|
|
| |
| obj.select_set(True) |
| bpy.context.view_layer.objects.active = obj |
|
|
| |
| for frame in range(start_frame, end_frame + 1): |
| bpy.context.scene.frame_set(frame) |
| bpy.context.view_layer.update() |
|
|
| |
| filename = f"{(frame - 1):05d}.ply" |
| filepath = os.path.join(output_dir, filename) |
|
|
| bpy.ops.wm.ply_export( |
| filepath=filepath, |
| apply_modifiers=True, |
| export_selected_objects=True, |
| export_normals=True, |
| export_uv=True, |
| export_colors='NONE', |
| export_attributes=False, |
| export_triangulated_mesh=False, |
| ascii_format=True, |
| global_scale=0.1, |
| forward_axis='Y', |
| up_axis='Z' |
| ) |
|
|
| print(f"Exported frame {frame} to {filepath}") |