Reimporting a static mesh (FBX) which has "SOCKET_"s causes duplicate sockets of the same name to appear

Repro

  1. In Max/Maya create a static mesh
    with a dummy socket
    FBX Static Mesh Pipeline | Unreal Engine Documentation
  2. Open Unreal Editor and Import your FBX
    (drag drop into content browser)
  3. Open the Static Mesh Observe it has
    a socket
  4. From the Static Mesh menubar select
    Mesh->Reimport
  5. Observe it has multiple sockets of
    the same name
  6. Additional note: if you try to manually create a socket with the same name it’s not permitted, so this could have further knock on effects.

Our workaround is a little complicated than most as we have custom socket classes to contend with, so we have to ensure a new socket gets created of the correct type (incase the old one is outdated).

In StaticMeshEdit’s RestoreExistingMeshData before calling NewMesh->Sockets.Add(…)
Loop through all the NewMesh sockets’ for a match, if found: CopyPropertiesForUnrelatedObjects from existing to new (but preserve new’s transformation information) and then skip the Add call.

Andrew