From 7bea39af62d8e83c7e375b925b5eee2aee851f66 Mon Sep 17 00:00:00 2001 From: Arystanbek Dyussenov Date: Sat, 16 Jan 2010 15:20:27 +0000 Subject: [PATCH] Workaround to fix #20645. Iteration over multidim arrays and slicing of them is broken. Before fixing this I'd like to clean BPY a bit. --- release/scripts/io/export_fbx.py | 7 ++++--- release/scripts/io/export_obj.py | 3 ++- release/scripts/io/export_x3d.py | 4 +++- source/blender/python/intern/bpy_array.c | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index a7e126446bd..ffd7c3f3efa 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -1751,9 +1751,10 @@ def write(filename, batch_objects = None, \ ii = 0 # Count how many UVs we write for uf in uvlayer.data: -# for f in me.faces: - for uv in uf.uv: -# for uv in f.uv: +# for f in me.faces: + # workaround, since uf.uv iteration is wrong atm + for uv in [uf.uv1, uf.uv2, uf.uv3, uf.uv4][:len(uf.uv)]: +# for uv in f.uv: if i==-1: file.write('%.6f,%.6f' % tuple(uv)) i=0 diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py index 8d1a9a9aced..7c4c83c53c7 100644 --- a/release/scripts/io/export_obj.py +++ b/release/scripts/io/export_obj.py @@ -563,7 +563,8 @@ def write(filename, objects, scene, tface = uv_layer.data[f_index] - uvs = tface.uv + # workaround, since tface.uv iteration is wrong atm + uvs = [tface.uv1, tface.uv2, tface.uv3, tface.uv4][:len(tface.uv)] # uvs = [tface.uv1, tface.uv2, tface.uv3] # # add another UV if it's a quad diff --git a/release/scripts/io/export_x3d.py b/release/scripts/io/export_x3d.py index 6b94a0cc91a..c492c4a6b15 100644 --- a/release/scripts/io/export_x3d.py +++ b/release/scripts/io/export_x3d.py @@ -616,7 +616,8 @@ class x3d_class: for face in mesh.active_uv_texture.data: # for face in mesh.faces: - uvs = face.uv + # workaround, since tface.uv iteration is wrong atm + uvs = [face.uv1, face.uv2, face.uv3, face.uv4][:len(face.uv)] # uvs = [face.uv1, face.uv2, face.uv3, face.uv4] if face.verts[3] else [face.uv1, face.uv2, face.uv3] for uv in uvs: @@ -625,6 +626,7 @@ class x3d_class: texCoordList.append(uv) j=j+1 texIndexList.append(-1) + if self.writingtexture == 0: self.file.write("\n\t\t\ttexCoordIndex=\"") texIndxStr="" diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c index 5f228836b42..76c9a0f6e11 100644 --- a/source/blender/python/intern/bpy_array.c +++ b/source/blender/python/intern/bpy_array.c @@ -1,5 +1,5 @@ /** - * + * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** *