Drawing API

instant3Dhub: Drawing API
instant3Dhub

Detailed Description

Drawings are freeform 2D or 3D markups that are stored in the session.

In addition to this API the Instant3DHubDrawings module provides many tools to help you build a first-class drawing experience in Unreal. See AI3DHDrawingEditor for more information.

Classes

class  FI3DHDrawingAPI
 

Functions

UMaterialInterfaceAI3DHConnector::GetDrawingMaterial (FLinearColor Color)
 
class AI3DHDrawingAI3DHConnector::FindDrawingActor (int32 DrawingHandle)
 
void AI3DHConnector::SetClipDrawingsByClipPlane (const bool bClipDrawingsByClipPlaneEnabled)
 
bool AI3DHConnector::GetClipDrawingsByClipPlane ()
 
void FI3DHDrawingAPI::CreateDrawing (FI3DHDrawingResult DrawingResult, const FI3DHDrawingProperties &Properties, TUniqueFunction< void(int32 DrawingHandle, EI3DHErrorCode ErrorCode)> OnComplete)
 
virtual void FI3DHDrawingAPI::CreateDrawing (FI3DHDrawingResult DrawingResult, const FI3DHDrawingProperties &Properties, TSubclassOf< class AI3DHDrawing > OverrideDrawingClass, TUniqueFunction< void(int32 DrawingHandle, EI3DHErrorCode ErrorCode)> OnComplete)=0
 
virtual void FI3DHDrawingAPI::RemoveDrawing (int32 DrawingHandle, TUniqueFunction< void(EI3DHRemoveState RemoveState, EI3DHErrorCode ErrorCode)> OnComplete)=0
 
virtual void FI3DHDrawingAPI::ChangeDrawing (int32 DrawingHandle, const FI3DHDrawingProperties &Properties, TUniqueFunction< void(const FI3DHDrawingProperties &Properties, EI3DHErrorCode ErrorCode)> OnComplete)=0
 
virtual void FI3DHDrawingAPI::GetDrawings (TUniqueFunction< void(TArray< int32 > Drawings, EI3DHErrorCode ErrorCode)> OnComplete)=0
 
virtual void FI3DHDrawingAPI::RequestDrawingData (int32 DrawingHandle, bool bSkipDrawingResultParsing, TUniqueFunction< void(FI3DHDrawingData DrawingData, EI3DHErrorCode ErrorCode)> OnComplete)=0
 

Variables

TObjectPtr< UMaterialInterfaceAI3DHConnector::DrawingBaseMaterial {nullptr}
 
TObjectPtr< class UStaticMeshAI3DHConnector::DrawingSegmentMesh {nullptr}
 
TObjectPtr< class UStaticMeshAI3DHConnector::DrawingJointMesh {nullptr}
 

Function Documentation

◆ ChangeDrawing()

virtual void FI3DHDrawingAPI::ChangeDrawing ( int32 DrawingHandle,
const FI3DHDrawingProperties & Properties,
TUniqueFunction< void(const FI3DHDrawingProperties &Properties, EI3DHErrorCode ErrorCode)> OnComplete )
pure virtual

Change the properties of a drawing.

Parameters
DrawingHandleHandle of the drawing.
PropertiesThe properties.
OnCompleteCallback called on completion:

◆ CreateDrawing() [1/2]

virtual void FI3DHDrawingAPI::CreateDrawing ( FI3DHDrawingResult DrawingResult,
const FI3DHDrawingProperties & Properties,
TSubclassOf< class AI3DHDrawing > OverrideDrawingClass,
TUniqueFunction< void(int32 DrawingHandle, EI3DHErrorCode ErrorCode)> OnComplete )
pure virtual

Creates a drawing in the instant3Dhub session and spawns an Actor of provided OverrideDrawingClass if successful.

Parameters
DrawingResultThe drawing result containing the drawing geometry.
PropertiesThe drawing properties.
OverrideDrawingClassA subclass of AI3DHDrawing to use when spawning the Drawing Actor.
OnCompleteCallback called on completion with the following arguments.

◆ CreateDrawing() [2/2]

void FI3DHDrawingAPI::CreateDrawing ( FI3DHDrawingResult DrawingResult,
const FI3DHDrawingProperties & Properties,
TUniqueFunction< void(int32 DrawingHandle, EI3DHErrorCode ErrorCode)> OnComplete )
inline

Creates a drawing in the instant3Dhub session and spawns an Actor of type AI3DHDrawing if successful.

Parameters
DrawingResultThe drawing result containing the drawing geometry.
PropertiesThe drawing properties.
OnCompleteCallback called on completion:

◆ FindDrawingActor()

class AI3DHDrawing * AI3DHConnector::FindDrawingActor ( int32 DrawingHandle)

Search the Drawing Actor for the provided DrawingHandle.

Note
Must be called from the game thread.
Parameters
DrawingHandleHandle of the drawing.
Returns
Nullptr if it fails, else the found drawing actor.

◆ GetClipDrawingsByClipPlane()

bool AI3DHConnector::GetClipDrawingsByClipPlane ( )

Whether Drawings are clipped by ClipPlanes.

Note
This only applies to Unreal Engine and is not synced with the instant3Dhub Session.
Returns
True if drawings are clipped by ClipPlanes, false if not.

◆ GetDrawingMaterial()

UMaterialInterface * AI3DHConnector::GetDrawingMaterial ( FLinearColor Color)

Returns a new Dynamic Material Instance of the AI3DHConnector::DrawingBaseMaterial with the specified color.

Note
Must be called from the game thread.
Parameters
ColorColor of the Drawing.
Returns
The drawing material.

◆ GetDrawings()

virtual void FI3DHDrawingAPI::GetDrawings ( TUniqueFunction< void(TArray< int32 > Drawings, EI3DHErrorCode ErrorCode)> OnComplete)
pure virtual

Gets a list of all drawing handles.

Parameters
OnCompleteCallback called on completion:

◆ RemoveDrawing()

virtual void FI3DHDrawingAPI::RemoveDrawing ( int32 DrawingHandle,
TUniqueFunction< void(EI3DHRemoveState RemoveState, EI3DHErrorCode ErrorCode)> OnComplete )
pure virtual

Removes a drawing matching the specified drawing handle.

Parameters
DrawingHandleHandle of the drawing.
OnCompleteCallback called on completion.

◆ RequestDrawingData()

virtual void FI3DHDrawingAPI::RequestDrawingData ( int32 DrawingHandle,
bool bSkipDrawingResultParsing,
TUniqueFunction< void(FI3DHDrawingData DrawingData, EI3DHErrorCode ErrorCode)> OnComplete )
pure virtual

Request the drawing data of a specified Drawing.

Parameters
DrawingHandleHandle of the drawing.
bSkipDrawingResultParsingTrue to skip drawing result parsing. In this case the result only contains the Drawing Properties.
OnCompleteCallback called on completion:

◆ SetClipDrawingsByClipPlane()

void AI3DHConnector::SetClipDrawingsByClipPlane ( const bool bClipDrawingsByClipPlaneEnabled)

Use to globally control whether Drawings are clipped by ClipPlanes.

Note
This only applies to Unreal Engine and is not synced with the instant3Dhub Session.
Parameters
bClipDrawingsByClipPlaneEnabledTrue to enable drawings being clipped by ClipPlanes, false to disable it.

Variable Documentation

◆ DrawingBaseMaterial

TObjectPtr<UMaterialInterface> AI3DHConnector::DrawingBaseMaterial {nullptr}

Default material to render drawings.

Requires a specific layout and parameters to support correct rendering of drawings.

  • DrawingColor Vector parameter to set the color of the drawing.
  • bIsHovered Scalar parameter (0.f for false, 1.f for true) to display the hovered state of the drawing.
    Note
    Use the material delivered with the plugin or at least copy it for support.

◆ DrawingJointMesh

TObjectPtr<class UStaticMesh> AI3DHConnector::DrawingJointMesh {nullptr}

Mesh used to render joints of LineStrip drawings.

Note
Should have simple colliders for performance reasons.
Important
Must be a sphere with 1cm diameter to match the visualization in the 3DSpace.

◆ DrawingSegmentMesh

TObjectPtr<class UStaticMesh> AI3DHConnector::DrawingSegmentMesh {nullptr}

Mesh used to render a line segment in LineStrip drawings.

Note
Should have simple colliders for performance reasons.
Important
Must be a cylinder with 1cm diameter and pivot at base of Up-Axis to match the visualization in the 3DSpace.