Fix per vertex normals and colors import #6

Merged
Cedric Steiert merged 10 commits from Hombre57/io_scene_x3d:per-vertex_normals_and_colors into main 2024-08-07 12:04:13 +02:00
Showing only changes of commit 0b42c37959 - Show all commits

View File

@ -1958,7 +1958,7 @@ def importMesh_IndexedFaceSet(geom, ancestry):
normal_index = index
co = [co for f in processPerVertexIndex(normal_index)
for v in f
for co in vectors[v]]
for co in mathutils.Vector(vectors[v]).normalized().to_tuple()]
bpymesh.vertices.foreach_set("normal", co)
# Mesh must be validated before assigning normals, but validation might
@ -1968,7 +1968,7 @@ def importMesh_IndexedFaceSet(geom, ancestry):
else:
co = [co for (i, f) in enumerate(faces)
for j in f
for co in vectors[normal_index[i] if normal_index else i]]
for co in mathutils.Vector(vectors[normal_index[i] if normal_index else i]).normalized().to_tuple()]
bpymesh.polygons.foreach_set("normal", co)
# Apply vertex/face colors