Edge->Face connectivity dict for NMESH or mesh.update() alternative?

Hello all,

I am working on a code that adds and deletes faces in a mesh. The code utilizes both NMESH [mesh=obj.getData()] and MESH [mesh2=obj.getData(mesh=1)] copies of the same mesh to exploit builtin members in both. Such members may be the texture information (in NMESH) or some edge/face connectivity related functions (in MESH).

The problem is when I delete a face or vertex in one copy, which requires me to run mesh.update to sync the two sides. The update call is a costly one and slows down the code significantly…

Here is the piece of code that forces me to use the MESH class and I am looking to drop it:

a dictionary where the edge is the key, and a list of faces that use it are the value

mesh2=ObjIn.getData(mesh=1)
edge_faces = dict([(ed.key, []) for ed in mesh2.edges])

Add the faces to the dict

for fc in mesh2.faces:
for key in fc.edge_keys:
edge_faces[key].append(fc)

Can anyone advice me on how I can put together the same dictionary for the NMESH,
mesh=ObjIn.getData() ?

Alternatively you may have ideas for a way around the mesh.update call…

Thanks.

albcem

This won’t answer your question but: NMesh is deprecated in favor of Mesh. So you might want to consider re-writing the rest to use Mesh.

What exactly does NMesh allow you to do that you can’t do with Mesh? A real question because I don’t know for sure but suppose there might be something (although that would suprise me).

I have been using variations of pre-existing codes in NMESH, in which material data is preserved. I have not observed MESH to take care of materials. Essentially before I can apply mesh modifications, I merge the mesh of two objects with distinct materials. After some operations at the seam, I break them back into the two objects based on the materials. Is there a way to extract MESH data with materials from an object?