Skip to content

Instantly share code, notes, and snippets.

@CGArtPython
Created August 24, 2023 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CGArtPython/96abf841bd732ee54a6c89643df45cab to your computer and use it in GitHub Desktop.
Save CGArtPython/96abf841bd732ee54a6c89643df45cab to your computer and use it in GitHub Desktop.
Blender Python: seting custom split normals
import bpy
mesh_data = bpy.context.object.data
# Create a list with the same number of elements as the number of loops (so we can do this `new_loop_normals[loop_index]`)
new_loop_normals = [None for _ in mesh_data.loops]
for face in mesh_data.polygons:
for loop_index in face.loop_indices:
new_loop_normals[loop_index] = face.normal
mesh_data.use_auto_smooth = True
mesh_data.normals_split_custom_set(new_loop_normals)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment