I’m writing an importer for a file format that has mesh deforms (RVK’s). I’m trying to move the vertices in the mesh by a ‘morph’, an offset relative to the vertex’s current position.
the function to move the vertices is:
def addNewRVK(morph, meshobj):
base = meshobj.data.key.blocks[0].data
current = meshobj.data.verts
for x in morph.vertList:
current[x.mvid].co = base[x.mvid] + x.Coords
meshobj.data.update()
meshobj.insertShapeKey()
meshobj.data.update()
base = the coordinates of the base key
current = the vertices of the mesh object
x, from morph.vertList, is a class object with the attributes mvid and Coords. mvid is the
index number of the vertice (which corresponds to verts[x].index in Blender mesh objects), and Coords is a Blender Vector Object which represents the vertex’s offset relative to the base.
Unfortunately,
current[x.mvid].co = base[x.mvid] + x.Coords
raises an exception:
AttributeError: co
It seems I can’t access the Coordinate attribute of a Blender Vertice. What am I doing wrong?