I’m trying to figure out a way to set the base position of a vertex so that the position after an armature modifier (for a posed mesh) is a certain value. I think I’ll be able to jury rig something if I could just find the way to get the coordinates of a given vertex after the modifier takes effect. Enabling the Edit Mode and On Cage options for the modifier will show the vertex in the post-modifier position in the viewport when you’re in Edit Mode, but is there any way at all to get those coordinates via script.
I suppose I could just use the script to apply the modifier, get the post-modifier coords for all the vertices, then run bpy.ops.ed.undo(), but it feels like there should be a better way.
geometry nodes can get that postion, maybe theres a way to exploit it
Get the evaluated version of the mesh through the depsgraph.
dg = bpy.context.evaluated_depsgraph_get()
evaled = target_object.evaluated_get(dg)
mesh = evaled.data.copy()
What is the type of ‘mesh’ in mesh = evaled.data.copy()?
It doesn’t seem to be an array with integer indices like target_object.data.vertices
Actually you probably want to get the mesh from
bpy.data.meshes.new_from_object(evaled). I don’t recall the context of the example I gave before and I don’t have machine on hand to check.
See the last few examples on the page I linked.
mesh2 = evaled.to_mesh().vertices seems to be working well. Thanks!