[HOWTO] Animation C++

I want to know better an animation in UE4.

What I wonder, if you load an animation in the EU4 from C++ (VS2015) and i write the appropriate code. So I reason and I say that is loaded into RAM (stack, heap, what else…) with all related data of the animation. Then the animation loaded in RAM where there will be an object that contains all the data. I assume that there will be a class of that object. The thing that I have not realized yet. Which is the class???

Because i want to edit that animation data.

What i saw until now, it’s there is a skeleton and a mesh. Then create an association between them and at last rigging.

I think there is a parent class over the skeleton class and the mesh class to do the association. But i repeat i don’t know the class.

Can Anyone help me? thank you

The class is called UAnimSequence.

For example, in UAnimSequence you can call GetBoneTransform which will extract the bone transform for a certain time for a certain track. You can choose to extract the raw data, or the processed one. The track is simply the bone in question (so the root bone is index 0, beyond that check your skeleton).

In AnimSequence.cpp you can look at ExtractBoneTransform (there are two of these, look at the longer one) - you can see how it gets the raw values directly.

ok i saw, thank you so much for this support.

I saw the struct it contains raw data. One question can i rewrite by hand this raw data at run-time in real time!?

/**
 * Raw keyframe data for one track.  Each array will contain either NumFrames elements or 1 element.
 * One element is used as a simple compression scheme where if all keys are the same, they'll be
 * reduced to 1 key that is constant over the entire sequence.
 */
USTRUCT()
struct ENGINE_API FRawAnimSequenceTrack
{
	GENERATED_USTRUCT_BODY()

	/** Position keys. */
	UPROPERTY()
	TArray<FVector> PosKeys;

	/** Rotation keys. */
	UPROPERTY()
	TArray<FQuat> RotKeys;

	/** Scale keys. */
	UPROPERTY()
	TArray<FVector> ScaleKeys;

	// Serializer.
	friend FArchive& operator<<( FArchive& Ar, FRawAnimSequenceTrack& T )
	{
		T.PosKeys.BulkSerialize(Ar);
		T.RotKeys.BulkSerialize(Ar);

		if (Ar.UE4Ver() >= VER_UE4_ANIM_SUPPORT_NONUNIFORM_SCALE_ANIMATION)
		{
			T.ScaleKeys.BulkSerialize(Ar);
		}

		return Ar;
	}
};

I’ve never tried it but it looks like you can. The main structure involved, RawAnimationData, is public and the structures inside it are also public. Can’t see why not.

ok now im triyng it.

Hey, I am curious if you made progress on rewriting the animation data in realtime. Did you manage to do it?

Cheers