Files
UnrealEngineUWP/Engine/Source/Editor/Persona/Private/PersonaEditorModeManager.cpp
halfdan ingvarsson f3871a6fb0 Override the component selection in FPersonaEditorModeManager when we set a preview scene in Persona. This allows the tools to pick up the currently editing component from the skelmesh editor.
Note that this is a temporary band-aid until the modeling tools start using the new UContextObjectStore mechanism as means to pass components from editor to the tools context.

#jira UE-93689
#rb ryan.schmidt
#rnx
#preflight 60935bad835be30001b988f5

[CL 16218074 by halfdan ingvarsson in ue5-main branch]
2021-05-05 23:59:17 -04:00

56 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "PersonaEditorModeManager.h"
#include "IPersonaEditMode.h"
#include "IPersonaPreviewScene.h"
#include "Selection.h"
#include "Animation/DebugSkelMeshComponent.h"
bool FPersonaEditorModeManager::GetCameraTarget(FSphere& OutTarget) const
{
for (UEdMode* Mode : ActiveScriptableModes)
{
FEdMode* LegacyMode = Mode->AsLegacyMode();
if (IPersonaEditMode* EditMode = static_cast<IPersonaEditMode*>(LegacyMode))
{
FSphere Target;
if (EditMode->GetCameraTarget(Target))
{
OutTarget = Target;
return true;
}
}
}
return false;
}
void FPersonaEditorModeManager::GetOnScreenDebugInfo(TArray<FText>& OutDebugText) const
{
for (UEdMode* Mode : ActiveScriptableModes)
{
FEdMode* LegacyMode = Mode->AsLegacyMode();
if (IPersonaEditMode* EditMode = static_cast<IPersonaEditMode*>(LegacyMode))
{
EditMode->GetOnScreenDebugInfo(OutDebugText);
}
}
}
void FPersonaEditorModeManager::SetPreviewScene(FPreviewScene* NewPreviewScene)
{
const IPersonaPreviewScene *PersonaPreviewScene = static_cast<const IPersonaPreviewScene *>(NewPreviewScene);
if (PersonaPreviewScene && PersonaPreviewScene->GetPreviewMeshComponent())
{
ComponentSet->BeginBatchSelectOperation();
ComponentSet->DeselectAll();
ComponentSet->Select(PersonaPreviewScene->GetPreviewMeshComponent(), true);
ComponentSet->EndBatchSelectOperation();
}
FAssetEditorModeManager::SetPreviewScene(NewPreviewScene);
}