FBX IO: Fix error importing BlendShapeChannels with extraneous FullWeights #104956

Merged
Thomas Barlow merged 6 commits from Mysteryem/blender-addons:fbx_fix_extra_fullweights_error into main 2023-11-05 10:16:56 +01:00
Showing only changes of commit 33e1373492 - Show all commits

View File

@ -3547,8 +3547,8 @@ def load(operator, context, filepath="",
# shape -> blendshapechannel -> blendshape -> mesh. # shape -> blendshapechannel -> blendshape -> mesh.
for bc_uuid, fbx_bcdata, _bl_bcdata in connections_gen(s_uuid, b'Deformer', b'BlendShapeChannel'): for bc_uuid, fbx_bcdata, _bl_bcdata in connections_gen(s_uuid, b'Deformer', b'BlendShapeChannel'):
# Track the Shapes connected to each BlendShapeChannel. # Track the Shapes connected to each BlendShapeChannel.
shapes_assigned_to_channel = blend_shape_channel_to_shapes.setdefault(bc_uuid, set()) shapes_assigned_to_channel = blend_shape_channel_to_shapes.setdefault(bc_uuid, [])
shapes_assigned_to_channel.add(s_uuid) shapes_assigned_to_channel.append(s_uuid)
for bs_uuid, _fbx_bsdata, _bl_bsdata in connections_gen(bc_uuid, b'Deformer', b'BlendShape'): for bs_uuid, _fbx_bsdata, _bl_bsdata in connections_gen(bc_uuid, b'Deformer', b'BlendShape'):
for m_uuid, _fbx_mdata, bl_mdata in connections_gen(bs_uuid, b'Geometry', b'Mesh'): for m_uuid, _fbx_mdata, bl_mdata in connections_gen(bs_uuid, b'Geometry', b'Mesh'):
# Blenmeshes are assumed already created at that time! # Blenmeshes are assumed already created at that time!
@ -3570,7 +3570,7 @@ def load(operator, context, filepath="",
shapes_list = mesh_to_shapes[bl_mdata][1] shapes_list = mesh_to_shapes[bl_mdata][1]
# Only the number of shapes assigned to each BlendShapeChannel needs to be passed through to # Only the number of shapes assigned to each BlendShapeChannel needs to be passed through to
# `blen_read_shapes`, but that number isn't known until all the connections have been # `blen_read_shapes`, but that number isn't known until all the connections have been
# iterated, so pass the `shapes_assigned_to_channel` set instead. # iterated, so pass the `shapes_assigned_to_channel` list instead.
shapes_list.append((bc_uuid, fbx_sdata, fbx_bcdata, shapes_assigned_to_channel)) shapes_list.append((bc_uuid, fbx_sdata, fbx_bcdata, shapes_assigned_to_channel))
# BlendShape deformers are only here to connect BlendShapeChannels to meshes, nothing else to do. # BlendShape deformers are only here to connect BlendShapeChannels to meshes, nothing else to do.