I wanted to set normals from a script, using this code (in a class method):
for face in modelMesh.polygons:
face.use_smooth = True # normals have effect only if smooth shading
for i in range(len(self.vertices)): # set normals here because they seem to be lost in some calulations
if self.normals[i] is not None:
modelMesh.vertices[i].normal = Vector(self.normals[i])
for loop in modelMesh.loops:
loop.normal = Vector(self.normals[loop.vertex_index])
however, if this sets the normals to the mesh's vertices, they are reset after using 'modelMesh.update()'
or switching edit mode on and off
(and btw it seems that the loop normals stay 'Vector((0,0,0))'
whatever I try, even '.normal[:] = Vector((1,0,0))'
and '.normal[:] = (1,0,0)'
)
is there a way so set vertex normals permanently using python? thanks in advance