1
$\begingroup$

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)
```
$\endgroup$
4
  • $\begingroup$ AFAIK this is still the case blender.stackexchange.com/questions/49357/… 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. $\endgroup$ – batFINGER Jan 25 at 9:25
  • $\begingroup$ I tried using mesh.normals_split_custom_set(), but it doesn't seem to work in edit mode. $\endgroup$ – kitfox Jan 25 at 11:16
  • $\begingroup$ 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. $\endgroup$ – batFINGER Jan 25 at 11:23
  • $\begingroup$ I created topic on the Blender developers forum devtalk.blender.org/t/set-loop-normals/17760 $\endgroup$ – Сергей Солуянов Feb 28 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.