Created
September 11, 2023 07:13
-
-
Save CGArtPython/61e208dfe0a1034c7dbb34824bbcce26 to your computer and use it in GitHub Desktop.
Blender Python get selected verts via list comprehension (video tutorial here: https://youtu.be/N3U2noAHgBo)
This file contains hidden or 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
import bpy | |
import bmesh | |
# get a reference to the active object | |
mesh_obj = bpy.context.active_object | |
# create a new bmesh | |
bm = bmesh.from_edit_mesh(mesh_obj.data) | |
selected_verts = [vert for vert in bm.verts if vert.select] | |
print("selected vert") | |
for vert in selected_verts: | |
print(f"{vert.index}") | |
# clean up/free memory that was allocated for the bmesh | |
bm.free() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment