bSCCAutoAddNewFiles

bSCCAutoAddNewFiles

#Overview

name: bSCCAutoAddNewFiles

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 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bSCCAutoAddNewFiles is to control whether newly created or modified files are automatically added to source control in Unreal Engine. This setting is primarily used for managing version control integration within the editor.

This setting variable is relied upon by several Unreal Engine subsystems and modules, including:

  1. StormSync plugin
  2. MovieRenderPipeline plugin
  3. AssetTools module
  4. UnrealEd module

The value of this variable is set in the EditorLoadingSavingSettings class, which is part of the UnrealEd module. It is defined as a config property, meaning it can be modified through the editor’s project settings.

This variable interacts with the source control integration system in Unreal Engine. It is often used in conjunction with ISourceControlModule to determine whether new files should be automatically added to version control.

Developers must be aware that:

  1. This setting only takes effect when source control is enabled and available.
  2. It can impact the workflow of adding new assets to a project, as it automates the process of adding files to version control.
  3. It may not work with all source control providers, as it depends on the implementation of the ISourceControlModule.

Best practices when using this variable include:

  1. Ensure that all team members are aware of this setting and its implications on the project workflow.
  2. Consider disabling this feature if you prefer manual control over which files are added to source control.
  3. If enabled, regularly review the files being automatically added to ensure no unnecessary files are included in version control.
  4. Be cautious when temporarily disabling this setting, as it may lead to files being unintentionally left out of source control.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:189, section: [/Script/UnrealEd.EditorLoadingSavingSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/StormSync/Source/StormSyncImport/Private/Subsystems/StormSyncImportSubsystem.cpp:515

Scope (from outer to inner):

file
function     bool UStormSyncImportSubsystem::HandleNewAssets

Source code excerpt:

	}

	if (!GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles)
	{
		UE_LOG(LogStormSyncImport, Log, TEXT("UStormSyncImportSubsystem::HandleNewAssets - Source Control Auto Add New Files is disabled."));
		return false;
	}

	if (!ISourceControlModule::Get().GetProvider().IsAvailable())

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineEditor/Private/MoviePipelineEditorBlueprintLibrary.cpp:117

Scope (from outer to inner):

file
function     UMoviePipelineQueue* UMoviePipelineEditorBlueprintLibrary::SaveQueueToManifestFile

Source code excerpt:

	{
		UEditorLoadingSavingSettings* SaveSettings = GetMutableDefault<UEditorLoadingSavingSettings>();
		uint32 bSCCAutoAddNewFiles = SaveSettings->bSCCAutoAddNewFiles;
		SaveSettings->bSCCAutoAddNewFiles = 0;
		bool bSuccess = SavePackageHelper(NewPackage, *OutManifestFilePath);
		SaveSettings->bSCCAutoAddNewFiles = bSCCAutoAddNewFiles;
		
		if(!bSuccess)
		{
			return nullptr;
		}
	}

#Loc: <Workspace>/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp:2410

Scope (from outer to inner):

file
function     bool UAssetToolsImpl::AdvancedCopyPackages

Source code excerpt:


			if (SuccessfullyCopiedDestinationFiles.Num() > 0
			&& GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles
			&& ISourceControlModule::Get().IsEnabled())
			{
				// attempt to add files to source control (this can quite easily fail, but if it works it is very useful)
				ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
				if (SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SourceControlHelpers::AbsoluteFilenames(SuccessfullyCopiedDestinationFiles)) == ECommandResult::Failed)
				{

#Loc: <Workspace>/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp:2622

Scope (from outer to inner):

file
function     bool UAssetToolsImpl::AdvancedCopyPackages

Source code excerpt:

		{
			// attempt to add files to source control (this can quite easily fail, but if it works it is very useful)
			if (GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles)
			{
				if (ISourceControlModule::Get().IsEnabled())
				{
					ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
					if (SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SourceControlHelpers::PackageFilenames(SuccessfullyCopiedDestinationFiles)) == ECommandResult::Failed)
					{

#Loc: <Workspace>/Engine/Source/Developer/AssetTools/Private/AssetTools.cpp:5693

Scope (from outer to inner):

file
function     void UAssetToolsImpl::MigratePackages_ReportConfirmed

Source code excerpt:

		{
			// attempt to add files to source control (this can quite easily fail, but if it works it is very useful)
			if(GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles)
			{
				if(ISourceControlModule::Get().IsEnabled())
				{
					ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
					if(SourceControlProvider.Execute(ISourceControlOperation::Create<FMarkForAdd>(), SuccessfullyCopiedFiles) == ECommandResult::Failed)
					{

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/EditorLoadingSavingSettings.h:210

Scope (from outer to inner):

file
class        class UEditorLoadingSavingSettings : public UObject

Source code excerpt:

	/** Auto add files to source control */
	UPROPERTY(EditAnywhere, config, Category=SourceControl, meta=(DisplayName="Add New Files when Modified"))
	uint32 bSCCAutoAddNewFiles:1;

	/** Use global source control login settings, rather than per-project. Changing this will require you to login again */
	UPROPERTY(EditAnywhere, config, Category=SourceControl, meta=(DisplayName="Use Global Settings"))
	uint32 bSCCUseGlobalSettings:1;

	/** Specifies the file path to the tool to be used for diffing text files */

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:4535

Scope (from outer to inner):

file
function     bool UEditorEngine::IsPackageValidForAutoAdding

Source code excerpt:

	if (InPackage && GIsEditor && !IsRunningCommandlet() 
		&& (ISourceControlModule::Get().IsEnabled() || FUncontrolledChangelistsModule::Get().IsEnabled())
		&& GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles)
	{
		const FString CleanFilename = FPaths::GetCleanFilename(InFilename);

		// Determine if the package has been saved before or not; if it has, it's not valid for auto-adding
		bPackageIsValid = !FPaths::FileExists(InFilename);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Factories/PackFactory.cpp:816

Scope (from outer to inner):

file
function     UObject* UPackFactory::FactoryCreateBinary

Source code excerpt:


			// If source control is enabled mark all the added files for checkout/add
			if (ISourceControlModule::Get().IsEnabled() && GetDefault<UEditorLoadingSavingSettings>()->bSCCAutoAddNewFiles)
			{
				for (const FString& Filename : WrittenFiles)
				{
					FText ErrorMessage;
					if (!SourceControlHelpers::CheckoutOrMarkForAdd(Filename, FText::FromString(Filename), NULL, ErrorMessage))
					{