:Z How different is NMesh from Mesh
:Z Can you use complex trig and calc to make stuff in Mesh like you can in NMesh like this example below:
[# radius of the sphere
radius=2.0
for i in range(0, n):
for j in range(0, n):
x = sin(jpi2/(n-1))cos(-pi/2+ipi/(n-1))radius
y = cos(jpi*2/(n-1))cos(-pi/2+ipi/(n-1))radius
z = sin(-pi/2+ipi/(n-1))*radius
v=NMesh.Vert( x , y , z )
me.verts.append(v)
in the last tuhopu/blender2.25 API python you can’t find “Mesh” at all (and also in the official Blender2.26). So do not waste your time with this module…
Thanks to both of you for your help, the main reason for the concern is that the Python tutorial on blender.org said that the NMesh module was almost declared obsolete and won’t be on next release of Blender.
And after reading jms’ tutorial, I was about to really get into studying Trig and Calc - and I was afraid that it was going to be all for nothing if they drop NMesh.
Since we are on the topic, jms - how did you know to use to use Trig and Calc with Blender Python to create all those really cool things (Potatoids) on your tutorial?
I use Blender 2.26 and I need to use both Mesh and NMesh :
I use NMesh because it is possible to manipulate vertices and faces once the object is already created. But the big drama, is that if your object has a material, it will crash Blender as soon as you will use PutRaw… (Or when you will try to reopen your file). Unfortunately, setMaterial does not seem to work with NMesh, and for some reasons, the NMesh materials are emptyed when you call PutRaw.
So I use Mesh when I need to create an object with a material. This is often the case when these kind of creation are made during an animation (explosion…). The big drama with Mesh, is that it is not as complete as NMesh, and you can’t modify previously created verts/faces . Even when you create faces you can’t use previously created verts, so you can forget about smoothing your faces. The only thing you can do with Mesh is to add faces. But then you can set the material… and setMaterials works. Be careful if you use newFace = mesh.addFace in a loop : if new Face is a local variable in the loop it will crash ! Use a list or a global instead !!
Please someone tell me that I am wrong, because I consider it is a very big problem…
A known bug, somekind of usercount problem, but you can link materials to the object instead of the mesh though, that should work.
Btw, normally, if it weren’t for the bug, for material changes calling mesh.update() should be enough.