CommonRootWidgetClasses

CommonRootWidgetClasses

#Overview

name: CommonRootWidgetClasses

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of CommonRootWidgetClasses is to provide a list of commonly used panel widget classes for the root of UMG (Unreal Motion Graphics) widget blueprints. It is used in the UMG editor system to populate the common class section of the root widget selection dialog when creating new widget blueprints.

This setting variable is primarily relied upon by the UMG Editor subsystem and the Blutility module in Unreal Engine. It’s used in the widget blueprint creation process to offer developers a quick selection of commonly used root widget classes.

The value of this variable is set in the UUMGEditorProjectSettings constructor (UMGEditorProjectSettings.cpp). By default, it includes UHorizontalBox, UVerticalBox, UGridPanel, and UCanvasPanel classes.

CommonRootWidgetClasses interacts with other variables such as bUseWidgetTemplateSelector and DefaultRootWidget, which are part of the same UWidgetEditingProjectSettings class. These variables collectively control the behavior of widget blueprint creation.

Developers must be aware that this variable affects the user interface of the widget creation process. Modifying this list will change the options presented to users when they create new widget blueprints.

Best practices when using this variable include:

  1. Keeping the list concise and focused on truly common panel widgets to avoid overwhelming users.
  2. Ensuring all classes in the list are valid and inherit from UPanelWidget.
  3. Considering project-specific needs when customizing this list, especially for larger teams or specific game requirements.
  4. Documenting any changes to this list for team-wide consistency in widget creation.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditor.ini:659, section: [/Script/Blutility.EditorUtilityWidgetProjectSettings]

Location: <Workspace>/Engine/Config/BaseEditor.ini:660, section: [/Script/Blutility.EditorUtilityWidgetProjectSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/Blutility/Private/EditorUtilityWidgetBlueprintFactory.cpp:85

Scope (from outer to inner):

file
function     bool UEditorUtilityWidgetBlueprintFactory::ConfigureProperties

Source code excerpt:

		Options.bShowNoneOption = true;

		TArray<TSoftClassPtr<UPanelWidget>> CommonRootWidgetClasses = GetDefault<UEditorUtilityWidgetProjectSettings>()->CommonRootWidgetClasses;
		for (int32 Index = 0; Index < CommonRootWidgetClasses.Num(); ++Index)
		{
			UClass* PanelWidgetClass = CommonRootWidgetClasses[Index].LoadSynchronous();
			if (PanelWidgetClass && PanelWidgetClass->IsChildOf(UPanelWidget::StaticClass()))
			{
				if (!Options.ExtraPickerCommonClasses.Contains(PanelWidgetClass))
				{
					Options.ExtraPickerCommonClasses.Add(PanelWidgetClass);
				}

#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Private/Settings/UMGEditorProjectSettings.cpp:32

Scope (from outer to inner):

file
function     UUMGEditorProjectSettings::UUMGEditorProjectSettings

Source code excerpt:


	bUseWidgetTemplateSelector = false;
	CommonRootWidgetClasses = {
		UHorizontalBox::StaticClass(),
		UVerticalBox::StaticClass(),
		UGridPanel::StaticClass(),
		UCanvasPanel::StaticClass()
	};
	DefaultRootWidget = nullptr;

#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintFactory.cpp:117

Scope (from outer to inner):

file
function     bool UWidgetBlueprintFactory::ConfigureProperties

Source code excerpt:

		Options.bShowNoneOption = true;

		TArray<TSoftClassPtr<UPanelWidget>> CommonRootWidgetClasses = GetDefault <UUMGEditorProjectSettings>()->CommonRootWidgetClasses;
		for (int32 Index = 0; Index < CommonRootWidgetClasses.Num(); ++Index)
		{
			UClass* PanelWidgetClass = CommonRootWidgetClasses[Index].LoadSynchronous();
			if (PanelWidgetClass && PanelWidgetClass->IsChildOf(UPanelWidget::StaticClass()))
			{
				if (!Options.ExtraPickerCommonClasses.Contains(PanelWidgetClass))
				{
					Options.ExtraPickerCommonClasses.Add(PanelWidgetClass);
				}

#Loc: <Workspace>/Engine/Source/Editor/UMGEditor/Public/WidgetEditingProjectSettings.h:159

Scope (from outer to inner):

file
class        class UWidgetEditingProjectSettings : public UDeveloperSettings

Source code excerpt:

	/** This list populates the common class section of the root widget selection dialog */
	UPROPERTY(EditAnywhere, config, Category = "Designer", meta = (EditCondition = "bUseWidgetTemplateSelector"))
	TArray<TSoftClassPtr<UPanelWidget>> CommonRootWidgetClasses;

	/** The panel widget to place at the root of all newly constructed widget blueprints. Can be empty. */
	UPROPERTY(EditAnywhere, config, Category = "Designer")
	TSubclassOf<UPanelWidget> DefaultRootWidget;

	/** Set true to filter all categories and widgets out in the palette, selectively enabling them later via permission lists. */