BP.ImportParentClassNamespaces

BP.ImportParentClassNamespaces

#Overview

name: BP.ImportParentClassNamespaces

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of BP.ImportParentClassNamespaces is to control the import of parent class namespaces when opening a Blueprint for editing in Unreal Engine 5.

This setting variable is primarily used in the Blueprint editor subsystem, specifically within the namespace handling functionality. It is part of the Kismet module, which is responsible for the Blueprint visual scripting system in Unreal Engine.

The value of this variable is set through a console variable (CVar) named CVarBPImportParentClassNamespaces. It is initialized to false by default, indicating that the feature is disabled unless explicitly enabled.

This variable interacts closely with the BlueprintEditorSettings, particularly the bInheritImportedNamespacesFromParentBP property. The value of BP.ImportParentClassNamespaces is synchronized with this editor setting.

Developers should be aware that this is an experimental feature, as indicated by the comment associated with the parent namespace importing feature. Enabling this feature may affect the behavior of Blueprint editing, particularly in how namespaces are handled and inherited from parent classes.

Best practices when using this variable include:

  1. Only enable it if you specifically need the functionality of importing parent class namespaces in Blueprints.
  2. Be aware of potential impacts on existing Blueprints and their namespace structure.
  3. Test thoroughly in a non-production environment before enabling in a production setting.
  4. Keep track of any changes in behavior or performance when this feature is enabled.

Regarding the associated variable CVarBPImportParentClassNamespaces:

The purpose of CVarBPImportParentClassNamespaces is to serve as the actual console variable that controls the BP.ImportParentClassNamespaces setting. It is the implementation detail of how the setting is stored and accessed within the engine.

This variable is part of the Kismet module and is used to toggle the parent class namespace importing feature in the Blueprint editor.

The value of CVarBPImportParentClassNamespaces is set in the same locations as BP.ImportParentClassNamespaces, typically through the BlueprintEditorSettings.

It interacts directly with the BlueprintEditorSettings, specifically the bInheritImportedNamespacesFromParentBP property. The RefreshEditorFeatureConsoleFlags function ensures that the CVar value stays in sync with the editor settings.

Developers should be aware that modifying this CVar directly (e.g., through console commands) may lead to inconsistencies with the BlueprintEditorSettings if not properly handled.

Best practices for using CVarBPImportParentClassNamespaces include:

  1. Prefer modifying the setting through the BlueprintEditorSettings rather than directly manipulating the CVar.
  2. If direct manipulation is necessary, ensure that the BlueprintEditorSettings are updated accordingly.
  3. Use the provided FBlueprintNamespaceHelper functions for managing this setting to maintain consistency across the engine.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/BlueprintNamespaceHelper.cpp:43

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarBPImportParentClassNamespaces(
	TEXT("BP.ImportParentClassNamespaces"),
	false,
	TEXT("Enables import of parent class namespaces when opening a Blueprint for editing."));

// ---

class FClassViewerNamespaceFilter : public IClassViewerFilter

#Associated Variable and Callsites

This variable is associated with another variable named CVarBPImportParentClassNamespaces. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/BlueprintNamespaceHelper.cpp:42

Scope: file

Source code excerpt:

	TEXT("Enables namespace importing features in the Blueprint editor (experimental)."));

static TAutoConsoleVariable<bool> CVarBPImportParentClassNamespaces(
	TEXT("BP.ImportParentClassNamespaces"),
	false,
	TEXT("Enables import of parent class namespaces when opening a Blueprint for editing."));

// ---

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/BlueprintNamespaceHelper.cpp:261

Scope (from outer to inner):

file
function     void FBlueprintNamespaceHelper::RefreshEditorFeatureConsoleFlags

Source code excerpt:

		InitCVarFlag(CVarBPEnableNamespaceFilteringFeatures.AsVariable(), BlueprintEditorSettings->bEnableNamespaceFilteringFeatures);
		InitCVarFlag(CVarBPEnableNamespaceImportingFeatures.AsVariable(), BlueprintEditorSettings->bEnableNamespaceImportingFeatures);
		InitCVarFlag(CVarBPImportParentClassNamespaces.AsVariable(), BlueprintEditorSettings->bInheritImportedNamespacesFromParentBP);

		bIsInitialized = true;
	}

	// Update console variables to match current Blueprint editor settings.
	static bool bIsUpdating = false;

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/BlueprintNamespaceHelper.cpp:279

Scope (from outer to inner):

file
function     void FBlueprintNamespaceHelper::RefreshEditorFeatureConsoleFlags

Source code excerpt:

		SetCVarFlag(CVarBPEnableNamespaceFilteringFeatures.AsVariable(), BlueprintEditorSettings->bEnableNamespaceFilteringFeatures);
		SetCVarFlag(CVarBPEnableNamespaceImportingFeatures.AsVariable(), BlueprintEditorSettings->bEnableNamespaceImportingFeatures);
		SetCVarFlag(CVarBPImportParentClassNamespaces.AsVariable(), BlueprintEditorSettings->bInheritImportedNamespacesFromParentBP);
	}
}

#undef LOCTEXT_NAMESPACE