Skip to content

Instantly share code, notes, and snippets.

@CGLion
Last active April 29, 2023 06:04
Show Gist options
  • Save CGLion/229606949d13ce89a51bc9b56626cbe3 to your computer and use it in GitHub Desktop.
Save CGLion/229606949d13ce89a51bc9b56626cbe3 to your computer and use it in GitHub Desktop.
Python for Blender - access mesh animated vertices location data
import bpy
import bmesh
obj = bpy.context.active_object
frames = range(0,10)
# get the object's evaluated dependency graph:
depgraph = bpy.context.evaluated_depsgraph_get()
# iterate animation frames:
for f in frames:
bpy.context.scene.frame_set(f)
# define new bmesh object:
bm = bmesh.new()
bm.verts.ensure_lookup_table()
# read the evaluated (deformed) mesh data into the bmesh object:
bm.from_object( obj, depgraph )
# iterate the bmesh verts:
for i, v in enumerate(bm.verts):
print("frame: {}, vert: {}, location: {}".format(f, i, v.co))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment