Hello,
I tried to get access to the SkeletalMesh during the constructor of a UPoseableMeshComponent (3rd Person Project with Starter Content).
To drag and drop different instances of an Actor with that Component inside the World, I created a blueprint called BP_CustomActor from the C+±Class MyPoseableMeshComponent (for source see below) and set the parent of that BP to AActor (see [Picture01][1]).
Then I tried to drag and drop the SkeletalMesh from the Content folder to the SkeletalMesh of the MyPoseableMeshComponent (indicated by the pink arrow in [Picture02][3]).
Immediately UE called the Constructor of it:
LogSkeletalMesh: Warning:
LogSkeletalMesh: Warning: Inside of
UMyPoseableMeshComponent-Constructor!
LogSkeletalMesh: Warning: Number of
bones: 0LogSkeletalMesh: Warning:
m_pSkeletalMesh NOT set …LogSkeletalMesh: Warning: END OF
UMyPoseableMeshComponent
CONSTRUCTOR!!!
It is saying that the SkeletalMesh which is accessible through USkinnedMeshComponent is not being set, although I assigned it through UE-Editor.
What am I doing wrong here?
Although I assigned the SkeletalMesh the membervariables m_pSkeletalMesh and m_pSkeleton aren’t set either during construction. Shouldn’t they get updated to the SkeletalMesh you set in the UE-Editor?
For additional information on the MyPoseableMeshComponent:
:::::::::::::::::: MyPoseableMeshComponent.h ::::::::::::::::::
/**
*
*/
UCLASS(ClassGroup = Rendering, config = Engine, editinlinenew, meta = (BlueprintSpawnableComponent))
class SKELETONLOGGING_API UMyPoseableMeshComponent
:
public UPoseableMeshComponent
{
GENERATED_BODY()
public:
UMyPoseableMeshComponent();
UPROPERTY(VisibleAnywhere, Category = ATEST)
class USkeleton* m_pSkeleton;
UPROPERTY(VisibleAnywhere, Category = ATEST)
class USkeletalMesh* m_pSkeletalMesh;
};
:::::::::::::::::: MyPoseableMeshComponent.h ::::::::::::::::::
#include "MyPoseableMeshComponent.h"
#include "Animation/Skeleton.h"
#include "Engine/SkeletalMesh.h"
#include "Components/SkeletalMeshComponent.h"
UMyPoseableMeshComponent::UMyPoseableMeshComponent()
{
UE_LOG(LogSkeletalMesh, Warning,
TEXT("-----------------------------------------------------------"));
UE_LOG(LogSkeletalMesh, Warning,
TEXT("Inside of UMyPoseableMeshComponent-Constructor!"));
UE_LOG(LogSkeletalMesh, Warning,
TEXT("Number of bones: %d"), this->GetNumBones());
this->SetBoneRotationByName("spine_01",
FRotator(45, 45, 45), EBoneSpaces::WorldSpace);
m_pSkeletalMesh = this->SkeletalMesh;
if (m_pSkeletalMesh) {
UE_LOG(LogSkeletalMesh, Warning,
TEXT("m_pSkeletalMesh set :D"));
m_pSkeleton = m_pSkeletalMesh->Skeleton;
if (m_pSkeleton) {
UE_LOG(LogSkeletalMesh, Warning,
TEXT("m_pSkeleton set :D"));
}
else
{
UE_LOG(LogSkeletalMesh, Warning,
TEXT("m_pSkeleton NOT set ....."));
}
}
else
{
UE_LOG(LogSkeletalMesh, Warning,
TEXT("m_pSkeletalMesh NOT set ....."));
}
UE_LOG(LogSkeletalMesh, Warning,
TEXT("END OF UMyPoseableMeshComponent CONSTRUCTOR!!!"));
}
If there is any information missing or not fully described, I will try to provide or correct them.