How can I get the location and normal of a vertex from a mesh with shape keys?

I have a simple cube with shape key. When I trying to get the vertice location (in python), I get the location of the Relative key (‘basis’).The vertice normal I can get if I turn on the shape key (me.active_shape_key_index = 1).
But I need to get the normal and the location. How can I do this?
Attached the blend file with the cube.


import bpy
obj = bpy.data.objects['Cube']
me = obj.data
#me.active_shape_key_index = 1
vertice = me.vertices[0]
print('coords:', vertice.co)
print('normal:', vertice.normal)

Attachments

test_get_vertice_coord.zip (69.6 KB)

You can access the location like this:

 >>> C.object.data.shape_keys.key_blocks['Key 1'].data[0].co
Vector((1.4572190046310425, 1.4572190046310425, -1.4572190046310425))

It’s a bit confusing. I’ll see if the index of this “key_blocks.data” is the same vertex index. If not then we have a problem.

It corresponds to vertex indices indeed.

good to know :slight_smile:

It only partially answers the thread for shape keys vertices location…
Is there a mean to access normals or are these computed by Blender internally?
Does it means we have to compute shapekeys normals by ourself?
Thanks in advance