I love the auto-smooth feature a lot, but I have a problem. I want to export the auto-smoothed mesh so that the edges that appear sharp are also exported as sharp edges.
The easiest solution I can come up with, is adding an edge-split modifier with the same options to the mesh, applying that and exporting. However I was wondering if there is a more direct way, like with tessfaces.
import bpyfrom math import radians
me = bpy.context.object.data
me.use_auto_smooth = True
me.auto_smooth_angle = radians(30)
print("before")
for l in me.loops:
print(l.normal)
me.calc_normals_split()
me.auto_smooth_angle = radians(160)
print("after")
for l in me.loops:
print(l.normal)
The after-normals differ from the before-normals in my test. Note that the target format needs to support per-face normals.
polygonVertUVs = [[uvLoopLayer.data[loopIndex].uv for uvLoopLayer in blendMesh.uv_layers] for loopIndex in polygon.loop_indices]
polygonVertColors = [[colorLoopLayer.data[loopIndex].color for colorLoopLayer in blendMesh.vertex_colors] for loopIndex in polygon.loop_indices]
polygonNormals = [blendMesh.loops[i].normal for i in polygon.loop_indices]