Fix #104714: Missing shape keys in FBX export when original mesh data cannot be used #104890

Merged
Thomas Barlow merged 7 commits from Mysteryem/blender-addons:fbx_fix_triangulate_removing_shapes into main 2023-09-19 02:26:19 +02:00
Showing only changes of commit 531e7be110 - Show all commits

View File

@ -2551,6 +2551,7 @@ def fbx_data_from_scene(scene, depsgraph, settings):
if settings.use_mesh_modifiers or settings.use_triangles or ob.type in BLENDER_OTHER_OBJECT_TYPES or is_ob_material: if settings.use_mesh_modifiers or settings.use_triangles or ob.type in BLENDER_OTHER_OBJECT_TYPES or is_ob_material:
# We cannot use default mesh in that case, or material would not be the right ones... # We cannot use default mesh in that case, or material would not be the right ones...
use_org_data = not (is_ob_material or ob.type in BLENDER_OTHER_OBJECT_TYPES) use_org_data = not (is_ob_material or ob.type in BLENDER_OTHER_OBJECT_TYPES)
apply_modifiers = False
backup_pose_positions = [] backup_pose_positions = []
tmp_mods = [] tmp_mods = []
if use_org_data and ob.type == 'MESH': if use_org_data and ob.type == 'MESH':
@ -2581,9 +2582,11 @@ def fbx_data_from_scene(scene, depsgraph, settings):
if settings.use_subsurf and mod.type == 'SUBSURF' and mod.subdivision_type == 'CATMULL_CLARK': if settings.use_subsurf and mod.type == 'SUBSURF' and mod.subdivision_type == 'CATMULL_CLARK':
if last_subsurf: if last_subsurf:
use_org_data = False use_org_data = False
apply_modifiers = True
last_subsurf = mod last_subsurf = mod
else: else:
use_org_data = False use_org_data = False
apply_modifiers = True
if settings.use_subsurf and last_subsurf: if settings.use_subsurf and last_subsurf:
# XXX: When exporting with subsurf information temporarily disable # XXX: When exporting with subsurf information temporarily disable
# the last subsurf modifier. # the last subsurf modifier.
@ -2594,7 +2597,7 @@ def fbx_data_from_scene(scene, depsgraph, settings):
# If modifiers has been altered need to update dependency graph. # If modifiers has been altered need to update dependency graph.
if backup_pose_positions or tmp_mods: if backup_pose_positions or tmp_mods:
depsgraph.update() depsgraph.update()
if settings.use_mesh_modifiers or ob.type in BLENDER_OTHER_OBJECT_TYPES: if apply_modifiers or ob.type in BLENDER_OTHER_OBJECT_TYPES:
ob_to_convert = ob.evaluated_get(depsgraph) ob_to_convert = ob.evaluated_get(depsgraph)
# NOTE: The dependency graph might be re-evaluating multiple times, which could # NOTE: The dependency graph might be re-evaluating multiple times, which could
# potentially free the mesh created early on. So we put those meshes to bmain and # potentially free the mesh created early on. So we put those meshes to bmain and