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 e8940cbc8c - Show all commits

View File

@ -2071,8 +2071,8 @@ def importMesh_IndexedFaceSet(geom, ancestry):
if colors and color_per_vertex:
cco2 = [0.0 for x in range(int(len(bpymesh.attributes["temp_custom_colors"].data)*4))]
bpymesh.attributes["temp_custom_colors"].data.foreach_get("color", cco2)
bpymesh.color_attributes.new('ColorPerCoin', 'FLOAT_COLOR', 'CORNER')
bpymesh.color_attributes["ColorPerCoin"].data.foreach_set("color", cco2)
bpymesh.color_attributes.new('ColorPerCorner', 'FLOAT_COLOR', 'CORNER')
bpymesh.color_attributes["ColorPerCorner"].data.foreach_set("color", cco2)
bpymesh.attributes.remove(bpymesh.attributes["temp_custom_colors"])
bpymesh.update()
@ -2748,7 +2748,7 @@ def appearance_CreateMaterial(vrmlname, mat, ancestry, is_vcol):
if is_vcol:
node_vertex_color = bpymat.node_tree.nodes.new("ShaderNodeVertexColor")
node_vertex_color.location = (-200, 300)
node_vertex_color.layer_name = "ColorPerCoin"
node_vertex_color.layer_name = "ColorPerCorner"
bpymat.node_tree.links.new(
bpymat_wrap.node_principled_bsdf.inputs["Base Color"],