Triangulation problem ?

Hi - I’m new to the Blender Python API so apologies if this is a newb problem. I am writing my own exporter and everything is going fine except that when I triangulate a mesh it doesn’t seem to change any of the polygon values I get back from the API.

I’m using 2.62.3 BTW… latest build from CVS

For instance… If I take the default cube and assign the object to ‘cube’, then I take the length of the polygons container I get 6.

>>> cube = bpy.data.objects[1]
>>> len( cube.data.polygons )

6

OK. I then triangulate the cube (CTRL-t) so that I’m now dealing with triangles…

>>> len( cube.data.polygons )

6

Huh ? The cube is not 6 quads anymore, it is 12 triangles… I’m obviously doing something really dumb… can anyone point me in the direction of an explanation ?

Same things happens when I look at the edges… before triangulation there are 12 edges, but after triangulation there are still 12 edges… ?

Thanks.

After some more digging it seems that the bmesh module is probably the best way for me to go.

did you try

mesh.calc_normals()
mesh.calc_tessface()

after ctrl-t ?

anyway, i’ve got the same problem with vertexcolors edited with bpy. As you said, bmesh module is probably the best to go…

That did the trick - Thanks !