Files
UnrealEngineUWP/Engine/Source/Editor/ActorPickerMode/Private/ActorPickerMode.cpp
Andrew Rodham ba3528c9d4 Made it possible for asset editors to maintain their own FEditorModeTools lists
Breaking changes include:
    * Rename of GEditorModeTools -> GLevelEditorModeTools to signify that it applies only to the level editor modes
    * Addition of FEditorModeRegistry, responsible for managing and creating new editor modes. Modes are no longer registered with an instance of the mode, instead with a mode factory that is able to create a new mode of that type.
    * Editor modes now operate on FEditorViewportClients rather than FLevelEditorViewportClients
    * Added ability to specify an FEditorModeTools when creating an FEditorViewport

Moved component vizualiser manager handling outside of individual editor modes, and into FLevelEditorViewportClient. This should make it easier to transplant in future.

This work addresses TTP#334640 - EDITOR: Investigate making editor modes a per-'editor' concept

Reviewed by Michael Noland, Matt Kuhlenschmidt

[CL 2109245 by Andrew Rodham in Main branch]
2014-06-18 10:16:16 -04:00

41 lines
1.3 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "ActorPickerModePrivatePCH.h"
IMPLEMENT_MODULE( FActorPickerModeModule, ActorPickerMode );
void FActorPickerModeModule::StartupModule()
{
FEditorModeRegistry::Get().RegisterMode<FEdModeActorPicker>(FBuiltinEditorModes::EM_ActorPicker);
}
void FActorPickerModeModule::ShutdownModule()
{
FEditorModeRegistry::Get().UnregisterMode(FBuiltinEditorModes::EM_ActorPicker);
}
void FActorPickerModeModule::BeginActorPickingMode(FOnGetAllowedClasses InOnGetAllowedClasses, FOnShouldFilterActor InOnShouldFilterActor, FOnActorSelected InOnActorSelected)
{
// Activate the mode
GLevelEditorModeTools().ActivateMode(FBuiltinEditorModes::EM_ActorPicker);
// Set the required delegates
FEdModeActorPicker* Mode = GLevelEditorModeTools().GetActiveModeTyped<FEdModeActorPicker>(FBuiltinEditorModes::EM_ActorPicker);
if (ensure(Mode))
{
Mode->OnActorSelected = InOnActorSelected;
Mode->OnGetAllowedClasses = InOnGetAllowedClasses;
Mode->OnShouldFilterActor = InOnShouldFilterActor;
}
}
void FActorPickerModeModule::EndActorPickingMode()
{
GLevelEditorModeTools().DeactivateMode(FBuiltinEditorModes::EM_ActorPicker);
}
bool FActorPickerModeModule::IsInActorPickingMode() const
{
return GLevelEditorModeTools().IsModeActive(FBuiltinEditorModes::EM_ActorPicker);
}