3
$\begingroup$

I'm using few rotations and scale changes in a model and then export the location of the vertices after the change, but when I do so, the vertices extracted are those of before the transformations and not after. How can I extract the new vertices?

An example for a transformation:

bpy.data.objects["Main"].pose.bones["finger5-.L"].rotation_quaternion[1]=random.uniform(0, 0.4)

And the code for extracting the vertices:

mesh = bpy.data.objects["Main:Body"]
vertices = mesh.data.vertices
for vertex in vertices:
    vertex1 = vertex.co[0]
    vertex2 = vertex.co[1]
    vertex3 = vertex.co[2]
    row = [vertex1, vertex2, vertex3]
    with open(os.path.join(vertices_output_path, 'vertices.csv'), 'a') as csvFile:
        writer = csv.writer(csvFile)
        writer.writerow(row)
        csvFile.close()
$\endgroup$
1

1 Answer 1

1
$\begingroup$

Please search here at BSE for

matrix_world

as in

worldc = o1.matrix_world * vertex.co

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .