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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-03-12 12:21:45 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-03-12 12:21:45 +0300
commitc840ce418476ace6d86fcf7751f309c026ff49d2 (patch)
tree97c4295d0b76f080e83b782cfdd95d14c25e20a7
parent3fc5b82c6bdba2f9c954fbf497621b9bb794a1bc (diff)
Fix T43929: Exporting a mesh with shape keys as FBX with smoothing, creates invalid file.
Stupid libfbx crashes when there is no normals in 'main' mesh data, and some shape keys linked to that mesh. Now, issue is, I removed always writing normals because iirc this was giving bugs with some importers... Re-enabled it for now, let's hope everything works OK. *do not backport this* to 2.74!
-rw-r--r--io_scene_fbx/__init__.py6
-rw-r--r--io_scene_fbx/export_fbx_bin.py7
2 files changed, 8 insertions, 5 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 6b6f39e4..eb729fe0 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -263,12 +263,12 @@ class ExportFBX(bpy.types.Operator, ExportHelper, OrientationHelper):
)
mesh_smooth_type = EnumProperty(
name="Smoothing",
- items=(('OFF', "Normals", "Export normals instead of writing edge or face smoothing data"),
+ items=(('OFF', "Normals Only", "Export only normals instead of writing edge or face smoothing data"),
('FACE', "Face", "Write face smoothing"),
('EDGE', "Edge", "Write edge smoothing"),
),
description="Export smoothing information "
- "(prefer 'Off' option if your target importer understand split normals)",
+ "(prefer 'Normals Only' option if your target importer understand split normals)",
default='OFF',
)
use_mesh_edges = BoolProperty(
@@ -425,7 +425,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper, OrientationHelper):
layout.prop(self, "mesh_smooth_type")
layout.prop(self, "use_mesh_edges")
sub = layout.row()
- sub.enabled = self.mesh_smooth_type in {'OFF'}
+ #~ sub.enabled = self.mesh_smooth_type in {'OFF'}
sub.prop(self, "use_tspace")
layout.prop(self, "use_armature_deform_only")
if is_74bin:
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 8686bbc0..d17d7145 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -738,6 +738,8 @@ def fbx_data_mesh_shapes_elements(root, me_obj, me, scene_data, fbx_me_tmpl, fbx
if me not in scene_data.data_deformers_shape:
return
+ write_normals = True # scene_data.settings.mesh_smooth_type in {'OFF'}
+
# First, write the geometry data itself (i.e. shapes).
_me_key, shape_key, shapes = scene_data.data_deformers_shape[me]
@@ -768,7 +770,8 @@ def fbx_data_mesh_shapes_elements(root, me_obj, me, scene_data, fbx_me_tmpl, fbx
elem_data_single_int32_array(geom, b"Indexes", shape_verts_idx)
elem_data_single_float64_array(geom, b"Vertices", shape_verts_co)
- elem_data_single_float64_array(geom, b"Normals", [0.0] * len(shape_verts_co))
+ if write_normals:
+ elem_data_single_float64_array(geom, b"Normals", [0.0] * len(shape_verts_co))
# Yiha! BindPose for shapekeys too! Dodecasigh...
# XXX Not sure yet whether several bindposes on same mesh are allowed, or not... :/
@@ -813,7 +816,7 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
# No gscale/gmat here, all data are supposed to be in object space.
smooth_type = scene_data.settings.mesh_smooth_type
- write_normals = smooth_type in {'OFF'}
+ write_normals = True # smooth_type in {'OFF'}
do_bake_space_transform = me_obj.use_bake_space_transform(scene_data)