PaperSkeletonData.h
(Key UStruct Definitions Above)
USTRUCT()
struct FPaperSkeletonTimelineData
{
GENERATED_USTRUCT_BODY()
// UPROPERTY()
// struct FPaperSkeletonAnimationData* Owner; <-- Throws error, saying "*" cant be added to a non-exposable type.
// Unique ID
UPROPERTY(EditAnywhere)
FName Name;
UPROPERTY(EditAnywhere)
EPaperSkeletonDataType DataType;
// Keys
UPROPERTY(EditAnywhere)
TArray<FPaperSkeletonBaseKeyData> Keys;
FPaperSkeletonTimelineData(){}
FPaperSkeletonTimelineData(FName timelineName, TArray<FPaperSkeletonBaseKeyData>& keys)
: Name(timelineName), Keys(keys)
{
}
FPaperSkeletonBaseKeyData FindKey(float atTime);
};
USTRUCT()
struct FPaperSkeletonAnimationData
{
GENERATED_USTRUCT_BODY()
// Skeleton Data (Owner)
class UPaperSkeletonData* SkeletonOwner;
// Name of the Animation
UPROPERTY(EditAnywhere)
FName Name;
// Duration of the Animation
UPROPERTY(EditAnywhere)
float Duration;
// Should the animation loop?
UPROPERTY(EditAnywhere)
bool bShouldLoop;
// Timelines/Objects relative to the Animation
UPROPERTY(EditAnywhere)
TArray<FPaperSkeletonTimelineData> Timelines;
FPaperSkeletonAnimationData(){}
FPaperSkeletonAnimationData(UPaperSkeletonData* skeletonOwner, FName animationName, float duration, bool shouldLoop, TArray<FPaperSkeletonTimelineData>& timelines)
: SkeletonOwner(skeletonOwner), Name(), Duration(duration), bShouldLoop(shouldLoop), Timelines(timelines)
{
}
bool IsActive(FName objectName);
FPaperSkeletonTimelineData FindTimeline(FName objectName);
};
UCLASS(BlueprintType, meta=(DisplayThumbnail="true"))
class PAPERTESTREALM_API UPaperSkeletonData : public UDataAsset
{
GENERATED_BODY()
public:
// Skeleton Name
UPROPERTY(EditAnywhere)
FName Name;
// Definition of Objects that need to be created for the Skeleton
UPROPERTY(EditAnywhere)
TArray<FPaperSkeletonObjectDefinition> ObjectDefinitions;
// Skeleton Animations
UPROPERTY(EditAnywhere)
TArray<FPaperSkeletonAnimationData> Animations;
FPaperSkeletonAnimationData FindAnimation(FName animationName);
};
Should i keep them as UStructs or UObjects instead?
Keeping a pointer to a Higher-Level Data Object that owns the above Data Object is another necessity i cant seem to pull off right now.
(See above code struct FPaperSkeletonAnimationData* AnimationOwner;
)
I want to be able to pass around my Data Objects as pointers or references to make sure all other classes that access them, are accessing the most recent/updated version of them in the UPaperSkeletonData asset class.