AltSkinWeights - Crash - Reimporting Base Mesh while previewing Skin Weight Profile causes editor to crash

#fix Clear and reset profile when reimporting skeletal mesh
#jira UE-74041
#rb Alexis.Matte

[CL 6800649 by Jurre deBaare in Dev-Anim branch]
This commit is contained in:
Jurre deBaare
2019-06-03 11:04:25 -04:00
parent 83a5b7b45c
commit 6c25554a05
@@ -883,12 +883,30 @@ UObject* FSkeletalMeshEditor::HandleGetAsset()
bool FSkeletalMeshEditor::HandleReimportMeshInternal(int32 SourceFileIndex /*= INDEX_NONE*/, bool bWithNewFile /*= false*/)
{
// Make sure we clear any skin weight profile currently being previewed
UDebugSkelMeshComponent * MeshComponent = GetPersonaToolkit()->GetPreviewScene()->GetPreviewMeshComponent();
const FName ProfileName = MeshComponent->GetCurrentSkinWeightProfileName();
if (MeshComponent)
{
MeshComponent->ClearSkinWeightProfile();
}
// Reimport the asset
const bool bResult = FReimportManager::Instance()->Reimport(SkeletalMesh, true, true, TEXT(""), nullptr, SourceFileIndex, bWithNewFile);
// Refresh skeleton tree
SkeletonTree->Refresh();
if (ProfileName != NAME_None)
{
if (MeshComponent)
{
MeshComponent->SetSkinWeightProfile(ProfileName);
}
}
return bResult;
}