I am working with the code below.
I am trying to simulate a PostEditChangeProperty event since I am modifying values in my own PostEditChangeProperty function. I was having problems with accessing properties from SkeletalMeshComponent->AnimationData. For some reason only the AnimToPlay is working and the SavedPosition is not found (FindPropertyByName returns null). I tried other properties from FSingleAnimationPlayData but it appears only the AnimToPlay returns a value. Any idea what I need to do? (lines 25-28)
#if WITH_EDITOR
void AToggleActor::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
UProperty* PropertyThatChanged = PropertyChangedEvent.Property;
if (PropertyThatChanged != NULL)
{
if (PropertyThatChanged->GetFName() == GET_MEMBER_NAME_CHECKED(AToggleActor, bActivated))
{
USkeletalMeshComponent* SkeletalMeshComponent = this->GetSkeletalMeshComponent();
struct FSingleAnimationPlayData* SingleAnimationPlayData = &SkeletalMeshComponent->AnimationData;
if (bActivated)
{
Activate();
SingleAnimationPlayData->AnimToPlay = ActivateAnimation;
SingleAnimationPlayData->SavedPosition = .2f;
}
else
{
Deactivate();
SingleAnimationPlayData->AnimToPlay = DeactivateAnimation;
SingleAnimationPlayData->SavedPosition = .2f;
}
FPropertyChangedEvent f = FPropertyChangedEvent(SkeletalMeshComponent->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(FSingleAnimationPlayData, SavedPosition)));
SkeletalMeshComponent->PostEditChangeProperty(f);
FPropertyChangedEvent e = FPropertyChangedEvent(SkeletalMeshComponent->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(FSingleAnimationPlayData, AnimToPlay)));
SkeletalMeshComponent->PostEditChangeProperty(e);
}
}
Super::PostEditChangeProperty(PropertyChangedEvent);
}
#endif