alternative approach to constructor helpers in order to set the default hand mesh as it won't causes annoying ue pop-up cdo messages
This commit is contained in:
@@ -206,11 +206,7 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec
|
|||||||
bRight = true;
|
bRight = true;
|
||||||
bHiddenInGameIfNoGloveDetected = false;
|
bHiddenInGameIfNoGloveDetected = false;
|
||||||
|
|
||||||
const FString SkeletalMeshPath{Pimpl->GetDefaultMeshPath()};
|
Super::SetSkeletalMesh(nullptr, true);
|
||||||
const ConstructorHelpers::FObjectFinder<USkeletalMesh> SkeletalMeshFinder{*SkeletalMeshPath};
|
|
||||||
ensureAlwaysMsgf(SkeletalMeshFinder.Succeeded() && SkeletalMeshFinder.Object,
|
|
||||||
TEXT("Failed to load the skeletal mesh: '%s'"), *SkeletalMeshPath);
|
|
||||||
Super::SetSkeletalMesh(SkeletalMeshFinder.Object, true);
|
|
||||||
|
|
||||||
bBackendInitialized = false;
|
bBackendInitialized = false;
|
||||||
Glove = nullptr;
|
Glove = nullptr;
|
||||||
@@ -234,6 +230,16 @@ void USGVirtualHandComponent::SetAnimClass(UClass* NewClass)
|
|||||||
Super::SetAnimClass(NewClass);
|
Super::SetAnimClass(NewClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void USGVirtualHandComponent::PostInitProperties()
|
||||||
|
{
|
||||||
|
Super::PostInitProperties();
|
||||||
|
|
||||||
|
if (!Pimpl->IsUsingUserMesh())
|
||||||
|
{
|
||||||
|
Pimpl->SetDefaultMesh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
void USGVirtualHandComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
void USGVirtualHandComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
|
||||||
{
|
{
|
||||||
@@ -488,7 +494,10 @@ USkeletalMesh* USGVirtualHandComponent::FImpl::LoadDefaultMesh() const
|
|||||||
Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *DefaultMeshPath))
|
Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), nullptr, *DefaultMeshPath))
|
||||||
};
|
};
|
||||||
|
|
||||||
ensureAlwaysMsgf(DefaultMesh, TEXT("Failed to load the skeletal mesh: '%s'"), *DefaultMeshPath);
|
if (!IsValid(DefaultMesh))
|
||||||
|
{
|
||||||
|
SGLOG_WARNING(FString::Printf(TEXT("Failed to load the default skeletal mesh: '%s'"), *DefaultMeshPath));
|
||||||
|
}
|
||||||
|
|
||||||
return DefaultMesh;
|
return DefaultMesh;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
virtual void SetAnimClass(class UClass* NewClass) override;
|
virtual void SetAnimClass(class UClass* NewClass) override;
|
||||||
|
|
||||||
|
virtual void PostInitProperties() override;
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
|
||||||
#endif /* WITH_EDITOR */
|
#endif /* WITH_EDITOR */
|
||||||
|
|||||||
Reference in New Issue
Block a user