InputProfiles

InputProfiles

#Overview

name: InputProfiles

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of InputProfiles is to manage and store multiple input profiles for the Virtual Camera system in Unreal Engine 5. It is primarily used in the VirtualCameraCore plugin to define and switch between different input configurations for virtual camera components.

This setting variable is relied upon by the VirtualCameraCore plugin, specifically within the VCamCore module. It is used in the UVCamInputSettings class and the UVCamComponent class to manage input profiles for virtual camera components.

The value of this variable is set in the UVCamInputSettings class, which is a UDeveloperSettings subclass. It can be modified through the project settings or programmatically using the SetInputProfiles function.

InputProfiles interacts with other variables such as DefaultInputProfile, which determines the default input profile to use. It also interacts with the InputProfile variable in the UVCamComponent class, which represents the currently active input profile for a specific virtual camera component.

Developers must be aware that:

  1. InputProfiles is a TMap<FName, FVCamInputProfile>, where each profile is identified by a unique name.
  2. Changes to InputProfiles should be saved using the SaveConfig() function to persist them.
  3. The profiles defined in InputProfiles can be applied to UVCamComponent instances.

Best practices when using this variable include:

  1. Use meaningful and consistent names for input profiles.
  2. Ensure that the DefaultInputProfile always refers to a valid profile name within InputProfiles.
  3. When modifying InputProfiles programmatically, always call SaveConfig() to persist changes.
  4. Use the provided functions like SetInputProfiles and GetInputProfileNames for manipulating and accessing the profiles.
  5. When applying a profile to a UVCamComponent, verify that the profile exists in InputProfiles before attempting to use it.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Config/DefaultVCamInputSettings.ini:3, section: [/Script/VCamCore.VCamInputSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/Input/VCamInputSettings.cpp:25

Scope (from outer to inner):

file
function     void UVCamInputSettings::SetDefaultInputProfile

Source code excerpt:

void UVCamInputSettings::SetDefaultInputProfile(const FName NewDefaultInputProfile)
{
	if (InputProfiles.Contains(NewDefaultInputProfile))
	{
		DefaultInputProfile = NewDefaultInputProfile;
		SaveConfig();
	}
}

void UVCamInputSettings::SetInputProfiles(const TMap<FName, FVCamInputProfile>& NewInputProfiles)
{
	InputProfiles = NewInputProfiles;
	SaveConfig();
}

TArray<FName> UVCamInputSettings::GetInputProfileNames() const
{
	TArray<FName> ProfileNames;
	InputProfiles.GenerateKeyArray(ProfileNames);
	return ProfileNames;
}

void UVCamInputSettings::PostInitProperties()
{
	Super::PostInitProperties();

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/VCamComponent.cpp:85

Scope (from outer to inner):

file
function     void UVCamComponent::OnComponentCreated

Source code excerpt:

	// After creation, the InputProfile should be initialized to the project setting's default mappings
	const UVCamInputSettings* VCamInputSettings = GetDefault<UVCamInputSettings>();
	const FVCamInputProfile* NewInputProfile = VCamInputSettings ? VCamInputSettings->InputProfiles.Find(VCamInputSettings->DefaultInputProfile) : nullptr;
	if (NewInputProfile)
	{
		InputProfile = *NewInputProfile;
	}

	// ApplyComponentInstanceData will handle initialization if the construction script is being re-run on a Blueprint created component.

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/VCamComponent.cpp:505

Scope (from outer to inner):

file
function     bool UVCamComponent::SetInputProfileFromName

Source code excerpt:

	if (const UVCamInputSettings* VCamInputSettings = UVCamInputSettings::GetVCamInputSettings())
	{
		if (const FVCamInputProfile* NewInputProfile = VCamInputSettings->InputProfiles.Find(ProfileName))
		{
			InputProfile = *NewInputProfile;
			ApplyInputProfile();
		}
	}
	return false;

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/VCamComponent.cpp:524

Scope (from outer to inner):

file
function     bool UVCamComponent::AddInputProfileWithCurrentlyActiveMappings

Source code excerpt:

	}
	
	FVCamInputProfile* TargetInputProfile = VCamInputSettings->InputProfiles.Find(ProfileName);

	// An Input Profile with this name already exists
	if (TargetInputProfile)
	{
		if (!bUpdateIfProfileAlreadyExists)
		{

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/VCamComponent.cpp:536

Scope (from outer to inner):

file
function     bool UVCamComponent::AddInputProfileWithCurrentlyActiveMappings

Source code excerpt:

	else
	{
		TargetInputProfile = &VCamInputSettings->InputProfiles.Add(ProfileName);
	}

	if (const IEnhancedInputSubsystemInterface* EnhancedInputSubsystemInterface = GetInputVCamSubsystem())
	{
		TArray<FEnhancedActionKeyMapping> PlayerMappableActionKeyMappings;
		for (const UInputMappingContext* MappingContext : AppliedInputContexts)

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Private/VCamComponent.cpp:601

Scope (from outer to inner):

file
function     bool UVCamComponent::SaveCurrentInputProfileToSettings

Source code excerpt:

	}

	FVCamInputProfile& SettingsInputProfile = VCamInputSettings->InputProfiles.FindOrAdd(ProfileName);
	SettingsInputProfile = InputProfile;
	VCamInputSettings->SaveConfig();

	return true;
}

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCore/Public/Input/VCamInputSettings.h:38

Scope (from outer to inner):

file
class        class UVCamInputSettings : public UDeveloperSettings

Source code excerpt:

	/** A bunch of profiles that components can switch between */
	UPROPERTY(EditAnywhere, Config, BlueprintReadWrite, BlueprintSetter=SetInputProfiles, Category="Input")
	TMap<FName, FVCamInputProfile> InputProfiles;

	/** Gets the settings object. */
	UFUNCTION(BlueprintCallable, Category="VCam")
	static UVCamInputSettings* GetVCamInputSettings();

	/** Sets DefaultInputProfile and saves it out to the config.  */
	UFUNCTION(BlueprintCallable, Category="VCam Input")
	void SetDefaultInputProfile(const FName NewDefaultInputProfile);
	/** Updates InputProfiles and save it out to the config. */
	UFUNCTION(BlueprintCallable, Category="VCam Input")
	void SetInputProfiles(const TMap<FName, FVCamInputProfile>& NewInputProfiles);

	/** @return All configured profiles */
	UFUNCTION(BlueprintCallable, Category="VCam Input")
	TArray<FName> GetInputProfileNames() const;

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCoreEditor/Private/Customizations/VCamInputProfileCustomization.cpp:123

Scope (from outer to inner):

file
namespace    UE::VCamCoreEditor::Private
function     void FVCamInputProfileCustomization::OnProfileChanged

Source code excerpt:

			const FString NewPresetName = *NewSelection.Get();

			if (const FVCamInputProfile* InputProfile = VCamInputSettings->InputProfiles.Find(FName(NewPresetName)))
			{
				const FScopedTransaction Transaction(LOCTEXT("ChangeVCamInputProfile", "Change VCam Input Profile"));
				
				FStructProperty* StructProperty = CastFieldChecked<FStructProperty>(CachedStructPropertyHandle->GetProperty());
				FMapProperty* MapProperty = CastFieldChecked<FMapProperty>(MappableKeyOverridesHandle->GetProperty());

#Loc: <Workspace>/Engine/Plugins/VirtualProduction/VirtualCameraCore/Source/VCamCoreEditor/Private/Customizations/VCamInputProfileCustomization.cpp:183

Scope (from outer to inner):

file
namespace    UE::VCamCoreEditor::Private
function     TSharedPtr<FString> FVCamInputProfileCustomization::GetProfileString

Source code excerpt:

		if (InputProfilePtr && VCamInputSettings)
		{
			for (const TPair<FName, FVCamInputProfile>& InputProfilePair : VCamInputSettings->InputProfiles)
			{
				const FName& InputProfileName = InputProfilePair.Key;
				const FVCamInputProfile& InputProfileValue = InputProfilePair.Value;
				if (InputProfileValue == *InputProfilePtr)
				{
					const TSharedPtr<FString>* FoundString = ProfileComboList.FindByPredicate([InputProfileString = InputProfileName.ToString()](const TSharedPtr<FString> ListEntry)