Last active
February 26, 2024 15:40
-
-
Save MarilynKeller/be96aaac53f843ee822dbcfb6774b1b1 to your computer and use it in GitHub Desktop.
Blender python script to export the selected vertices as a list of indices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Blender python script to export the selected vertices as an index list.""" | |
import bpy | |
import pickle | |
# Fetch the selected object and list all the selected vertices indices | |
bpy.ops.object.mode_set(mode = 'OBJECT') | |
obj = bpy.context.object | |
bpy.ops.object.mode_set(mode = 'EDIT') | |
verts_ind = [i.index for i in obj.data.vertices if i.select] | |
print(verts_ind) | |
# Save this list as a pickle | |
out_file = 'verts_indices.pkl' | |
pickle.dump(verts_ind,open(out_file, 'wb')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment