|
|
|
@@ -197,8 +197,8 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
|
|
|
|
|
bRight = true;
|
|
|
|
|
bHiddenInGameIfNoGloveDetected = true;
|
|
|
|
|
|
|
|
|
|
const FString SkeletalMeshPath(Pimpl->GetDefaultMeshPath());
|
|
|
|
|
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMesh(*SkeletalMeshPath);
|
|
|
|
|
const FString SkeletalMeshPath{Pimpl->GetDefaultMeshPath()};
|
|
|
|
|
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMesh{*SkeletalMeshPath};
|
|
|
|
|
ensureAlwaysMsgf(SkeletalMesh.Succeeded() && SkeletalMesh.Object,
|
|
|
|
|
TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath);
|
|
|
|
|
Super::SetSkeletalMesh(SkeletalMesh.Object, true);
|
|
|
|
@@ -229,9 +229,11 @@ void USGVirtualHandComponent::PostEditChangeProperty(FPropertyChangedEvent& Prop
|
|
|
|
|
{
|
|
|
|
|
Super::PostEditChangeProperty(PropertyChangedEvent);
|
|
|
|
|
|
|
|
|
|
const FName PropertyName{PropertyChangedEvent.Property
|
|
|
|
|
const FName PropertyName{
|
|
|
|
|
PropertyChangedEvent.Property
|
|
|
|
|
? PropertyChangedEvent.Property->GetFName()
|
|
|
|
|
: NAME_None};
|
|
|
|
|
: NAME_None
|
|
|
|
|
};
|
|
|
|
|
if (PropertyName == GET_MEMBER_NAME_CHECKED(USGVirtualHandComponent, bRight))
|
|
|
|
|
{
|
|
|
|
|
if (!Pimpl->IsUsingUserMesh())
|
|
|
|
@@ -294,7 +296,7 @@ bool USGVirtualHandComponent::IsGloveConnected() const
|
|
|
|
|
|
|
|
|
|
USGHandPose* USGVirtualHandComponent::GetHandPose()
|
|
|
|
|
{
|
|
|
|
|
USGHandPose* HandPose = nullptr;
|
|
|
|
|
USGHandPose* HandPose{nullptr};
|
|
|
|
|
|
|
|
|
|
if (IsValid(Glove))
|
|
|
|
|
{
|
|
|
|
@@ -306,9 +308,11 @@ USGHandPose* USGVirtualHandComponent::GetHandPose()
|
|
|
|
|
|
|
|
|
|
const FName& USGVirtualHandComponent::GetFingerBoneName(const int32 Finger, const int32 Joint) const
|
|
|
|
|
{
|
|
|
|
|
const FName& Name{IsRight()
|
|
|
|
|
const FName& Name{
|
|
|
|
|
IsRight()
|
|
|
|
|
? GetRightHandFingerBoneName(Finger, Joint)
|
|
|
|
|
: GetLeftHandFingerBoneName(Finger, Joint)};
|
|
|
|
|
: GetLeftHandFingerBoneName(Finger, Joint)
|
|
|
|
|
};
|
|
|
|
|
return Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -384,7 +388,7 @@ USGVirtualHandComponent::FImpl::~FImpl() = default;
|
|
|
|
|
|
|
|
|
|
bool USGVirtualHandComponent::FImpl::IsEditor() const
|
|
|
|
|
{
|
|
|
|
|
const UWorld* World = Owner->GetWorld();
|
|
|
|
|
const UWorld* World{Owner->GetWorld()};
|
|
|
|
|
if (World && World->WorldType == EWorldType::Editor)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
@@ -435,9 +439,10 @@ bool USGVirtualHandComponent::FImpl::IsUsingUserMesh() const
|
|
|
|
|
|
|
|
|
|
USkeletalMesh* USGVirtualHandComponent::FImpl::LoadDefaultMesh() const
|
|
|
|
|
{
|
|
|
|
|
const FString SkeletalMeshPath(GetDefaultMeshPath());
|
|
|
|
|
USkeletalMesh* SkeletalMesh = Cast<USkeletalMesh>(
|
|
|
|
|
StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath));
|
|
|
|
|
const FString SkeletalMeshPath{GetDefaultMeshPath()};
|
|
|
|
|
USkeletalMesh* SkeletalMesh{
|
|
|
|
|
Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *SkeletalMeshPath))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ensureAlwaysMsgf(SkeletalMesh, TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath);
|
|
|
|
|
|
|
|
|
@@ -454,7 +459,7 @@ USkeletalMesh* USGVirtualHandComponent::FImpl::GetMesh() const
|
|
|
|
|
return Owner->
|
|
|
|
|
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
|
|
|
|
|
GetSkeletalMeshAsset()
|
|
|
|
|
#else
|
|
|
|
|
#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
SkeletalMesh
|
|
|
|
|
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
;
|
|
|
|
@@ -468,7 +473,7 @@ USkeleton* USGVirtualHandComponent::FImpl::GetSkeleton() const
|
|
|
|
|
return SkeletalMesh->
|
|
|
|
|
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
|
|
|
|
|
GetSkeleton()
|
|
|
|
|
#else
|
|
|
|
|
#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
Skeleton
|
|
|
|
|
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
;
|
|
|
|
@@ -482,7 +487,7 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const
|
|
|
|
|
return SkeletalMesh->
|
|
|
|
|
#if ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1
|
|
|
|
|
GetRefSkeleton()
|
|
|
|
|
#else
|
|
|
|
|
#else /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
RefSkeleton
|
|
|
|
|
#endif /* ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 1 */
|
|
|
|
|
;
|
|
|
|
|