[Bf-extensions-cvs] [514c08f] master: Fix T43863: Some obj have three values per UV coordinate... sigh.

Bastien Montagne noreply at git.blender.org
Mon Mar 2 19:31:12 CET 2015


Commit: 514c08f839d57c73a0f616198a8ea8327b143e09
Author: Bastien Montagne
Date:   Mon Mar 2 19:30:16 2015 +0100
Branches: master
https://developer.blender.org/rBA514c08f839d57c73a0f616198a8ea8327b143e09

Fix T43863: Some obj have three values per UV coordinate... sigh.

===================================================================

M	io_scene_obj/import_obj.py

===================================================================

diff --git a/io_scene_obj/import_obj.py b/io_scene_obj/import_obj.py
index 3a5900a..6136538 100644
--- a/io_scene_obj/import_obj.py
+++ b/io_scene_obj/import_obj.py
@@ -788,14 +788,14 @@ def load(operator, context, filepath,
         to be split into objects and then converted into mesh objects
     """
 
-    def handle_vec(line_start, context_multi_line, line_split, tag, data, vec):
+    def handle_vec(line_start, context_multi_line, line_split, tag, data, vec, vec_len):
         ret_context_multi_line = tag if strip_slash(line_split) else b''
         if line_start == tag:
             vec[:] = [float_func(v) for v in line_split[1:]]
         elif context_multi_line == tag:
             vec += [float_func(v) for v in line_split]
         if not ret_context_multi_line:
-            data.append(tuple(vec))
+            data.append(tuple(vec[:vec_len]))
         return ret_context_multi_line
 
     def create_face(context_material, context_smooth_group, context_object):
@@ -880,13 +880,13 @@ def load(operator, context, filepath,
         line_start = line_split[0]  # we compare with this a _lot_
 
         if line_start == b'v' or context_multi_line == b'v':
-            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'v', verts_loc, vec)
+            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'v', verts_loc, vec, 3)
 
         elif line_start == b'vn' or context_multi_line == b'vn':
-            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'vn', verts_nor, vec)
+            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'vn', verts_nor, vec, 3)
 
         elif line_start == b'vt' or context_multi_line == b'vt':
-            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'vt', verts_tex, vec)
+            context_multi_line = handle_vec(line_start, context_multi_line, line_split, b'vt', verts_tex, vec, 2)
 
         # Handle faces lines (as faces) and the second+ lines of fa multiline face here
         # use 'f' not 'f ' because some objs (very rare have 'fo ' for faces)



More information about the Bf-extensions-cvs mailing list