DELETE

DELETE

#Overview

name: DELETE

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

It is referenced in 11 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of DELETE is to provide a command for deleting selected objects or actors in the Unreal Engine editor. This setting variable is primarily used in the context of the Level Editor and Object Mixer functionalities.

Based on the provided callsites, the DELETE command is utilized by the following Unreal Engine subsystems, plugins, and modules:

  1. Object Mixer Plugin
  2. Level Editor
  3. Scene Outliner
  4. VR Editor
  5. UnrealEd (Editor functionality)

The value of this variable is not set directly as a variable, but rather used as a command string in various parts of the editor code. It is typically invoked through the GUnrealEd->Exec() function or mapped to editor commands and actions.

Other variables that interact with DELETE include:

  1. FGenericCommands::Get().Delete (for mapping actions)
  2. FLevelEditorActionCallbacks::Delete_CanExecute (to check if deletion is possible)

Developers must be aware of the following when using the DELETE command:

  1. It is context-sensitive and may behave differently depending on the current editor mode or selected objects.
  2. The command is often tied to user interface actions, such as key presses or menu selections.
  3. It may have different implementations in various parts of the editor (e.g., Level Editor vs. Object Mixer).

Best practices when using the DELETE command include:

  1. Always check if the deletion can be executed using the appropriate CanExecute function before attempting to delete objects.
  2. Consider implementing undo functionality for delete operations to allow users to recover from accidental deletions.
  3. Ensure that deletion is properly handled in custom editor modes or tools that interact with scene objects.
  4. Be cautious when using the command programmatically, as it may have unintended consequences if not used in the appropriate context.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/ObjectMixer/ObjectMixer/Source/ObjectMixer/Private/Views/List/Modes/ObjectMixerOutlinerMode.cpp:1965

Scope (from outer to inner):

file
function     FReply FObjectMixerOutlinerMode::OnKeyDown

Source code excerpt:

			if (RepresentingWorld.IsValid())
			{
				GUnrealEd->Exec(RepresentingWorld.Get(), TEXT("DELETE"));
			}
		}
		return FReply::Handled();

	}

#Loc: <Workspace>/Engine/Plugins/Editor/ObjectMixer/ObjectMixer/Source/ObjectMixer/Private/Views/List/ObjectMixerEditorList.cpp:44

Scope (from outer to inner):

file
function     void FObjectMixerEditorList::RegisterAndMapContextMenuCommands

Source code excerpt:

	);
	ObjectMixerElementEditCommands->MapAction(FGenericCommands::Get().Delete,
		FExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::ExecuteExecCommand, FString( TEXT("DELETE") ) ),
		FCanExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::Delete_CanExecute )
	);
	ObjectMixerElementEditCommands->MapAction(FGenericCommands::Get().Rename,
		FUIAction(FExecuteAction::CreateRaw(this, &FObjectMixerEditorList::OnRenameCommand))
	);
}

void FObjectMixerEditorList::RebuildCollectionSelector()
{

#Loc: <Workspace>/Engine/Source/Developer/DesktopPlatform/Private/LockFile.cpp:28

Scope (from outer to inner):

file
function     bool FLockFile::TryReadAndClear

Source code excerpt:

	OutContents.Reset();
#if PLATFORM_WINDOWS
	uint32 Access = GENERIC_READ | DELETE;
	uint32 WinFlags = 0; // Exclusive access
	uint32 Disposition = OPEN_EXISTING;

	TStringBuilder<MAX_PATH> FullFileNameBuilder;
	FPathViews::ToAbsolutePath(FStringView(FileName), FullFileNameBuilder);
	for (TCHAR& Char : MakeArrayView(FullFileNameBuilder))

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditor.cpp:785

Scope (from outer to inner):

file
function     void FLevelEditorModule::BindGlobalLevelEditorCommands

Source code excerpt:

	ActionList.MapAction( 
		FGenericCommands::Get().Delete, 
		FExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::ExecuteExecCommand, FString( TEXT("DELETE") ) ),
		FCanExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::Delete_CanExecute )
		);

	ActionList.MapAction( 
		FGenericCommands::Get().Rename, 
		FExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::Rename_Execute ),
		FCanExecuteAction::CreateStatic( &FLevelEditorActionCallbacks::Rename_CanExecute )
		);

	ActionList.MapAction( 

#Loc: <Workspace>/Engine/Source/Editor/SceneOutliner/Private/ActorBrowsingMode.cpp:1292

Scope (from outer to inner):

file
function     FReply FActorBrowsingMode::OnKeyDown

Source code excerpt:

			if (RepresentingWorld.IsValid())
			{
				GUnrealEd->Exec(RepresentingWorld.Get(), TEXT("DELETE"));
			}
		}
		return FReply::Handled();

	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorServer.cpp:5635

Scope: file

Source code excerpt:

	// DELETE: Rerouted to mode-specific command
	//
	else if (FParse::Command(&Str,TEXT("DELETE")))
	{
		return HandleDeleteCommand( Str, Ar, InWorld );
	}
	//------------------------------------------------------------------------------------
	// DUPLICATE: Rerouted to mode-specific command
	//

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/UnrealEdSrv.cpp:2570

Scope: file

Source code excerpt:

		}
	}
	else if( FParse::Command(&Str,TEXT("DELETE")) )		// ACTOR SELECT DELETE
	{
		if (GCurrentLevelEditingViewportClient)
		{
			if (TSharedPtr<ILevelEditor> LevelEditor = GCurrentLevelEditingViewportClient->ParentLevelEditor.Pin())
			{
				if (UTypedElementCommonActions* CommonActions = LevelEditor->GetCommonActions())

#Loc: <Workspace>/Engine/Source/Editor/VREditor/Private/UI/VRRadialMenuHandler.cpp:448

Scope (from outer to inner):

file
function     void UVRRadialMenuHandler::EditMenuGenerator

Source code excerpt:

		FUIAction
		(
			FExecuteAction::CreateStatic(&FLevelEditorActionCallbacks::ExecuteExecCommand, FString(TEXT("DELETE"))),
			FCanExecuteAction::CreateStatic(&FLevelEditorActionCallbacks::Delete_CanExecute)
		)
	);
	MenuBuilder.AddMenuEntry(
		LOCTEXT("Cut", "Cut"),
		FText(),
		FSlateIcon(FVREditorStyle::GetStyleSetName(), "VREditorStyle.Cut"),
		FUIAction
		(
			FExecuteAction::CreateStatic(&FLevelEditorActionCallbacks::ExecuteExecCommand, FString(TEXT("EDIT CUT"))),
			FCanExecuteAction::CreateStatic(&FLevelEditorActionCallbacks::Cut_CanExecute)
		)
	);
	MenuBuilder.AddMenuEntry(
		LOCTEXT("Copy", "Copy"),

#Loc: <Workspace>/Engine/Source/Programs/UnrealBuildAccelerator/Common/Private/UbaFileAccessor.cpp:68

Scope (from outer to inner):

file
namespace    uba
function     bool FileAccessor::CreateWrite

Source code excerpt:


		u32 createDisp = CREATE_ALWAYS;
		u32 dwDesiredAccess = GENERIC_WRITE | DELETE;
		if (allowRead)
			dwDesiredAccess |= GENERIC_READ;
		u32 dwShareMode = 0;// FILE_SHARE_READ | FILE_SHARE_WRITE;
		u32 retryCount = 0;
		StringBuffer<256> additionalInfo;
		while (true)

#Loc: <Workspace>/Engine/Source/Programs/UnrealBuildAccelerator/Common/Public/UbaFile.h:20

Scope (from outer to inner):

file
namespace    uba

Source code excerpt:

	inline constexpr u32 CREATE_ALWAYS = 2;
	inline constexpr u32 GENERIC_WRITE = 0x40000000L;
	inline constexpr u32 DELETE = 0x00010000L;
	inline constexpr u32 GENERIC_READ = 0x80000000L;
	inline constexpr u32 FILE_SHARE_WRITE = 0x00000002;
	inline constexpr u32 FILE_SHARE_READ = 0x00000001;
	inline constexpr u32 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
	inline constexpr u32 OPEN_EXISTING = 3;
	inline constexpr u32 PAGE_READONLY = 0x02;

#Loc: <Workspace>/Engine/Source/Programs/WebTests/Private/TestHttp.cpp:362

Scope: file

Source code excerpt:

	SECTION("DELETE")
	{
		HttpRequest->SetVerb(TEXT("DELETE"));
	}

	HttpRequest->OnProcessRequestComplete().BindLambda([](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse, bool bSucceeded) {
		CHECK(bSucceeded);
		REQUIRE(HttpResponse != nullptr);
		CHECK(HttpResponse->GetResponseCode() == 200);