You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb ryan.schmidt michael.balzer #rnx #jira none #preflight 61f435dd74510448a6865d14 #ROBOMERGE-AUTHOR: lonnie.li #ROBOMERGE-SOURCE: CL 18777332 in //UE5/Release-5.0/... via CL 18780413 via CL 18780555 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472) [CL 18780558 by lonnie li in ue5-main branch]
82 lines
2.2 KiB
C++
82 lines
2.2 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "BaseTools/SingleSelectionMeshEditingTool.h"
|
|
|
|
#include "Engine/World.h"
|
|
|
|
#include "TargetInterfaces/MaterialProvider.h"
|
|
#include "TargetInterfaces/MeshDescriptionCommitter.h"
|
|
#include "TargetInterfaces/MeshDescriptionProvider.h"
|
|
#include "TargetInterfaces/PrimitiveComponentBackedTarget.h"
|
|
#include "ToolTargetManager.h"
|
|
#include "Selection/StoredMeshSelectionUtil.h"
|
|
|
|
/*
|
|
* ToolBuilder
|
|
*/
|
|
const FToolTargetTypeRequirements& USingleSelectionMeshEditingToolBuilder::GetTargetRequirements() const
|
|
{
|
|
static FToolTargetTypeRequirements TypeRequirements({
|
|
UMaterialProvider::StaticClass(),
|
|
UMeshDescriptionCommitter::StaticClass(),
|
|
UMeshDescriptionProvider::StaticClass(),
|
|
UPrimitiveComponentBackedTarget::StaticClass()
|
|
});
|
|
return TypeRequirements;
|
|
}
|
|
|
|
bool USingleSelectionMeshEditingToolBuilder::CanBuildTool(const FToolBuilderState& SceneState) const
|
|
{
|
|
return SceneState.TargetManager->CountSelectedAndTargetable(SceneState, GetTargetRequirements()) == 1;
|
|
}
|
|
|
|
UInteractiveTool* USingleSelectionMeshEditingToolBuilder::BuildTool(const FToolBuilderState& SceneState) const
|
|
{
|
|
USingleSelectionMeshEditingTool* NewTool = CreateNewTool(SceneState);
|
|
InitializeNewTool(NewTool, SceneState);
|
|
return NewTool;
|
|
}
|
|
|
|
void USingleSelectionMeshEditingToolBuilder::InitializeNewTool(USingleSelectionMeshEditingTool* NewTool, const FToolBuilderState& SceneState) const
|
|
{
|
|
UToolTarget* Target = SceneState.TargetManager->BuildFirstSelectedTargetable(SceneState, GetTargetRequirements());
|
|
check(Target);
|
|
NewTool->SetTarget(Target);
|
|
NewTool->SetWorld(SceneState.World);
|
|
|
|
if (WantsInputSelectionIfAvailable())
|
|
{
|
|
const UPersistentMeshSelection* InputSelection = UE::Geometry::GetCurrentToolInputSelection(SceneState, Target);
|
|
if (InputSelection != nullptr)
|
|
{
|
|
NewTool->SetInputSelection(InputSelection);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void USingleSelectionMeshEditingTool::Shutdown(EToolShutdownType ShutdownType)
|
|
{
|
|
OnShutdown(ShutdownType);
|
|
TargetWorld = nullptr;
|
|
}
|
|
|
|
void USingleSelectionMeshEditingTool::OnShutdown(EToolShutdownType ShutdownType)
|
|
{
|
|
}
|
|
|
|
|
|
void USingleSelectionMeshEditingTool::SetWorld(UWorld* World)
|
|
{
|
|
TargetWorld = World;
|
|
}
|
|
|
|
UWorld* USingleSelectionMeshEditingTool::GetTargetWorld()
|
|
{
|
|
return TargetWorld.Get();
|
|
}
|
|
|
|
|
|
|
|
|