2020-01-22 17:58:55 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "AnimCustomInstanceHelper.h"
|
2022-11-04 16:37:48 -04:00
|
|
|
#include "Animation/Skeleton.h"
|
2022-10-26 12:57:32 -04:00
|
|
|
#include "Engine/SkeletalMesh.h"
|
2020-01-22 17:58:55 -05:00
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
// FAnimCustomInstanceHelper
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool FAnimCustomInstanceHelper::ShouldCreateCustomInstancePlayer(const USkeletalMeshComponent* SkeletalMeshComponent)
|
|
|
|
|
{
|
2022-08-15 09:26:50 -04:00
|
|
|
const USkeletalMesh* SkeletalMesh = SkeletalMeshComponent->GetSkeletalMeshAsset();
|
2021-08-04 17:46:20 -04:00
|
|
|
const USkeleton* Skeleton = SkeletalMesh ? SkeletalMesh->GetSkeleton() : nullptr;
|
|
|
|
|
|
2020-01-22 17:58:55 -05:00
|
|
|
// create proper anim instance to animate
|
|
|
|
|
UAnimInstance* AnimInstance = SkeletalMeshComponent->GetAnimInstance();
|
|
|
|
|
|
|
|
|
|
return (AnimInstance == nullptr || SkeletalMeshComponent->GetAnimationMode() != EAnimationMode::AnimationBlueprint ||
|
2022-11-01 06:25:59 -04:00
|
|
|
AnimInstance->GetClass() != SkeletalMeshComponent->AnimClass || !Skeleton || !AnimInstance->CurrentSkeleton);
|
2020-01-22 17:58:55 -05:00
|
|
|
}
|