StopRecordingAnimation

StopRecordingAnimation

#Overview

name: StopRecordingAnimation

This variable is created as a Console Variable (cvar).

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of StopRecordingAnimation is to halt the process of recording animation data for a specific skeletal mesh component in Unreal Engine 5. This function is part of the animation recording system, which allows developers to capture and save animation data during runtime or in the editor.

This setting variable is primarily used in the Sequence Recorder module of Unreal Engine 5. It is referenced in various parts of the animation recording system, including the AnimationRecorder, SequenceRecorderModule, and MovieSceneAnimationSectionRecorder.

The value of this variable is not set directly, as it is a function call rather than a variable. It is invoked in different scenarios:

  1. When the animation recording exceeds a time limit.
  2. When explicitly called through the editor’s command system.
  3. When finalizing a recorded animation section in a movie scene.
  4. When stopping recording from the Persona editor.

This function interacts with other components of the animation recording system, such as the FAnimationRecorderManager and USkeletalMeshComponent. It is often used in conjunction with other animation recording functions like Record and UpdateRecord.

Developers should be aware of the following when using this function:

  1. It can be called with or without a message display option (bShowMessage parameter).
  2. It is designed to work with specific USkeletalMeshComponent instances.
  3. It may be called automatically by the system in certain conditions (e.g., exceeding time limits) or manually by the user or through code.

Best practices when using this function include:

  1. Ensure that recording has actually started before attempting to stop it.
  2. Handle any necessary cleanup or post-processing after stopping the recording.
  3. Consider the context in which the recording is being stopped (e.g., time limit reached, user request, etc.) and respond accordingly.
  4. Use in conjunction with other animation recording functions to create a complete workflow for capturing and managing animation data.
  5. Be mindful of performance implications, especially when recording complex animations or multiple components simultaneously.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/AnimationRecorder.cpp:879

Scope (from outer to inner):

file
function     void FAnimationRecorder::UpdateRecord

Source code excerpt:

	{
		UE_LOG(LogAnimation, Log, TEXT("Animation Recording exceeds the time limited (%f seconds). Stopping recording animation... "), RecordingRate.AsSeconds(MaxFrame));
		FAnimationRecorderManager::Get().StopRecordingAnimation(Component, true);
		return;
	}
}

bool FAnimationRecorder::Record(USkeletalMeshComponent* Component, FTransform const& ComponentToWorld, const TArray<FTransform>& SpacesBases, const FBlendedHeapCurve& AnimationCurves, int32 FrameToAdd)
{

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/AnimationRecorder.cpp:1397

Scope (from outer to inner):

file
function     void FAnimationRecorderManager::StopRecordingAnimation

Source code excerpt:

}

void FAnimationRecorderManager::StopRecordingAnimation(USkeletalMeshComponent* Component, bool bShowMessage)
{
	for (int32 Idx = 0; Idx < RecorderInstances.Num(); ++Idx)
	{
		FAnimRecorderInstance& Inst = RecorderInstances[Idx];
		if (Inst.SkelComp == Component)
		{

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/Sections/MovieSceneAnimationSectionRecorder.cpp:150

Scope (from outer to inner):

file
function     void FMovieSceneAnimationSectionRecorder::FinalizeSection

Source code excerpt:

		// only show a message if we dont have a valid movie section
		const bool bShowMessage = !MovieSceneSection.IsValid();
		FAnimationRecorderManager::Get().StopRecordingAnimation(SkeletalMeshComponent.Get(), bShowMessage);
	}

	if(MovieSceneSection.IsValid() && AnimSequence.IsValid() && MovieSceneSection->HasStartFrame())
	{
		FFrameRate   TickResolution  = MovieSceneSection->GetTypedOuter<UMovieScene>()->GetTickResolution();
		FFrameNumber SequenceLength  = (AnimSequence->GetPlayLength() * TickResolution).FloorToFrame();

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/SequenceRecorderModule.cpp:271

Scope (from outer to inner):

file
class        class FSequenceRecorderModule : public ISequenceRecorder, private FSelfRegisteringExec
function     virtual bool Exec_Editor

Source code excerpt:

			return HandleRecordAnimationCommand(InWorld, Cmd, Ar);
		}
		else if (FParse::Command(&Cmd, TEXT("StopRecordingAnimation")))
		{
			return HandleStopRecordAnimationCommand(InWorld, Cmd, Ar);
		}
		else if (FParse::Command(&Cmd, TEXT("RecordSequence")))
		{
			return HandleRecordSequenceCommand(InWorld, Cmd, Ar);

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/SequenceRecorderModule.cpp:414

Scope (from outer to inner):

file
class        class FSequenceRecorderModule : public ISequenceRecorder, private FSelfRegisteringExec
function     static bool HandleStopRecordAnimationCommand

Source code excerpt:

			if (SkelComp)
			{
				FAnimationRecorderManager::Get().StopRecordingAnimation(SkelComp);
				return true;
			}
		}

#endif
		return false;

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Private/SequenceRecorderModule.cpp:837

Scope (from outer to inner):

file
class        class FSequenceRecorderModule : public ISequenceRecorder, private FSelfRegisteringExec
function     static void HandlePersonaStopRecording

Source code excerpt:

	static void HandlePersonaStopRecording(USkeletalMeshComponent* Component)
	{
		FAnimationRecorderManager::Get().StopRecordingAnimation(Component);
	}

	static void HandlePersonaTickRecording(USkeletalMeshComponent* Component, float DeltaSeconds)
	{
	//	FAnimationRecorderManager::Get().Tick(Component, DeltaSeconds);
	}

#Loc: <Workspace>/Engine/Source/Editor/SequenceRecorder/Public/AnimationRecorder.h:256

Scope: file

Source code excerpt:

	UAnimSequence* GetCurrentlyRecordingSequence(USkeletalMeshComponent* Component);
	float GetCurrentRecordingTime(USkeletalMeshComponent* Component);
	void StopRecordingAnimation(USkeletalMeshComponent* Component, bool bShowMessage = true);
	void StopRecordingAllAnimations();
	const FTransform& GetInitialRootTransform(USkeletalMeshComponent* Component) const;

	void Tick(float DeltaTime);

	void Tick(USkeletalMeshComponent* Component, float DeltaTime);