Datasets:
Download blender/kitchen/script.py from MikolajZ/eks_data: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/datasets/MikolajZ/eks_data/resolve/refs%2Fpr%2F2/blender/kitchen/script.py
- Command line
-
hf download hf://datasets/MikolajZ/eks_data@refs/pr/2/blender/kitchen/script.py
-
curl -L -o script.py https://huggingface.co/datasets/MikolajZ/eks_data/resolve/refs%2Fpr%2F2/blender/kitchen/script.py
1.41 kB
| import bpy | |
| import os | |
| # Set output directory | |
| output_dir = "blender/kitchen/plys" # Change this! | |
| # Ensure the output directory exists | |
| if not os.path.exists(output_dir): | |
| os.makedirs(output_dir) | |
| # Set the frame range | |
| start_frame = bpy.context.scene.frame_start | |
| end_frame = bpy.context.scene.frame_end | |
| # Name of the object to export | |
| object_name = "step-000019999_means" | |
| # Deselect everything | |
| bpy.ops.object.select_all(action='DESELECT') | |
| # Get the object | |
| obj = bpy.data.objects[object_name] | |
| # Ensure it is selected and active | |
| obj.select_set(True) | |
| bpy.context.view_layer.objects.active = obj | |
| # Loop through each frame | |
| for frame in range(start_frame, end_frame + 1): | |
| bpy.context.scene.frame_set(frame) | |
| bpy.context.view_layer.update() # Ensure simulation is evaluated | |
| # Export to .obj | |
| 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', # options: 'NONE', 'SRGB', 'LINEAR' | |
| export_attributes=False, | |
| export_triangulated_mesh=False, | |
| ascii_format=True, # Set to False for binary PLY | |
| global_scale=0.1, | |
| forward_axis='Y', | |
| up_axis='Z' | |
| ) | |
| print(f"Exported frame {frame} to {filepath}") |