0

I am new to this forum and also to bpy. I would like to insert a series of keyframes but I do not know the data path to use with bmesh, could you help me. Thank you.

import bpy
import bmesh
bpy.ops.object.select_all(action='DESELECT')
bpy.data.objects['Vert'].select_set(True)
bpy.context.view_layer.objects.active = bpy.data.objects['Vert']
me = bpy.context.object.data
bm = bmesh.new()
bm.from_mesh(me)
for v in bm.verts:
    v.co.x += 1.0
    #Here I would like to insert a keyframe on each co.x
bm.to_mesh(me)
bm.free()
Fred IR
  • 1
  • 1
  • 1
    I suppose the answer here is cannot keyframe a bmesh or any bmesh type, eg BMVert, BMEdge, BMFace For a blender object to be (potentially) keyframe-able it must have a keyframe_insert method. Can keyframe vertices. See link above. – batFINGER Aug 22 '21 at 17:44
  • I think you want shapekeys instead of keyframes – Gorgious Aug 23 '21 at 07:20
  • Thank you very much for your advice, if I understood correctly I must insert key frames directly on the coordinates of the vertices. The problem that arises is that of a correct call: bpy.data.meshes["Vert"].vertices[0].keyframe_insert("#i_dont_know_what _to_call_here", frame=1). To Gorgious, I have already tried the shape keys and the file is too heavy ... – Fred IR Aug 23 '21 at 09:08
  • https://blender.stackexchange.com/a/235083/15543 – batFINGER Aug 23 '21 at 10:03
  • Thanks a lot batFINGER that will do the job. – Fred IR Aug 23 '21 at 14:02

0 Answers0