You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- New UInteractiveToolCameraFocusAPI UInterface defines functions a Tool can implement to publish its ability to provide a focus-box and focus-point - ModelingMode uses this API to customize behavior. Box-focus (f hotkey) will now always focus on Tool-provided focus-box if available. Point-focus (c hotkey) will focus on nearer of world-hit and Tool focus-point. - Default implementations for PrimitiveComponentToolTarget in SingleSelectionTool and MultiSelectionTool - Custom focus-box implementations for PolyEdit-derived and TriSelect-derived tools, to focus on active selection if available - Custom focus-point implementations for MeshSurfacePointTool #rnx #jira none [CL 16246252 by Ryan Schmidt in ue5-main branch]
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SingleSelectionTool.h"
|
|
#include "InteractiveToolManager.h"
|
|
#include "ToolTargets/PrimitiveComponentToolTarget.h"
|
|
#include "Components/PrimitiveComponent.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "USingleSelectionTool"
|
|
|
|
bool USingleSelectionTool::SupportsWorldSpaceFocusBox()
|
|
{
|
|
return Target && Cast<UPrimitiveComponentToolTarget>(Target) != nullptr;
|
|
}
|
|
|
|
|
|
FBox USingleSelectionTool::GetWorldSpaceFocusBox()
|
|
{
|
|
if (Target)
|
|
{
|
|
UPrimitiveComponentToolTarget* PrimTarget = Cast<UPrimitiveComponentToolTarget>(Target);
|
|
if (PrimTarget)
|
|
{
|
|
UPrimitiveComponent* Component = PrimTarget->GetOwnerComponent();
|
|
if (Component)
|
|
{
|
|
return Component->Bounds.GetBox();
|
|
}
|
|
}
|
|
}
|
|
return FBox();
|
|
}
|
|
|
|
|
|
bool USingleSelectionTool::SupportsWorldSpaceFocusPoint()
|
|
{
|
|
return Target && Cast<UPrimitiveComponentToolTarget>(Target) != nullptr;
|
|
|
|
}
|
|
bool USingleSelectionTool::GetWorldSpaceFocusPoint(const FRay& WorldRay, FVector& PointOut)
|
|
{
|
|
if (Target)
|
|
{
|
|
UPrimitiveComponentToolTarget* PrimTarget = Cast<UPrimitiveComponentToolTarget>(Target);
|
|
if (PrimTarget)
|
|
{
|
|
FHitResult HitResult;
|
|
if (PrimTarget->HitTestComponent(WorldRay, HitResult))
|
|
{
|
|
PointOut = HitResult.ImpactPoint;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE |