I have a mesh with armature modifier. Is there any efficient way to read its vertices coordinates with modifiers accounted in Blender 2.80?
So far the only way I found is to duplicate the object, apply modifier, read vertices and remove duplicated object:
def extract_vertices(my_object): # Duplicate object for obj in bpy.data.objects: obj.select_set(False) my_object.select_set(True) bpy.ops.object.duplicate_move() # Apply modificators duplicated_object = bpy.context.scene.objects[-1] bpy.context.view_layer.objects.active = duplicated_object duplicated_object.select_set(True) bpy.ops.object.modifier_apply(apply_as='DATA', modifier="RIG") # Read vertices vertices = [v.co for v in duplicated_object.data.vertices] # Remove duplicated object my_object.select_set(False) bpy.ops.object.delete() return vertices
It works, but very slow. I need to run this thing thousands of times in the loop, adjusting modifier every iteration.