Skip to content

Commit

Permalink
next attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarcontar committed Jan 27, 2024
1 parent 1d8c3f8 commit ee93475
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions io_mesh_w3d/common/utils/mesh_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi
triangle.distance = tri_pos.length
mesh_struct.triangles.append(triangle)

face_maps = mesh.face_maps
if bpy.app.version < (4, 0, 0):
face_maps = mesh_object.face_maps
else:
face_maps = mesh.face_maps

if context.file_format == 'W3X' and len(face_maps) > 0:
context.warning('triangle surface types (mesh face maps) are not supported in W3X file format!')
Expand All @@ -192,11 +195,11 @@ def retrieve_meshes(context, hierarchy, rig, container_name, force_vertex_materi
Triangle.validate_face_map_names(context, face_map_names)

if bpy.app.version < (4, 0, 0):
for map in face_maps:
for map in mesh.face_maps:
for i, val in enumerate(map.data):
mesh_struct.triangles[i].set_surface_type(face_map_names[val.value])
else:
for map in face_maps:
for map in mesh.face_maps:
for val in map.value:
if val.value < len(mesh_struct.triangles):
mesh_struct.triangles[val.value].set_surface_type(map.name)
Expand Down

0 comments on commit ee93475

Please sign in to comment.