From f0fe54fcddf6fdcfe4709fa6513c09a216d2d466 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Dec 2015 01:11:41 +1100 Subject: Fix T47010: Blender OBJ UV's give issues with some apps Blender was sharing UV's for all vertices, while this is correct it was causing issues for Maya, 3ds Max & Unfold3D. --- io_scene_obj/export_obj.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 6a9b2920..ad506216 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -424,9 +424,8 @@ def write_file(filepath, objects, scene, if EXPORT_NORMALS and face_index_pairs: me.calc_normals_split() # No need to call me.free_normals_split later, as this mesh is deleted anyway! - loops = me.loops - else: - loops = [] + + loops = me.loops if (EXPORT_SMOOTH_GROUPS or EXPORT_SMOOTH_GROUPS_BITFLAGS) and face_index_pairs: smooth_groups, smooth_groups_tot = me.calc_smooth_groups(EXPORT_SMOOTH_GROUPS_BITFLAGS) @@ -513,7 +512,13 @@ def write_file(filepath, objects, scene, uv_ls = uv_face_mapping[f_index] = [] for uv_index, l_index in enumerate(f.loop_indices): uv = uv_layer[l_index].uv - uv_key = veckey2d(uv) + # include the vertex index in the key so we don't share UV's between vertices, + # allowed by the OBJ spec but can cause issues for other importers, see: T47010. + + # this works too, shared UV's for all verts + #~ uv_key = veckey2d(uv) + uv_key = loops[l_index].vertex_index, veckey2d(uv) + uv_val = uv_get(uv_key) if uv_val is None: uv_val = uv_dict[uv_key] = uv_unique_count -- cgit v1.2.3