In blender 2.8 the triangulate modifier has a “Keep Normals” flag (keep_custom_normals internally). How do I get this same effect of preserving the normals when triangulating using python.
I cant use the well known mesh_triangulate() method
def mesh_triangulate(me):
import bmesh
bm = bmesh.new()
bm.from_mesh(me)
bmesh.ops.triangulate(bm, faces=bm.faces, quad_method=‘FIXED’, ngon_method=‘BEAUTY’)
bm.to_mesh(me)
bm.free()
as it destroys the artists normals.
I dont want to apply the modifier to the original object because this is for an exporter and I dont want to
triangulate the original scene objects, the export should be read only.
Ive also tried copying the original object and its mesh data, setting it as the active object, adding the triangulate modifier, setting its settings, and applying it, but unless the object is linked using
bpy.context.scene.collection.objects.link(obj), i get the error
RuntimeError: Operator bpy.ops.object.modifier_add.poll() failed, context is incorrect
which I guess means the object needs to be in the scene first, but again, I dont want to modify the scene in anyway, this should be a read only operation without intruding on the artists workspace.
Is there any way to produce the “Keep Normals” effect through python on copies of the object mesh data?