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()
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?


1 Answer 1


The functions for the removal of mesh elements for Mesh(ID) are turned off in the source code.

#if 0 /* BMESH_TODO Remove until BMesh merge */
    func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
    RNA_def_function_flag(func, FUNC_USE_REPORTS);
    RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);

from_pydata is a utility function written in python. You could use bmesh but it might be slower.

I.e. (see verts.new, edges.new, faces.new)

import bmesh
bm = bmesh.new()
for co in vert_data:


for edge_indices in edge_data:
for face_indices in face_data:
        bm.verts[index] for index in face_indices


Btw: I was able to crash blender using this simple script to test from_pydata for existing geometry.

  • $\begingroup$ ok thanks, is there a similiar bmesh function for from_pydata? $\endgroup$ Dec 27, 2014 at 12:53
  • $\begingroup$ I am not aware of any function resembling from_pydata for bmesh. $\endgroup$ Dec 27, 2014 at 13:04
  • $\begingroup$ then I have to write this myself... :/ this will be quite slow $\endgroup$ Dec 27, 2014 at 13:05
  • $\begingroup$ added a short section. $\endgroup$ Dec 27, 2014 at 13:15
  • $\begingroup$ i see, I will try this out now. Thanks a lot $\endgroup$ Dec 27, 2014 at 13:15

You must log in to answer this question.

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