UE4游戏内录像

 

编辑器内运行游戏项目输入命令

1.开始录像StartMovieCapture

UE4游戏内录像_第1张图片

 

2.停止录像StopMovieCapture

UE4游戏内录像_第2张图片

3.开始录像到停止录像这段时间录像文件保存路径;项目Saved\VideoCaptures

UE4游戏内录像_第3张图片

录像代码:

GameEngine.cpp

#if WITH_EDITOR
	else if( FParse::Command(&Cmd,TEXT("STARTMOVIECAPTURE")) && GIsEditor )
	{
		IMovieSceneCaptureInterface* CaptureInterface = IMovieSceneCaptureModule::Get().GetFirstActiveMovieSceneCapture();
		if (CaptureInterface)
		{
			CaptureInterface->StartCapturing();
			return true;
		}
		else if (SceneViewport.IsValid())
		{
			if (IMovieSceneCaptureModule::Get().CreateMovieSceneCapture(SceneViewport))
			{
				return true;
			}
		}
		return false;
	}
#endif

UnrealEngine.cpp

else if( FParse::Command(&Cmd,TEXT("STOPMOVIECAPTURE")) && GIsEditor )
	{
		return HandleStopMovieCaptureCommand( Cmd, Ar );
	}

bool UEngine::HandleStopMovieCaptureCommand( const TCHAR* Cmd, FOutputDevice& Ar )
{
	if (IMovieSceneCaptureInterface* CaptureInterface = IMovieSceneCaptureModule::Get().GetFirstActiveMovieSceneCapture())
	{
		CaptureInterface->Close();
		return true;
	}
	return false;
}

看开始录像代码#if WITH_EDITOR和GIsEditor,看出录像功能暂支持在编辑器运行的项目录像,如果项目打包后录像,需要简单扩展一下上面代码。

你可能感兴趣的:(UE4杂项)