diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-21 17:11:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-21 17:11:41 +0300 |
commit | f0fe54fcddf6fdcfe4709fa6513c09a216d2d466 (patch) | |
tree | e755f8d5f506b79a3930b21722d947a69e63a184 /io_scene_obj | |
parent | 485335576104d98a5e19c337d62578277672715f (diff) |
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.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/export_obj.py | 13 |
1 files 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 |