[Bf-extensions-cvs] [3d5cd19] master: Fix T41922: FBX exporter causes crashes in other software when smoothing groups are active.

Bastien Montagne noreply at git.blender.org
Sat Oct 4 16:23:29 CEST 2014


Commit: 3d5cd1956ef4cc323037d103ca74d10a97ebef78
Author: Bastien Montagne
Date:   Sat Oct 4 16:20:59 2014 +0200
Branches: master
https://developer.blender.org/rBA3d5cd1956ef4cc323037d103ca74d10a97ebef78

Fix T41922: FBX exporter causes crashes in other software when smoothing groups are active.

Do not say we have a normal layer when we do not!

Also, warn users about the fact that applying modifiers implies loosing all shape keys.
That later point may be addressed ultimately, but not easily. :/

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx_experimental/__init__.py
M	io_scene_fbx_experimental/export_fbx_bin.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 69c2a5f..eff4e13 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -241,7 +241,8 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
 
     use_mesh_modifiers = BoolProperty(
             name="Apply Modifiers",
-            description="Apply modifiers to mesh objects (except Armature ones!)",
+            description="Apply modifiers to mesh objects (except Armature ones) - "
+                        "WARNING: prevents exporting shape keys",
             default=True,
             )
     mesh_smooth_type = EnumProperty(
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 4f50fa0..ff223fa 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -946,7 +946,7 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
 
     # Loop normals.
     tspacenumber = 0
-    if (write_normals):
+    if write_normals:
         # NOTE: this is not supported by importer currently.
         # XXX Official docs says normals should use IndexToDirect,
         #     but this does not seem well supported by apps currently...
@@ -1116,9 +1116,10 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
 
     layer = elem_data_single_int32(geom, b"Layer", 0)
     elem_data_single_int32(layer, b"Version", FBX_GEOMETRY_LAYER_VERSION)
-    lay_nor = elem_empty(layer, b"LayerElement")
-    elem_data_single_string(lay_nor, b"Type", b"LayerElementNormal")
-    elem_data_single_int32(lay_nor, b"TypedIndex", 0)
+    if write_normals:
+        lay_nor = elem_empty(layer, b"LayerElement")
+        elem_data_single_string(lay_nor, b"Type", b"LayerElementNormal")
+        elem_data_single_int32(lay_nor, b"TypedIndex", 0)
     if tspacenumber:
         lay_binor = elem_empty(layer, b"LayerElement")
         elem_data_single_string(lay_binor, b"Type", b"LayerElementBinormal")
diff --git a/io_scene_fbx_experimental/__init__.py b/io_scene_fbx_experimental/__init__.py
index db46e8e..f3bcb59 100644
--- a/io_scene_fbx_experimental/__init__.py
+++ b/io_scene_fbx_experimental/__init__.py
@@ -285,7 +285,8 @@ class ExportFBX_experimental(bpy.types.Operator, ExportHelper):
 
     use_mesh_modifiers = BoolProperty(
             name="Apply Modifiers",
-            description="Apply modifiers to mesh objects (except Armature ones!)",
+            description="Apply modifiers to mesh objects (except Armature ones) - "
+                        "WARNING: prevents exporting shape keys",
             default=True,
             )
     mesh_smooth_type = EnumProperty(
diff --git a/io_scene_fbx_experimental/export_fbx_bin.py b/io_scene_fbx_experimental/export_fbx_bin.py
index 5e59fab..d7bb1dd 100644
--- a/io_scene_fbx_experimental/export_fbx_bin.py
+++ b/io_scene_fbx_experimental/export_fbx_bin.py
@@ -946,7 +946,7 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
 
     # Loop normals.
     tspacenumber = 0
-    if (write_normals):
+    if write_normals:
         # NOTE: this is not supported by importer currently.
         # XXX Official docs says normals should use IndexToDirect,
         #     but this does not seem well supported by apps currently...
@@ -1116,9 +1116,10 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
 
     layer = elem_data_single_int32(geom, b"Layer", 0)
     elem_data_single_int32(layer, b"Version", FBX_GEOMETRY_LAYER_VERSION)
-    lay_nor = elem_empty(layer, b"LayerElement")
-    elem_data_single_string(lay_nor, b"Type", b"LayerElementNormal")
-    elem_data_single_int32(lay_nor, b"TypedIndex", 0)
+    if write_normals:
+        lay_nor = elem_empty(layer, b"LayerElement")
+        elem_data_single_string(lay_nor, b"Type", b"LayerElementNormal")
+        elem_data_single_int32(lay_nor, b"TypedIndex", 0)
     if tspacenumber:
         lay_binor = elem_empty(layer, b"LayerElement")
         elem_data_single_string(lay_binor, b"Type", b"LayerElementBinormal")



More information about the Bf-extensions-cvs mailing list