When you import a file with one mesh (Blender or 3ds Max) which not located at root FBX node RecursiveImportNode function add them twice:
if (Node->GetMesh())
{
NewObject = ImportANode(VoidFbxImporter, Node, InParent, InName, Flags, NodeIndex, Total); //<- 1. Importing mesh, in child
if ( NewObject )
{
OutNewAssets.Add(NewObject); //<- 2. Import succesful, let's add them to asset list!
}
}
for (int32 ChildIndex=0; ChildIndex<Node->GetChildCount(); ++ChildIndex)
{
UObject* SubObject = RecursiveImportNode(VoidFbxImporter,Node->GetChild(ChildIndex),InParent,InName,Flags,NodeIndex,Total,OutNewAssets); //<- 4. Now we here, from child node. And we got child pointer.
if ( SubObject ) //<- 5. And if it's valid (spoiler: it's valid)
{
OutNewAssets.Add(SubObject); //<- 6. We add same mesh pointer AGAIN!
}
if (NewObject==NULL)
{
NewObject = SubObject;
}
}
}
return NewObject; //<- 3. We done, return to top RecursiveImportNode function. Keep in mind: we return same object that we already added to OutNewAssets
It’s a problem, because if mesh contains socket dummies, they will be always ignored by this code:
TArray<UObject*> AllNewAssets;
UObject* Object = RecursiveImportNode(FbxImporter,RootNodeToImport,InParent,Name,Flags,NodeIndex,InterestingNodeCount, AllNewAssets); //<- 1. Import all nodes from FBX file, populate AllNewAssets.
NewStaticMesh = Cast<UStaticMesh>( Object );
// Make sure to notify the asset registry of all assets created other than the one returned, which will notify the asset registry automatically.
for ( auto AssetIt = AllNewAssets.CreateConstIterator(); AssetIt; ++AssetIt )
{
UObject* Asset = *AssetIt;
if ( Asset != NewStaticMesh )
{
FAssetRegistryModule::AssetCreated(Asset);
Asset->MarkPackageDirty();
}
}
ImportedMeshCount = AllNewAssets.Num(); //<- 2. Get all asset count, that never be equal one.
}
// Importing static mesh sockets only works if one mesh is being imported
if( ImportedMeshCount == 1 && NewStaticMesh ) //<- 3. This condition will never be executed
{
FbxImporter->ImportStaticMeshSockets( NewStaticMesh );
}