Files
mikko mononen 1ca6e4407c Smart Objects: Added way to project navigation locations on ground and to check collisions between nav location and slot.
- Changed entry annotation to navigation annotation
- Added option for nav annotations to project location on ground
- Added option and settings for nav annotations to check simple trajectory collisions towards slot location
- Added logic in entry location query to project on ground and check trajectory collisions
- Added physics settings struct that handles common query combinations
- Added USmartObjectSlotValidationFilter to define shareable settings for validation (kinda similar to nav query filter)
- Fixed double rendering of preview actor/mesh in SO editor
- added debug draw for the new features

#jira UE-174418
#preflight 641036e470639dfc943ed981

[CL 24632583 by mikko mononen in ue5-main branch]
2023-03-14 06:26:29 -04:00

73 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ComponentVisualizer.h"
class USmartObjectComponent;
class USmartObjectDefinition;
class USmartObjectAssetEditorTool;
class USmartObjectSubsystem;
/**
* Hit proxy for Smart Object slots.
*/
struct SMARTOBJECTSEDITORMODULE_API HSmartObjectSlotProxy : public HComponentVisProxy
{
DECLARE_HIT_PROXY();
HSmartObjectSlotProxy(const UActorComponent* InComponent, const FGuid InSlotID, const int32 InAnnotationIndex = INDEX_NONE)
: HComponentVisProxy(InComponent, HPP_Foreground)
, SlotID(InSlotID)
, AnnotationIndex(InAnnotationIndex)
{}
virtual EMouseCursor::Type GetMouseCursor() override
{
return EMouseCursor::CardinalCross;
}
FGuid SlotID;
int32 AnnotationIndex = INDEX_NONE;
};
/**
* Helper functions to draw Smart Object definition visualization.
*/
namespace UE::SmartObjects::Editor
{
// @todo: move this to more suitable header.
struct FSelectedItem
{
FSelectedItem() = default;
FSelectedItem(const FGuid InSlotID, const int32 InAnnotationIndex = INDEX_NONE)
: SlotID(InSlotID)
, AnnotationIndex(InAnnotationIndex)
{
}
bool operator==(const FSelectedItem& Other) const
{
return SlotID == Other.SlotID && AnnotationIndex == Other.AnnotationIndex;
}
FGuid SlotID;
int32 AnnotationIndex = INDEX_NONE; // @todo: consider guid for this too.
};
void Draw(const USmartObjectDefinition& Definition, TConstArrayView<FSelectedItem> Selection, const FTransform& OwnerLocalToWorld, const FSceneView& View, FPrimitiveDrawInterface& PDI, const UWorld& World, const AActor* PreviewActor);
void DrawCanvas(const USmartObjectDefinition& Definition, TConstArrayView<FSelectedItem> Selection, const FTransform& OwnerLocalToWorld, const FSceneView& View, FCanvas& Canvas, const UWorld& World, const AActor* PreviewActor);
}; // UE::SmartObjects::Editor
/**
* Visualizer for SmartObjectComponent
*/
class SMARTOBJECTSEDITORMODULE_API FSmartObjectComponentVisualizer : public FComponentVisualizer
{
protected:
virtual void DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI) override;
virtual void DrawVisualizationHUD(const UActorComponent* Component, const FViewport* Viewport, const FSceneView* View, FCanvas* Canvas) override;
};