I'm working on the Animation Nodes Addon and want to create some new nodes which can work with mesh data like polygons. To output the created mesh I have to put it onto an object like this:
mesh = bpy.data.meshes.new(name = "mesh")
mesh.from_pydata(vert_data, edge_data, face_data)
object.data = mesh
This works all fine but the problem is that this generates a new mesh object on each call, which means about 30 times per second.
I also tried to call .from_data
on an existing Mesh but this just appends the new mesh data. Is there a clean and fast way to remove all verts, so that I can append the new data to an empty Mesh?
bm = bmesh.new()
bm.to_mesh(object.data)
object.data.from_pydata(vert_data, edge_data, face_data)
This seams to work but throws an error I don't understand (or more a warning). This warning looks like here: https://developer.blender.org/T40571
Can someone explain this message or tell me a way to work around that?