Skip to content

Commit 8a41d7a

Browse files
committed
Import normal vertex buffers to correct inaccurate lighting in blender due to bad geometry
1 parent 79a6d9d commit 8a41d7a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

io_scene_a3d/A3DBlenderImporter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,16 @@ def buildBlenderMesh(self, meshData):
157157
me.polygons[faceI+faceIndexBase].material_index = submeshI
158158
faceIndexBase += submesh.indexCount//3
159159

160-
# Finalise
160+
#XXX: call this before we assign split normals, if you do not it causes a segmentation fault
161161
me.validate()
162+
163+
# Split normals
164+
if len(normal1) != 0:
165+
me.normals_split_custom_set_from_vertices(normal1)
166+
elif len(normal2) != 0:
167+
me.normals_split_custom_set_from_vertices(normal2)
168+
169+
# Finalise
162170
me.update()
163171
return me
164172

0 commit comments

Comments
 (0)