If I create a new mesh with Blender.NMesh.PutRaw (mesh, “Name”, 1), that functions returns an object to which this object is connected. But If the Mesh already exists and I use Blender.NMesh.PutRaw I just get None. So, if the mesh already exists, how do I get the name of the object it is connected to (if the mesh didn’t exists, its name will become mesh.001. But how do I now how much unnamed meshes where already created?)
This is what I do, I just rename the object to the meshname:
meshname = "whatever" object = Blender.NMesh.PutRaw(mesh, meshname) if object: # object is new, rename object.name = meshname else: # object already exists, get it using the name assigned to it object = Blender.Object.Get(meshname)
Thank you very much for your help. Works like a charm. Now I just need to know how to put a object to another layer with python. Tried object.Layer = 20 but nothing happens. Is this supposed to work? (btw: I am using blender 2.22).
object.Layer is a bitfield (IIRC), so layer1=1, layer2=2, layer3=4, layer4=8 and so on