Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ void ULevelEditorToolBase::DrawSpline(FDummyStruct DrawPrimitivesContext, USplin
LevelViewportPrimitiveDrawingUtils::DrawSpline(GetDrawPrimitivesContext(), SplineComponent, LineColor, DepthPriorityGroup);
}

void ULevelEditorToolBase::DrawCylinder(FDummyStruct DrawPrimitivesContext, const class UMaterialInterface* Material, const FVector& Center, const FRotator& Rotation, float Radius, float HalfHeight, int32 NumSides, EDepthPriorityGroup DepthPriorityGroup, float DepthBias)
{
LevelViewportPrimitiveDrawingUtils::DrawCylinder(GetDrawPrimitivesContext(), Center, Rotation, Material, Radius, HalfHeight, NumSides, DepthPriorityGroup, DepthBias);
}

void ULevelEditorToolBase::DrawWireCylinder(FDummyStruct DrawPrimitivesContext, const FVector& Center, const FRotator& Rotation, float Radius, float HalfHeight, int32 NumSides /*= 16*/, FLinearColor Color /*= FLinearColor::White*/, EDepthPriorityGroup DepthPriorityGroup /*= EDepthPriorityGroup::World*/, float Thickness /*= 0.0f*/, float DepthBias /*= 0.0f*/)
{
LevelViewportPrimitiveDrawingUtils::DrawWireCylinder(GetDrawPrimitivesContext(), Center, Rotation, Color, Radius, HalfHeight, NumSides, DepthPriorityGroup, Thickness, DepthBias);
}

/** ~Level Viewport Canvas Drawing *********************************************************************************************************************************************/
/********************************************************************************************************************************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class ULevelEditorToolBase : public UObject, public ILevelEditingContext
UFUNCTION(BlueprintCallable, Category = "LevelEditingViewport|DrawPrimitives", meta = (HideSelfPin = "true"))
void DrawSpline(FDummyStruct DrawPrimitivesContext, USplineComponent* SplineComponent, FLinearColor LineColor = FLinearColor::White, EDepthPriorityGroup DepthPriorityGroup = EDepthPriorityGroup::World);

UFUNCTION(BlueprintCallable, Category = "LevelEditingViewport|DrawPrimitives", meta = (HideSelfPin = "true"))
void DrawCylinder(FDummyStruct DrawPrimitivesContext, const class UMaterialInterface* Material, const FVector& Center, const FRotator& Rotation, float Radius, float HalfHeight, int32 NumSides = 16, EDepthPriorityGroup DepthPriorityGroup = EDepthPriorityGroup::World, float DepthBias = 0.0f);

UFUNCTION(BlueprintCallable, Category = "LevelEditingViewport|DrawPrimitives", meta = (HideSelfPin = "true"))
void DrawWireCylinder(FDummyStruct DrawPrimitivesContext, const FVector& Center, const FRotator& Rotation, float Radius, float HalfHeight, int32 NumSides = 16, FLinearColor Color = FLinearColor::White, EDepthPriorityGroup DepthPriorityGroup = EDepthPriorityGroup::World, float Thickness = 0.0f, float DepthBias = 0.0f);


//~ Level Viewport Canvas Drawing ********************************************************************************************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,15 @@ namespace LevelViewportPrimitiveDrawingUtils
}
}

void DrawCylinder(const FDrawPrimitivesContext& Context, const FVector& Center, const FRotator& Rotation, UMaterialInterface* Material, float Radius, float HalfHeight, uint32 NumSides, EDepthPriorityGroup DepthPriorityGroup, float DepthBias)
void DrawCylinder(const FDrawPrimitivesContext& Context, const FVector& Center, const FRotator& Rotation, const UMaterialInterface* Material, float Radius, float HalfHeight, uint32 NumSides, EDepthPriorityGroup DepthPriorityGroup, float DepthBias)
{
if (FPrimitiveDrawInterface* PDI = Context.PDI)
{
const FMaterialRenderProxy* MaterialRenderProxy = Material != nullptr ? Material->GetRenderProxy() : GEditor->ArrowMaterial->GetRenderProxy();
const FVector X = Rotation.Vector();
const FVector Y = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
const FVector Z = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Z);
//::DrawCylinder(PDI, Center, X, Y, Z, Radius, HalfHeight, NumSides, Material, ENUM_TO_UINT8(DepthPriorityGroup));
::DrawCylinder(PDI, FMatrix::Identity, Center, X, Y, Z, Radius, HalfHeight, NumSides, MaterialRenderProxy, CAST_TO_UINT8(DepthPriorityGroup));
}
}

Expand Down