Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-08-02 21:15:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-02 21:15:56 +0400
commit0918250e2f55f45525ea0a35cd0c21e9c23d74a1 (patch)
tree92c77b5267eb2f36be29c3dda1364c9181da67e5 /io_scene_3ds
parentcc104d3a1d99088bf0dfecee89a399ab6035df7f (diff)
fix [#28150] .3ds format export
Diffstat (limited to 'io_scene_3ds')
-rw-r--r--io_scene_3ds/export_3ds.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
index 6c59aabc..c39bd0db 100644
--- a/io_scene_3ds/export_3ds.py
+++ b/io_scene_3ds/export_3ds.py
@@ -699,7 +699,15 @@ def make_uv_chunk(uv_array):
return uv_chunk
-def make_mesh_chunk(mesh, materialDict):
+def make_matrix_4x3_chunk(matrix):
+ matrix_chunk = _3ds_chunk(OBJECT_TRANS_MATRIX)
+ for vec in matrix:
+ for f in vec[:3]:
+ matrix_chunk.add_variable("matrix_f", _3ds_float(f))
+ return matrix_chunk
+
+
+def make_mesh_chunk(mesh, matrix, materialDict):
'''Make a chunk out of a Blender mesh.'''
# Extract the triangles from the mesh:
@@ -739,8 +747,11 @@ def make_mesh_chunk(mesh, materialDict):
if uv_array:
mesh_chunk.add_subchunk(make_uv_chunk(uv_array))
+ mesh_chunk.add_subchunk(make_matrix_4x3_chunk(matrix))
+
return mesh_chunk
+
""" # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
def make_kfdata(start=0, stop=0, curtime=0):
'''Make the basic keyframe data chunk'''
@@ -928,7 +939,7 @@ def save(operator,
continue
for ob_derived, mat in derived:
- if ob.type not in ('MESH', 'CURVE', 'SURFACE', 'FONT', 'META'):
+ if ob.type not in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META'}:
continue
try:
@@ -937,9 +948,9 @@ def save(operator,
data = None
if data:
- data.transform(global_matrix * mat)
-# data.transform(mat, recalc_normals=False)
- mesh_objects.append((ob_derived, data))
+ matrix = global_matrix * mat
+ data.transform(matrix)
+ mesh_objects.append((ob_derived, data, matrix))
mat_ls = data.materials
mat_ls_len = len(mat_ls)
@@ -993,7 +1004,7 @@ def save(operator,
# Create object chunks for all meshes:
i = 0
- for ob, blender_mesh in mesh_objects:
+ for ob, blender_mesh, matrix in mesh_objects:
# create a new object chunk
object_chunk = _3ds_chunk(OBJECT)
@@ -1001,7 +1012,7 @@ def save(operator,
object_chunk.add_variable("name", _3ds_string(sane_name(ob.name)))
# make a mesh chunk out of the mesh:
- object_chunk.add_subchunk(make_mesh_chunk(blender_mesh, materialDict))
+ object_chunk.add_subchunk(make_mesh_chunk(blender_mesh, matrix, materialDict))
object_info.add_subchunk(object_chunk)
''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX