How can I update/modify the xyz coordinates of a vertex group. I can get the vertex coordinates of the vertex group. BUT, what I want to do is reassign or move the vertex coordinates to a new list of coordinates.
I'm completely lost. It seems that I have the right context and data, but then I cannot figure out how to update/change the coords of the vertices. I've tried a number of things.
So here is the code raw. I first get the coords of the target vertices which are selected in the viewport (object), then I 'get' and print the vertices of the vertex group that I want to update coordinates to (see code). BUT I can't figure out how to update the vertex coordinates. It's probably a noob easy-do but I can't figure it out!! Any help thanks!!! I'm going crazy here trying to figure this out.
import bpy import bmesh obj = bpy.context.active_object objdata = bpy.context.active_object.data vertices = obj.data.vertices vertstarg = [obj.matrix_world * vert.co for vert in vertices] # coordinates as tuples if needed vertstargtup = [vert.to_tuple() for vert in vertstarg] #print(vertstarg) #bpy.ops.object.select_all(action='DESELECT') for obj in bpy.data.objects: obj.select = False #holy cow. have to make the object active before selecting. makes sense now. bpy.context.scene.objects.active = bpy.data.objects['crvface.001'] bpy.data.objects['crvface.001'].select = True obcage = bpy.context.object bpy.ops.object.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action = 'DESELECT') bpy.ops.object.vertex_group_set_active(group='cagefacepts') bpy.ops.object.vertex_group_select() vgVerts = [ v for v in obcage.data.vertices if v.select ] print(vgVerts) #Ok so clearly I can access the vertices of obcage.data vertex group, #but how to I update the coords from objcage.data.vertices to the list from #vertstarg, which is a list of vector coords [or tuples if needed]???