Skip to content
Snippets Groups Projects
Commit f0fe54fc authored by Campbell Barton's avatar Campbell Barton
Browse files

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.
parent 48533557
No related branches found
No related tags found
No related merge requests found
...@@ -424,9 +424,8 @@ def write_file(filepath, objects, scene, ...@@ -424,9 +424,8 @@ def write_file(filepath, objects, scene,
if EXPORT_NORMALS and face_index_pairs: if EXPORT_NORMALS and face_index_pairs:
me.calc_normals_split() me.calc_normals_split()
# No need to call me.free_normals_split later, as this mesh is deleted anyway! # No need to call me.free_normals_split later, as this mesh is deleted anyway!
loops = me.loops
else: loops = me.loops
loops = []
if (EXPORT_SMOOTH_GROUPS or EXPORT_SMOOTH_GROUPS_BITFLAGS) and face_index_pairs: 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) smooth_groups, smooth_groups_tot = me.calc_smooth_groups(EXPORT_SMOOTH_GROUPS_BITFLAGS)
...@@ -513,7 +512,13 @@ def write_file(filepath, objects, scene, ...@@ -513,7 +512,13 @@ def write_file(filepath, objects, scene,
uv_ls = uv_face_mapping[f_index] = [] uv_ls = uv_face_mapping[f_index] = []
for uv_index, l_index in enumerate(f.loop_indices): for uv_index, l_index in enumerate(f.loop_indices):
uv = uv_layer[l_index].uv 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) uv_val = uv_get(uv_key)
if uv_val is None: if uv_val is None:
uv_val = uv_dict[uv_key] = uv_unique_count uv_val = uv_dict[uv_key] = uv_unique_count
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment