BRUSH
BRUSH
#Overview
name: BRUSH
This variable is created as a Console Variable (cvar).
- type:
Exec
- help:
Sorry: Exec commands have no help
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of BRUSH is to manage and store the last used directory for brush operations in the Unreal Engine editor. This setting variable is primarily used for file management and user interface convenience within the editor’s brush-related functionalities.
BRUSH is mainly utilized by the UnrealEd module, which is part of the Unreal Engine editor subsystem. It’s specifically used in the EditorDirectories and EditorServer components.
The value of this variable is set and retrieved in multiple places:
- It’s loaded from a configuration file in the FEditorDirectories::LoadLastDirectories function.
- It’s saved to a configuration file in the FEditorDirectories::SaveLastDirectories function.
- It’s used in various editor commands related to brush operations, such as in Exec_StaticMesh, Exec_Poly, Exec_Editor, and HandleMapCommand functions.
BRUSH interacts with other “LastDir” variables, which are part of an enumeration (ELastDirectory) that includes other file types like UNR, FBX, and various generic operations (import, export, open, save).
Developers should be aware that:
- This variable is used to remember the last directory used for brush-related operations, improving user experience by maintaining context between sessions.
- It’s part of a larger system of remembering last-used directories for various file types and operations in the editor.
- Changes to this variable are persisted between editor sessions via configuration files.
Best practices when using this variable include:
- Respect the user’s last used directory when opening dialogs for brush operations.
- Update the variable appropriately when the user selects a new directory for brush operations.
- Use the provided FEditorDirectories functions for loading and saving these directory settings, rather than directly manipulating the configuration files.
- Be consistent in using this variable across all brush-related operations in the editor to maintain a coherent user experience.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorDirectories.cpp:32
Scope (from outer to inner):
file
function void FEditorDirectories::LoadLastDirectories
Source code excerpt:
// NOTE: We append a "2" to the section name to enforce backwards compatibility. "Directories" is deprecated.
GConfig->GetString( *ConfigSectionName, TEXT("UNR"), LastDir[ELastDirectory::UNR], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("BRUSH"), LastDir[ELastDirectory::BRUSH], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("FBX"), LastDir[ELastDirectory::FBX], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("FBXAnim"), LastDir[ELastDirectory::FBX_ANIM], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("GenericImport"), LastDir[ELastDirectory::GENERIC_IMPORT], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("GenericExport"), LastDir[ELastDirectory::GENERIC_EXPORT], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("GenericOpen"), LastDir[ELastDirectory::GENERIC_OPEN], ConfigFile );
GConfig->GetString( *ConfigSectionName, TEXT("GenericSave"), LastDir[ELastDirectory::GENERIC_SAVE], ConfigFile );
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorDirectories.cpp:85
Scope (from outer to inner):
file
function void FEditorDirectories::SaveLastDirectories
Source code excerpt:
// Save out default file directories
GConfig->SetString( *ConfigSectionName, TEXT("UNR"), *LastDir[ELastDirectory::UNR], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("BRUSH"), *LastDir[ELastDirectory::BRUSH], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("FBX"), *LastDir[ELastDirectory::FBX], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("FBXAnim"), *LastDir[ELastDirectory::FBX_ANIM], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("GenericImport"), *LastDir[ELastDirectory::GENERIC_IMPORT], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("GenericExport"), *LastDir[ELastDirectory::GENERIC_EXPORT], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("GenericOpen"), *LastDir[ELastDirectory::GENERIC_OPEN], ConfigFile );
GConfig->SetString( *ConfigSectionName, TEXT("GenericSave"), *LastDir[ELastDirectory::GENERIC_SAVE], ConfigFile );
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:527
Scope (from outer to inner):
file
function bool UEditorEngine::Exec_StaticMesh
Source code excerpt:
if(FParse::Command(&Str,TEXT("TO")))
{
if(FParse::Command(&Str,TEXT("BRUSH")))
{
const FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "StaticMeshToBrush", "StaticMesh to Brush") );
WorldBrush->Brush->Modify(false);
// Find the first selected static mesh actor.
AStaticMeshActor* SelectedActor = NULL;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:4277
Scope (from outer to inner):
file
function bool UEditorEngine::Exec_Poly
Source code excerpt:
ExecuteCommandForAllLevelModels( InWorld, SelectCommand, NSLOCTEXT("UnrealEd", "SelectMatchingItems", "Select Matching Items") );
}
else if (FParse::Command(&Str,TEXT("BRUSH")))
{
FSelectCommand SelectCommand = FSelectCommand::CreateUObject(this, &UEditorEngine::polySelectMatchingBrush);
ExecuteCommandForAllLevelModels( InWorld, SelectCommand, NSLOCTEXT("UnrealEd", "SelectMatchingBrush", "Select Matching Brush") );
}
else if (FParse::Command(&Str,TEXT("TEXTURE")))
{
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:5594
Scope (from outer to inner):
file
function bool UEditorEngine::Exec_Editor
Source code excerpt:
// BRUSH
//
else if( FParse::Command(&Str,TEXT("BRUSH")) )
{
if( Exec_Brush( InWorld, Str, Ar ) )
{
return true;
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:6085
Scope (from outer to inner):
file
function bool UEditorEngine::HandleMapCommand
Source code excerpt:
return Map_Select( InWorld, Str, Ar );
}
else if( FParse::Command(&Str,TEXT("BRUSH")) )
{
return Map_Brush( InWorld, Str, Ar );
}
else if (FParse::Command(&Str,TEXT("SENDTO")))
{
return Map_Sendto( InWorld, Str, Ar );
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:2378
Scope: file
Source code excerpt:
{
UClass* Class;
if( FParse::Command(&Str, TEXT("BRUSH")) ) // ACTOR REPLACE BRUSH
{
const FScopedTransaction Transaction( NSLOCTEXT("UnrealEd", "ReplaceSelectedBrushActors", "Replace Selected Brush Actors") );
edactReplaceSelectedBrush( InWorld );
return true;
}
else if( ParseObject<UClass>( Str, TEXT("CLASS="), Class, nullptr ) ) // ACTOR REPLACE CLASS=<class>
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/EditorDirectories.h:11
Scope (from outer to inner):
file
namespace ELastDirectory
Source code excerpt:
{
UNR,
BRUSH,
FBX,
FBX_ANIM,
GENERIC_IMPORT,
GENERIC_EXPORT,
GENERIC_OPEN,
GENERIC_SAVE,