bmesh.ops.inset_region gives unexpected results I want to create an object based on the active one with inset faces and modified vertex coordinates. Inset works as expected if I don't modify verts coordinates but if I do it gives me unexpected results. Do I need to somehow &quot;recalculate&quot; bmesh after I modify verts positions?
Here's the result I'm getting:

Here's a code I run on a Plane object. As an example I make every point of the object 1 unit higher. I tried to include different variants of .ensure_lookup_table() without any luck.
import bpy
import bmesh
from mathutils import Vector

ob = bpy.context.object
bm = bmesh.new()
bm.from_mesh(ob.data)

for index, v in enumerate(bm.verts):
   v.co = v.co + Vector((0,0,index))

# insetting bmesh
inset_faces = bmesh.ops.inset_region(bm, faces = bm.faces, thickness=0.5, use_boundary=True, use_even_offset=True)

# creating mesh
mesh = bpy.data.meshes.new(&quot;mesh&quot;)
obj = bpy.data.objects.new(&quot;new_obj&quot;, mesh)
bpy.context.scene.collection.objects.link(obj)

bm.to_mesh(obj.data)
obj.data.update()
bm.free()

What am I missing?
Update the normals.
After you &quot;twist&quot; face by index translation, the normals are not recalculated unless we explicitly call normal_update either on the bmesh instance, or on a per face basis.
Update Edge Info when using script in Edit Mode
Script with that edit, also optionally changed operator to inset individual.
import bpy
import bmesh
from mathutils import Vector

ob = bpy.context.object
bm = bmesh.new()
bm.from_mesh(ob.data)

for v in bm.verts:
   v.co.z += v.index
   
# update the normals
bm.normal_update()
# or on per face
'''
for f in bm.faces:
    f.normal_update()
'''
# insetting bmesh
inset_faces = bmesh.ops.inset_individual(
        bm, 
        faces=bm.faces, 
        thickness=0.5,
        #use_interpolate=True,
        use_even_offset=True)

# creating mesh
mesh = bpy.data.meshes.new(&quot;mesh&quot;)
obj = bpy.data.objects.new(&quot;new_obj&quot;, mesh)
bpy.context.scene.collection.objects.link(obj)

bm.to_mesh(obj.data)
obj.data.update()
bm.free()