NMesh getData() bug

not sure where to post this

if you use getData many times, it gives you different adress of nmesh instances
not sure it is a bug, but sure a pain in the ass
I am writing my own export script and sometimes the Blender.Object.GetSelected returns also empty lists from time to time

seems all buggy to me

can someone help me here ?

NMesh objects are a copy of the mesh’s data

so each time you call getData() you get another copy

and, it is possible to have nothing selected… in wich case getSelected will return an empty list. Even though you have nothing selected you still may be able to get into edit mode [because you still have an active object… it has a pink dot but is black in wireframe mode]


  • the problem is that sometimes the number of points of each face is not matchin with the model I created (only with triangles)
    i get 4 points per face even if i did a CTRL t
    In fact getdata is giving me the mesh of another object
    althoug i did a ‘single user’ command on each object

  • in my scene, everything is selected, if i open the script window as fullscreen, then sometimes, it returns an empty list
    then i shrink the script view to see the 3D view, and then expand agfain the script window to full screen, getselected returns the correct list of objects
    so it is clearly a bug
    or maybe blender need a 3D view open to return the correct data

Make sure your out of editmode before you get the mesh. Try use ob.getData(mesh=1) for the new mesh objects.

you don’t split your view in half when working with python?

I do see what you mean about nothing acting selected when there isn’t a 3d view open…

import Blender

objs = Blender.Object.GetSelected()
if objs != None:
	obj = objs[0]
	print len(obj.getData().faces[0].v)
	print "nothing selected?"

this properly works with my single triangle mesh… and with my single quad mesh

are you trying to run a script while in edit mode?