2
$\begingroup$

Sorry, yet another question about lattice from a beginner...

Consider a scene with a mesh (say, a default plane) and a (default) lattice. Let's run the following script in edit mode and in object mode with the plane (x)or the lattice selected.

import bpy

lat = bpy.data.lattices['Lattice']
obj = bpy.data.objects['Lattice']

for n in range(len(lat.points)):
    print(obj.data.points[n].co)

obj = bpy.data.objects['Plane']

print('***')

for n in range(len(obj.data.vertices)):
    print(obj.data.vertices[n].co)

I get:

<Vector (-0.5000, -0.5000, -0.5000)>
<Vector (0.5000, -0.5000, -0.5000)>
<Vector (-0.5000, 0.5000, -0.5000)>
<Vector (0.5000, 0.5000, -0.5000)>
<Vector (-0.5000, -0.5000, 0.5000)>
<Vector (0.5000, -0.5000, 0.5000)>
<Vector (-0.5000, 0.5000, 0.5000)>
<Vector (0.5000, 0.5000, 0.5000)>
***
<Vector (-1.0000, -1.0000, 0.0000)>
<Vector (1.0000, -1.0000, 0.0000)>
<Vector (-1.0000, 1.0000, 0.0000)>
<Vector (1.0000, 1.0000, 0.0000)>

in object mode when the plane is selected, in object mode when the lattice is selected and in edit mode when the plane is selected.

I get:

<Vector (-0.5000, -0.5000, -477240864.0000)>
<Vector (-1.5000, -1.5000, -477240864.0000)>
<Vector (-0.5000, -1.5000, -477240864.0000)>
<Vector (-1.5000, -0.5000, -477240864.0000)>
<Vector (-0.5000, -0.5000, -477240864.0000)>
<Vector (-1.5000, -1.5000, -477240864.0000)>
<Vector (-0.5000, -1.5000, -477240864.0000)>
<Vector (-1.5000, -0.5000, -477240864.0000)>
***
<Vector (-1.0000, -1.0000, 0.0000)>
<Vector (1.0000, -1.0000, 0.0000)>
<Vector (-1.0000, 1.0000, 0.0000)>
<Vector (1.0000, 1.0000, 0.0000)>

in edit mode when the lattice is selected.

Why is there such a difference in edit mode for the lattice only?

$\endgroup$

1 Answer 1

0
$\begingroup$

Just bumped into this.

You can find deformed coordinates in this way:

lat = bpy.data.lattices['Lattice']

for n in range(len(lat.points)):
    print(obj.data.points[n].co_deform)

Hope it helps!

Cheers

$\endgroup$

You must log in to answer this question.

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