mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 09:35:25 +00:00
Add Arc support
This commit is contained in:
parent
c67a0793bb
commit
618fc84c32
@ -43,6 +43,17 @@ FPrimitiveSceneProxy* UStevesEditorVisComponent::CreateSceneProxy()
|
||||
C.NumSegments, C.Colour
|
||||
));
|
||||
}
|
||||
for (auto& Arc : Arcs)
|
||||
{
|
||||
FQuat WorldRot = XForm.TransformRotation(Arc.Rotation.Quaternion());
|
||||
Ret->Arcs.Add(FStevesDebugRenderSceneProxy::FDebugArc(
|
||||
XForm.TransformPosition(Arc.Location),
|
||||
WorldRot.GetForwardVector(), WorldRot.GetRightVector(),
|
||||
Arc.MinAngle, Arc.MaxAngle,
|
||||
XForm.GetMaximumAxisScale() * Arc.Radius,
|
||||
Arc.NumSegments, Arc.Colour
|
||||
));
|
||||
}
|
||||
|
||||
return Ret;
|
||||
|
||||
@ -63,6 +74,11 @@ FBoxSphereBounds UStevesEditorVisComponent::CalcBounds(const FTransform& LocalTo
|
||||
{
|
||||
B = B + FBoxSphereBounds(C.Location, FVector(C.Radius), C.Radius);
|
||||
}
|
||||
for (auto& Arc : Arcs)
|
||||
{
|
||||
// Just use the entire circle for simplicity
|
||||
B = B + FBoxSphereBounds(Arc.Location, FVector(Arc.Radius), Arc.Radius);
|
||||
}
|
||||
|
||||
return B.TransformBy(LocalToWorld);
|
||||
}
|
||||
|
@ -78,7 +78,59 @@ struct FStevesEditorVisCircle
|
||||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FStevesEditorVisArc
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
/// Location relative to component
|
||||
UPROPERTY(EditAnywhere)
|
||||
FVector Location;
|
||||
/// Rotation relative to component; arcs will be rendered in the X/Y plane
|
||||
UPROPERTY(EditAnywhere)
|
||||
FRotator Rotation;
|
||||
/// Minimum angle to render arc from
|
||||
UPROPERTY(EditAnywhere)
|
||||
float MinAngle;
|
||||
/// Maximum angle to render arc to
|
||||
UPROPERTY(EditAnywhere)
|
||||
float MaxAngle;
|
||||
/// Circle radius
|
||||
UPROPERTY(EditAnywhere)
|
||||
float Radius;
|
||||
/// The number of line segments to render the circle with
|
||||
UPROPERTY(EditAnywhere)
|
||||
int NumSegments;
|
||||
/// The colour of the line render
|
||||
UPROPERTY(EditAnywhere)
|
||||
FColor Colour;
|
||||
|
||||
FStevesEditorVisArc(const FVector& InLocation, const FRotator& InRotation, float InMinAngle, float InMaxAngle,
|
||||
float InRadius, int InNumSegments,
|
||||
const FColor& InColour, float InThickness)
|
||||
: Location(InLocation),
|
||||
Rotation(InRotation),
|
||||
MinAngle(InMinAngle),
|
||||
MaxAngle(InMaxAngle),
|
||||
Radius(InRadius),
|
||||
NumSegments(InNumSegments),
|
||||
Colour(InColour)
|
||||
{
|
||||
}
|
||||
|
||||
FStevesEditorVisArc():
|
||||
Location(FVector::ZeroVector),
|
||||
Rotation(FRotator::ZeroRotator),
|
||||
MinAngle(0),
|
||||
MaxAngle(180),
|
||||
Radius(50), NumSegments(12),
|
||||
Colour(FColor::White)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* A component that solely exists to provide arbitrary editor visualisation when not selected.
|
||||
* FComponentVisualizer can only display visualisation when selected.
|
||||
* To display vis on an unselected object, you need a UPrimitiveComponent, and sometimes you don't want/need one of those
|
||||
@ -89,17 +141,19 @@ struct FStevesEditorVisCircle
|
||||
* If you want to, you can add this to your Blueprints too. This component automatically marks itself as "visualisation
|
||||
* only" so shouldn't have a runtime impact.
|
||||
*/
|
||||
UCLASS(Blueprintable, ClassGroup="Utility", hidecategories=(Collision,Physics,Object,LOD,Lighting,TextureStreaming), meta=(DisplayName="Steves Editor Visualisation", BlueprintSpawnableComponent))
|
||||
UCLASS(Blueprintable, ClassGroup="Utility", hidecategories=(Collision,Physics,Object,LOD,Lighting,TextureStreaming),
|
||||
meta=(DisplayName="Steves Editor Visualisation", BlueprintSpawnableComponent))
|
||||
class STEVESUEHELPERS_API UStevesEditorVisComponent : public UPrimitiveComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
/// Circles to render
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisLine> Lines;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisCircle> Circles;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TArray<FStevesEditorVisArc> Arcs;
|
||||
|
||||
UStevesEditorVisComponent(const FObjectInitializer& ObjectInitializer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user