UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FToolDataVisualizer Class Reference

#include <ToolDataVisualizer.h>

Public Member Functions

INTERACTIVETOOLSFRAMEWORK_API FToolDataVisualizer ()
 
INTERACTIVETOOLSFRAMEWORK_API FToolDataVisualizer (const FToolDataVisualizer &)
 
virtual INTERACTIVETOOLSFRAMEWORK_API ~FToolDataVisualizer ()
 
INTERACTIVETOOLSFRAMEWORK_API void BeginFrame (IToolsContextRenderAPI *RenderAPI, const FViewCameraState &CameraState)
 
INTERACTIVETOOLSFRAMEWORK_API void BeginFrame (IToolsContextRenderAPI *RenderAPI)
 
INTERACTIVETOOLSFRAMEWORK_API void EndFrame ()
 
INTERACTIVETOOLSFRAMEWORK_API void SetTransform (const FTransform &Transform)
 
INTERACTIVETOOLSFRAMEWORK_API void PushTransform (const FTransform &Transform)
 
INTERACTIVETOOLSFRAMEWORK_API void PopTransform ()
 
INTERACTIVETOOLSFRAMEWORK_API void PopAllTransforms ()
 
FVector TransformP (const FVector &Point)
 
FVector TransformV (const FVector &Vector)
 
FVector TransformN (const FVector &Normal)
 
void SetLineParameters (const FLinearColor &Color, float Thickness, float InArrowHeadSize=4.0f)
 
void SetPointParameters (const FLinearColor &Color, float Size)
 
template<typename PointType >
void DrawLine (const PointType &A, const PointType &B)
 
template<typename PointType >
void DrawLine (const PointType &A, const PointType &B, const FLinearColor &Color)
 
template<typename PointType >
void DrawLine (const PointType &A, const PointType &B, const FLinearColor &Color, float LineThicknessIn)
 
template<typename PointType >
void DrawLine (const PointType &A, const PointType &B, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawDirectionalArrow (const PointType &A, const PointType &B, const FVector &InNormal)
 
template<typename PointType >
void DrawDirectionalArrow (const PointType &A, const PointType &B, const FVector &InNormal, const FLinearColor &Color)
 
template<typename PointType >
void DrawDirectionalArrow (const PointType &A, const PointType &B, const FVector &InNormal, const FLinearColor &Color, float InArrowHeadSize, float LineThicknessIn)
 
template<typename PointType >
void DrawDirectionalArrow (const PointType &A, const PointType &B, const FVector &InNormal, const FLinearColor &Color, float InArrowHeadSize, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawPoint (const PointType &Position)
 
template<typename PointType >
void DrawPoint (const PointType &Position, const FLinearColor &Color)
 
template<typename PointType >
void DrawPoint (const PointType &Position, const FLinearColor &Color, float PointSizeIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawCircle (const PointType &Position, const PointType &Normal, float Radius, int Steps, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawViewFacingCircle (const PointType &Position, float Radius, int Steps, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawArc (const PointType &Position, const PointType &Normal, float Radius, int Steps, float MinAngle, float MaxAngle, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawViewFacingArc (const PointType &Position, float Radius, int Steps, float MinAngle, float MaxAngle, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawViewFacingX (const PointType &Position, float Width)
 
template<typename PointType >
void DrawViewFacingX (const PointType &Position, float Width, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawWireCylinder (const PointType &Position, const PointType &Normal, float Radius, float Height, int Steps, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawWireCylinder (const PointType &Position, const PointType &Normal, float Radius, float Height, int Steps)
 
void DrawWireBox (const FBox &Box)
 
void DrawWireBox (const FBox &Box, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawSquare (const PointType &Center, const PointType &SideA, const PointType &SideB, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawSquare (const PointType &Center, const PointType &SideA, const PointType &SideB)
 
template<typename PointType >
void DrawGrid (const PointType &Center, const PointType &Normal, const PointType &Size, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawGrid (const PointType &Center, const PointType &Normal, const PointType &Up, const PointType &Side, const PointType &Size, const FLinearColor &Color, float LineThicknessIn, bool bDepthTestedIn)
 
template<typename PointType >
void DrawDisc (const PointType &Position, const PointType &Normal, float Radius, int Steps, const FColor &Color, FMaterialRenderProxy *RenderProxy, bool bDepthTestedIn)
 

Public Attributes

FLinearColor LineColor
 
float LineThickness = 1.0f
 
float ArrowHeadSize = 4.0f
 
FLinearColor PointColor
 
float PointSize = 1.0f
 
float DepthBias = 0.0f
 
bool bDepthTested = true
 

Protected Member Functions

virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawTransformedLine (const FVector &A, const FVector &B, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawDirectionalArrow (const FVector &A, const FVector &B, const FVector &InNormal, const FLinearColor &Color, const float InHeadSize, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawTransformedPoint (const FVector &Position, const FLinearColor &Color, float PointSize, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawCircle (const FVector &Position, const FVector &Normal, float Radius, int Steps, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawViewFacingCircle (const FVector &Position, float Radius, int Steps, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawArc (const FVector &InPosition, const FVector &InNormal, const float InRadius, int32 InSteps, const float InMinAngle, const float InMaxAngle, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawViewFacingArc (const FVector &InPosition, float InRadius, int32 InSteps, const float InMinAngle, const float InMaxAngle, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawWireCylinder (const FVector &Position, const FVector &Normal, float Radius, float Height, int Steps, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawWireBox (const FBox &Box, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawSquare (const FVector &Center, const FVector &SideA, const FVector &SideB, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawGrid (const FVector &Center, const FVector &Normal, const FVector &Size, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawGrid (const FVector &Center, const FVector &Normal, const FVector &Up, const FVector &Side, const FVector &Size, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawViewFacingX (const FVector &Position, float Width, const FLinearColor &Color, float LineThickness, bool bDepthTested)
 
virtual INTERACTIVETOOLSFRAMEWORK_API void InternalDrawDisc (const FVector &Position, const FVector &Normal, float Radius, int Steps, const FColor &Color, FMaterialRenderProxy *RenderProxy, bool bDepthTested)
 

Protected Attributes

FPrimitiveDrawInterfaceCurrentPDI = nullptr
 
FViewCameraState CameraState
 
bool bHaveCameraState
 
float PDISizeScale = 1.0
 
TArray< FTransformTransformStack
 
FTransform TotalTransform
 

Detailed Description

FToolDataVisualizer is a utility class for Tool and Gizmo implementations to use to draw 3D lines, points, etc.

Currently uses PDI drawing but may use different back-ends in the future

Constructor & Destructor Documentation

◆ FToolDataVisualizer() [1/2]

FToolDataVisualizer::FToolDataVisualizer ( )

◆ FToolDataVisualizer() [2/2]

FToolDataVisualizer::FToolDataVisualizer ( const FToolDataVisualizer )
default

◆ ~FToolDataVisualizer()

FToolDataVisualizer::~FToolDataVisualizer ( )
virtualdefault

Member Function Documentation

◆ BeginFrame() [1/2]

void FToolDataVisualizer::BeginFrame ( IToolsContextRenderAPI RenderAPI)

This must be called every frame to allow Visualizer to extract necessary rendering data/objects

◆ BeginFrame() [2/2]

void FToolDataVisualizer::BeginFrame ( IToolsContextRenderAPI RenderAPI,
const FViewCameraState CameraState 
)

This must be called every frame to allow Visualizer to extract necessary rendering data/objects

◆ DrawArc()

template<typename PointType >
void FToolDataVisualizer::DrawArc ( const PointType &  Position,
const PointType &  Normal,
float  Radius,
int  Steps,
float  MinAngle,
float  MaxAngle,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a 3D arc at given position/normal with the given parameters. Tangent axes are defined internally

◆ DrawCircle()

template<typename PointType >
void FToolDataVisualizer::DrawCircle ( const PointType &  Position,
const PointType &  Normal,
float  Radius,
int  Steps,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a 3D circle at given position/normal with the given parameters. Tangent axes are defined internally

◆ DrawDirectionalArrow() [1/4]

template<typename PointType >
void FToolDataVisualizer::DrawDirectionalArrow ( const PointType &  A,
const PointType &  B,
const FVector InNormal 
)
inline

Draw an arrow with default parameters

◆ DrawDirectionalArrow() [2/4]

template<typename PointType >
void FToolDataVisualizer::DrawDirectionalArrow ( const PointType &  A,
const PointType &  B,
const FVector InNormal,
const FLinearColor Color 
)
inline

Draw a line with the given Color, otherwise use default parameters

◆ DrawDirectionalArrow() [3/4]

template<typename PointType >
void FToolDataVisualizer::DrawDirectionalArrow ( const PointType &  A,
const PointType &  B,
const FVector InNormal,
const FLinearColor Color,
float  InArrowHeadSize,
float  LineThicknessIn 
)
inline

Draw a line with the given Color and Thickness, otherwise use default parameters

◆ DrawDirectionalArrow() [4/4]

template<typename PointType >
void FToolDataVisualizer::DrawDirectionalArrow ( const PointType &  A,
const PointType &  B,
const FVector InNormal,
const FLinearColor Color,
float  InArrowHeadSize,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a line with the given parameters

◆ DrawDisc()

template<typename PointType >
void FToolDataVisualizer::DrawDisc ( const PointType &  Position,
const PointType &  Normal,
float  Radius,
int  Steps,
const FColor Color,
FMaterialRenderProxy RenderProxy,
bool  bDepthTestedIn 
)
inline

Draw a 3D disc at given position/normal with the given parameters. Tangent axes are defined internally

◆ DrawGrid() [1/2]

template<typename PointType >
void FToolDataVisualizer::DrawGrid ( const PointType &  Center,
const PointType &  Normal,
const PointType &  Size,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

◆ DrawGrid() [2/2]

template<typename PointType >
void FToolDataVisualizer::DrawGrid ( const PointType &  Center,
const PointType &  Normal,
const PointType &  Up,
const PointType &  Side,
const PointType &  Size,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

◆ DrawLine() [1/4]

template<typename PointType >
void FToolDataVisualizer::DrawLine ( const PointType &  A,
const PointType &  B 
)
inline

Draw a line with default parameters

◆ DrawLine() [2/4]

template<typename PointType >
void FToolDataVisualizer::DrawLine ( const PointType &  A,
const PointType &  B,
const FLinearColor Color 
)
inline

Draw a line with the given Color, otherwise use default parameters

◆ DrawLine() [3/4]

template<typename PointType >
void FToolDataVisualizer::DrawLine ( const PointType &  A,
const PointType &  B,
const FLinearColor Color,
float  LineThicknessIn 
)
inline

Draw a line with the given Color and Thickness, otherwise use default parameters

◆ DrawLine() [4/4]

template<typename PointType >
void FToolDataVisualizer::DrawLine ( const PointType &  A,
const PointType &  B,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a line with the given parameters

◆ DrawPoint() [1/3]

template<typename PointType >
void FToolDataVisualizer::DrawPoint ( const PointType &  Position)
inline

Draw a point with default parameters

◆ DrawPoint() [2/3]

template<typename PointType >
void FToolDataVisualizer::DrawPoint ( const PointType &  Position,
const FLinearColor Color 
)
inline

Draw a point with the given Color, otherwise use default parameters

◆ DrawPoint() [3/3]

template<typename PointType >
void FToolDataVisualizer::DrawPoint ( const PointType &  Position,
const FLinearColor Color,
float  PointSizeIn,
bool  bDepthTestedIn 
)
inline

Draw a point with the given parameters

◆ DrawSquare() [1/2]

template<typename PointType >
void FToolDataVisualizer::DrawSquare ( const PointType &  Center,
const PointType &  SideA,
const PointType &  SideB 
)
inline

◆ DrawSquare() [2/2]

template<typename PointType >
void FToolDataVisualizer::DrawSquare ( const PointType &  Center,
const PointType &  SideA,
const PointType &  SideB,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

◆ DrawViewFacingArc()

template<typename PointType >
void FToolDataVisualizer::DrawViewFacingArc ( const PointType &  Position,
float  Radius,
int  Steps,
float  MinAngle,
float  MaxAngle,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a 3D arc at given position/normal with the given parameters. Tangent axes are defined internally

◆ DrawViewFacingCircle()

template<typename PointType >
void FToolDataVisualizer::DrawViewFacingCircle ( const PointType &  Position,
float  Radius,
int  Steps,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a 3D circle at given position/normal with the given parameters. Tangent axes are defined internally

◆ DrawViewFacingX() [1/2]

template<typename PointType >
void FToolDataVisualizer::DrawViewFacingX ( const PointType &  Position,
float  Width 
)
inline

Draw a world-space X facing the viewer at the given position.

◆ DrawViewFacingX() [2/2]

template<typename PointType >
void FToolDataVisualizer::DrawViewFacingX ( const PointType &  Position,
float  Width,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a world-space X facing the viewer at the given position.

◆ DrawWireBox() [1/2]

void FToolDataVisualizer::DrawWireBox ( const FBox Box)
inline

Draw a 3D box, parameterized the same as the 3D circle but extruded by Height

◆ DrawWireBox() [2/2]

void FToolDataVisualizer::DrawWireBox ( const FBox Box,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

◆ DrawWireCylinder() [1/2]

template<typename PointType >
void FToolDataVisualizer::DrawWireCylinder ( const PointType &  Position,
const PointType &  Normal,
float  Radius,
float  Height,
int  Steps 
)
inline

Draw a 3D cylinder, parameterized the same as the 3D circle but extruded by Height

◆ DrawWireCylinder() [2/2]

template<typename PointType >
void FToolDataVisualizer::DrawWireCylinder ( const PointType &  Position,
const PointType &  Normal,
float  Radius,
float  Height,
int  Steps,
const FLinearColor Color,
float  LineThicknessIn,
bool  bDepthTestedIn 
)
inline

Draw a 3D cylinder, parameterized the same as the 3D circle but extruded by Height

◆ EndFrame()

void FToolDataVisualizer::EndFrame ( )

this should be called at the end of every frame to allow for necessary cleanup

◆ InternalDrawArc()

void FToolDataVisualizer::InternalDrawArc ( const FVector InPosition,
const FVector InNormal,
const float  InRadius,
int32  InSteps,
const float  InMinAngle,
const float  InMaxAngle,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawCircle()

void FToolDataVisualizer::InternalDrawCircle ( const FVector Position,
const FVector Normal,
float  Radius,
int  Steps,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawDirectionalArrow()

void FToolDataVisualizer::InternalDrawDirectionalArrow ( const FVector A,
const FVector B,
const FVector InNormal,
const FLinearColor Color,
const float  InHeadSize,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawDisc()

void FToolDataVisualizer::InternalDrawDisc ( const FVector Position,
const FVector Normal,
float  Radius,
int  Steps,
const FColor Color,
FMaterialRenderProxy RenderProxy,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawGrid() [1/2]

void FToolDataVisualizer::InternalDrawGrid ( const FVector Center,
const FVector Normal,
const FVector Size,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawGrid() [2/2]

void FToolDataVisualizer::InternalDrawGrid ( const FVector Center,
const FVector Normal,
const FVector Up,
const FVector Side,
const FVector Size,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawSquare()

void FToolDataVisualizer::InternalDrawSquare ( const FVector Center,
const FVector SideA,
const FVector SideB,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawTransformedLine()

void FToolDataVisualizer::InternalDrawTransformedLine ( const FVector A,
const FVector B,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawTransformedPoint()

void FToolDataVisualizer::InternalDrawTransformedPoint ( const FVector Position,
const FLinearColor Color,
float  PointSize,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawViewFacingArc()

void FToolDataVisualizer::InternalDrawViewFacingArc ( const FVector InPosition,
float  InRadius,
int32  InSteps,
const float  InMinAngle,
const float  InMaxAngle,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawViewFacingCircle()

void FToolDataVisualizer::InternalDrawViewFacingCircle ( const FVector Position,
float  Radius,
int  Steps,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawViewFacingX()

void FToolDataVisualizer::InternalDrawViewFacingX ( const FVector Position,
float  Width,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawWireBox()

void FToolDataVisualizer::InternalDrawWireBox ( const FBox Box,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ InternalDrawWireCylinder()

void FToolDataVisualizer::InternalDrawWireCylinder ( const FVector Position,
const FVector Normal,
float  Radius,
float  Height,
int  Steps,
const FLinearColor Color,
float  LineThickness,
bool  bDepthTested 
)
protectedvirtual

◆ PopAllTransforms()

void FToolDataVisualizer::PopAllTransforms ( )

Clear the transform stack to identity

◆ PopTransform()

void FToolDataVisualizer::PopTransform ( )

Pop a transform from the transform stack

◆ PushTransform()

void FToolDataVisualizer::PushTransform ( const FTransform Transform)

Push a Transform onto the transform stack

◆ SetLineParameters()

void FToolDataVisualizer::SetLineParameters ( const FLinearColor Color,
float  Thickness,
float  InArrowHeadSize = 4.0f 
)
inline

Update the default line color and thickness

◆ SetPointParameters()

void FToolDataVisualizer::SetPointParameters ( const FLinearColor Color,
float  Size 
)
inline

Update the default point color and size

◆ SetTransform()

void FToolDataVisualizer::SetTransform ( const FTransform Transform)

Clear transform stack and push the given Transform

◆ TransformN()

FVector FToolDataVisualizer::TransformN ( const FVector Normal)
inline
Returns
input Normal transformed by transform stack

◆ TransformP()

FVector FToolDataVisualizer::TransformP ( const FVector Point)
inline
Returns
input Point transformed by transform stack

◆ TransformV()

FVector FToolDataVisualizer::TransformV ( const FVector Vector)
inline
Returns
input Vector transformed by transform stack

Member Data Documentation

◆ ArrowHeadSize

float FToolDataVisualizer::ArrowHeadSize = 4.0f

Default size used for drawing arrow heads

◆ bDepthTested

bool FToolDataVisualizer::bDepthTested = true

Should lines be clipped by 3D geometry, or should they be drawn with quasi-transparency

◆ bHaveCameraState

bool FToolDataVisualizer::bHaveCameraState
protected

◆ CameraState

FViewCameraState FToolDataVisualizer::CameraState
protected

◆ CurrentPDI

FPrimitiveDrawInterface* FToolDataVisualizer::CurrentPDI = nullptr
protected

We use this for drawing, extracted in InitializeFrame

◆ DepthBias

float FToolDataVisualizer::DepthBias = 0.0f

Depth bias applied to lines

◆ LineColor

FLinearColor FToolDataVisualizer::LineColor

Default color used for drawing lines

◆ LineThickness

float FToolDataVisualizer::LineThickness = 1.0f

Default thickness used for drawing lines

◆ PDISizeScale

float FToolDataVisualizer::PDISizeScale = 1.0
protected

◆ PointColor

FLinearColor FToolDataVisualizer::PointColor

Default color used for drawing points

◆ PointSize

float FToolDataVisualizer::PointSize = 1.0f

Default size used for drawing points

◆ TotalTransform

FTransform FToolDataVisualizer::TotalTransform
protected

◆ TransformStack

TArray<FTransform> FToolDataVisualizer::TransformStack
protected

The documentation for this class was generated from the following files: