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. :/
This commit is contained in:
Bastien Montagne 2014-10-04 16:20:59 +02:00
parent c210f87f12
commit 3d5cd1956e
Notes: blender-bot 2023-02-14 20:03:10 +01:00
Referenced by issue #41922, FBX exporter causes crashes in other software when smoothing groups are active.
Referenced by issue #41922, FBX exporter causes crashes in other software when smoothing groups are active.
4 changed files with 14 additions and 10 deletions

View File

@ -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(

View File

@ -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")

View File

@ -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(

View File

@ -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")