I created custom split normals, they show up in the viewport, but how can I get a list of them in python?

import bpy

mesh = bpy.context.object.data

mesh.use_auto_smooth = True
mesh.normals_split_custom_set( [(1, 1, 0) for v in mesh.loops] )

for l in mesh.loops:

The code above just prints out (0.0,0.0,0.0) vectors, so split normals are probably stored somewhere else.


1 Answer 1

  • You need to call mesh.calc_normals_split() once before you can access the loop.normals. Otherwise they will all be zero, as you found out.
  • In addition to use_auto_smooth needing to be on, polys need to be smooth-shaded (poly.use_smooth = True) to use the custom normals.
  • Make sure the vectors you pass to split_custom_set are really normalized or you will get weird results.
  • $\begingroup$ mesh.calc_normals_split() did give me results, but they're random(probably auto-calculated by blender, as the function name implies). I want my custom normals to be printed (the (1,1,0) ones). $\endgroup$
    – Michael777
    Commented Jul 17, 2022 at 8:43
  • $\begingroup$ You can't ever get [1,1,0], it isn't unit length. Like I said, it has to be normalized. $\endgroup$
    – scurest
    Commented Jul 17, 2022 at 8:44
  • $\begingroup$ Oh, true, I'm dumb. The vector length has to be 1, not individual components. Sorry! $\endgroup$
    – Michael777
    Commented Jul 17, 2022 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .