bool FMatineePerformanceCaptureCommand::Update()
{
	//for every matinee actor in the level
	for (TObjectIterator<AMatineeActor> It; It; ++It)
	{
		AMatineeActor* MatineeActor = *It;
		FString MatineeFOOName = MatineeActor->GetName();
		if (MatineeActor->GetName().Equals(MatineeName,ESearchCase::IgnoreCase))
		{	


			//add latent action to execute this matinee
			ADD_LATENT_AUTOMATION_COMMAND(FPlayMatineeLatentCommand(MatineeActor));

			//Run the Stat FPS Chart command
			ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart")));

			//add action to wait until matinee is complete
			ADD_LATENT_AUTOMATION_COMMAND(FWaitForMatineeToCompleteLatentCommand(MatineeActor));

			//Stop the Stat FPS Chart command
			ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart")));
		}
		else
		{
			UE_LOG(LogEngineAutomationLatentCommand, Log, TEXT("'%s' is not the matinee name that is being searched for."), *MatineeActor->GetName())
		}
	}

	return true;

}
Example #2
0
bool FCinematicFPSPerfTest::RunTest(const FString& Parameters)
{
	//Map to use for this test.
	const FString MapName = Parameters;

	//The name of the matinee actor that will be triggered.
	FString MatineeActorName;

	//Check we are running from commandline
	const FString CommandLine(FCommandLine::Get());
	if (CommandLine.Contains(TEXT("AutomationTests")))
	{
		//Get the name of the matinee to be used.
		//If the game was not launched with the -MatineeName argument then this test will be ran based on time.
		if (FParse::Value(*CommandLine, TEXT("MatineeName="), MatineeActorName))
		{
			//Load map
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));
			ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName));
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

			//Start the matinee and perform the FPS Chart
			ADD_LATENT_AUTOMATION_COMMAND(FMatineePerformanceCaptureCommand(MatineeActorName));
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

			return true;
		}
		else
		{
			UE_LOG(LogEngineAutomationTests, Log, TEXT("The matinee name was not specified.  Run the game with -MatineeName=\"Name of the matinee actor\"."));

			//Get the name of the console event to trigger the cinematic
			FString CinematicEventCommand;
			if (!FParse::Value(*CommandLine, TEXT("CE="), CinematicEventCommand))
			{
				UE_LOG(LogEngineAutomationTests, Log, TEXT("A console event command was not specified. Defaults to CE START.  Run the game with -CE=\"Command\"."));
				CinematicEventCommand = TEXT("CE Start");
			}

			//Get the length of time the cinematic will run
			float RunTime;
			if (!FParse::Value(*CommandLine, TEXT("RunTime="), RunTime))
			{
				UE_LOG(LogEngineAutomationTests, Log, TEXT("A run time length in seconds was not specified. Defaults to 60 seconds. Run the game with -RunTime=###."));
				RunTime = 60.f;
			}

			//Load map
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));
			ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName));
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

			//Start the matinee and perform the FPS Chart
			ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(CinematicEventCommand));
			ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart")));
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(RunTime));
			ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart")));
			ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

			return true;

		}
	}
	//If the user is running from the UFE then we'll use the default values.
	//@todo Give the end user a way to specify the values for this test.

	UE_LOG(LogEngineAutomationTests, Log, TEXT("Running the FPS chart performance capturing for 60 seconds while in '%s'.\nThe default CE command won't be used at this time."), *MapName);

	//Load map
	ADD_LATENT_AUTOMATION_COMMAND(FLoadGameMapCommand(MapName));
	ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

	//Start the matinee and perform the FPS Chart
	ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StartFPSChart")));
	ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(60.0f));
	ADD_LATENT_AUTOMATION_COMMAND(FExecWorldStringLatentCommand(TEXT("StopFPSChart")));
	ADD_LATENT_AUTOMATION_COMMAND(FEngineWaitLatentCommand(1.0f));

	return true;
}