1

I'm trying to set face normals using a bmesh. I'm running this in response to a mouse click in an operator.

In the below code, I'm able to run through my loops and set the vertex normals. While this does update the vertex normals, it does nothing to affect the loop normals which are the ones that affect how the mesh is rendered (a loop is a vertex-face tuple which allows the same vertex to have different properties for each adjacent face). The BMLoop object does not appear to have a normal property. How do I set the normals of my mesh?

        me = context.edit_object.data
        me.use_auto_smooth = True
    self.bm = bmesh.from_edit_mesh(me)

    for face in self.bm.faces:
        for loop in face.loops:
            loop.vert.normal = brush_normal

    me = context.edit_object.data
    bmesh.update_edit_mesh(me, False, False)

```

kitfox
  • 1,616
  • 5
  • 26
  • 40
  • AFAIK this is still the case https://blender.stackexchange.com/questions/49357/bmesh-how-can-i-import-custom-vertex-normals/52002#comment89162_52002 In as much as it is the vertex referenced from a different loop, it is still the same vertex. Link above shows setting via loop using the mesh, but not via a bmesh. – batFINGER Jan 25 '21 at 09:25
  • I tried using mesh.normals_split_custom_set(), but it doesn't seem to work in edit mode. – kitfox Jan 25 '21 at 11:16
  • Yep that's the way it is. The edit mesh is a "copy" that is written to on entering mode and written back when exiting. – batFINGER Jan 25 '21 at 11:23
  • I created topic on the Blender developers forum https://devtalk.blender.org/t/set-loop-normals/17760 – Сергей Солуянов Feb 28 '21 at 06:17

0 Answers0