NMFace.smooth

What part of the gui controls the smooth attribute of NMFace? It always seem to be equal to 1 when I print it out.

The are a “Smooth” and a “Solid” Button in the Edit-Buttons (F9). In Object-Select-Mode, this works on the whole Object, in Edit-Mode, for each single Face.
Doc

I saw the buttons, but it doesn’t seem to change the smooth attribute. I have selected all the faces and hit solid and it still prints out 1. I am trying to solve a problem I am having with the obj_export.py script. It seems to always export smooth vertex normals. So I added the line print "Smooth ", f1.smooth after for f1 in m.faces: to see what smooth was set to and it is always 1 which explains why the vertex normals are smooth.

the vertex normals aren’t changed, just the smooth flag on the face

you need to find the proper normals [the face normal] for non-smooth faces, for triangles it is the cross product of two edges, for quads it is the cross of the diagonals.

nmesh objects aren’t updated until you exit edit mode.

import Blender
me = Blender.Object.GetSelected()[0].getData()
for face in me.faces:
	print face.smooth,
print

with default cube prints: “0 0 0 0 0 0”
if you hit set smooth [edit buttons, while out of edit mode], will print: “1 1 1 1 1 1”

I don’t belive the obj export cares about the solid/smooth attribute of the face

I never exited edit mode that is why the flag didn’t change. I new it would be something simple. Thanks. I know obj_export.py doesn’t look at smooth. I was going to change it to. Is NMFace.no the same type as NMVert.no? When I change noTx = apply_normal_transform(v.no, matrix_3x3) to noTx = apply_normal_transform(f1.no, matrix_3x3) I get TypeError: expected vector type. I would think the face normal would be a vector type.

the NMesh api is older than the math modules in blender

it uses lists or tuples of floats, you will have to convert or use your own math lib

Thanks I got it to work. I just passed Mathutils.Vector f1.no and that created a vector for it to use. So, Mathutils uses lists of floats, then what does NMesh use? Is NMesh in the process of being update since vertex normals is the same type that Mathutils needs, but face normals are not. They are both part of the NMesh api correct. Also is this documented anywhere? I could not find where the type information was given for different things in NMesh like the normals.