handle Face Corner color attributes

fixes 
This commit is contained in:
PrismaticFlower 2023-12-05 09:49:59 +13:00
parent 48c05380c6
commit daacdf1a5d
2 changed files with 11 additions and 9 deletions
addons/io_scene_swbf_msh

View File

@ -1,8 +1,8 @@
bl_info = {
'name': 'SWBF .msh Import-Export',
'author': 'Will Snyder, PrismaticFlower',
"version": (1, 3, 2),
'blender': (2, 80, 0),
"version": (1, 3, 3),
'blender': (3, 0, 0),
'location': 'File > Import-Export',
'description': 'Export as SWBF .msh file',
'warning': '',

View File

@ -215,10 +215,11 @@ def create_mesh_geometry(mesh: bpy.types.Mesh, valid_vgroup_indices: Set[int]) -
yield mesh.uv_layers.active.data[loop_index].uv.y
if segment.colors is not None:
data_type = mesh.color_attributes.active_color.data_type
if data_type == "FLOAT_COLOR" or data_type == "BYTE_COLOR":
for v in mesh.color_attributes.active_color.data[vertex_index].color:
yield v
active_color = mesh.color_attributes.active_color
data_index = loop_index if active_color.domain == "CORNER" else vertex_index
for v in mesh.color_attributes.active_color.data[data_index].color:
yield v
if segment.weights is not None:
for v in mesh.vertices[vertex_index].groups:
@ -247,9 +248,10 @@ def create_mesh_geometry(mesh: bpy.types.Mesh, valid_vgroup_indices: Set[int]) -
segment.texcoords.append(mesh.uv_layers.active.data[loop_index].uv.copy())
if segment.colors is not None:
data_type = mesh.color_attributes.active_color.data_type
if data_type == "FLOAT_COLOR" or data_type == "BYTE_COLOR":
segment.colors.append(list(mesh.color_attributes.active_color.data[vertex_index].color))
active_color = mesh.color_attributes.active_color
data_index = loop_index if active_color.domain == "CORNER" else vertex_index
segment.colors.append(list(active_color.data[data_index].color))
if segment.weights is not None:
groups = mesh.vertices[vertex_index].groups