2022-01-24 11:36:13 -05:00
|
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "ComponentVisualizer.h"
|
|
|
|
|
|
|
|
|
|
|
|
class USmartObjectComponent;
|
2022-11-01 15:11:25 -04:00
|
|
|
|
class USmartObjectDefinition;
|
|
|
|
|
|
class USmartObjectAssetEditorTool;
|
2023-03-02 05:58:30 -05:00
|
|
|
|
class USmartObjectSubsystem;
|
2022-11-01 15:11:25 -04:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Hit proxy for Smart Object slots.
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct SMARTOBJECTSEDITORMODULE_API HSmartObjectSlotProxy : public HComponentVisProxy
|
|
|
|
|
|
{
|
|
|
|
|
|
DECLARE_HIT_PROXY();
|
|
|
|
|
|
|
2023-01-18 06:27:31 -05:00
|
|
|
|
HSmartObjectSlotProxy(const UActorComponent* InComponent, const FGuid InSlotID, const int32 InAnnotationIndex = INDEX_NONE)
|
2022-11-01 15:11:25 -04:00
|
|
|
|
: HComponentVisProxy(InComponent, HPP_Foreground)
|
|
|
|
|
|
, SlotID(InSlotID)
|
2023-01-18 06:27:31 -05:00
|
|
|
|
, AnnotationIndex(InAnnotationIndex)
|
2022-11-01 15:11:25 -04:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
virtual EMouseCursor::Type GetMouseCursor() override
|
|
|
|
|
|
{
|
|
|
|
|
|
return EMouseCursor::CardinalCross;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FGuid SlotID;
|
2023-01-18 06:27:31 -05:00
|
|
|
|
int32 AnnotationIndex = INDEX_NONE;
|
2022-11-01 15:11:25 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Helper functions to draw Smart Object definition visualization.
|
|
|
|
|
|
*/
|
|
|
|
|
|
namespace UE::SmartObjects::Editor
|
|
|
|
|
|
{
|
2023-01-18 06:27:31 -05:00
|
|
|
|
// @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.
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2023-03-14 06:26:29 -04:00
|
|
|
|
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);
|
2022-11-01 15:11:25 -04:00
|
|
|
|
}; // UE::SmartObjects::Editor
|
|
|
|
|
|
|
2022-01-24 11:36:13 -05:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Visualizer for SmartObjectComponent
|
|
|
|
|
|
*/
|
|
|
|
|
|
class SMARTOBJECTSEDITORMODULE_API FSmartObjectComponentVisualizer : public FComponentVisualizer
|
|
|
|
|
|
{
|
|
|
|
|
|
protected:
|
|
|
|
|
|
virtual void DrawVisualization(const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI) override;
|
2022-11-01 15:11:25 -04:00
|
|
|
|
virtual void DrawVisualizationHUD(const UActorComponent* Component, const FViewport* Viewport, const FSceneView* View, FCanvas* Canvas) override;
|
2022-01-24 11:36:13 -05:00
|
|
|
|
};
|