Skip to content
Snippets Groups Projects
Commit 11e90590 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

- Added line id to the editor lines for manipulation of the actual line data.

- Added visualization specifiers for the editor lines' points.
parent 935b73ff
Branches
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -95,7 +95,7 @@ void UGPUInstancedLineComponent::Init()
bIsInitialized = true;
// Add serialized lines to be rendered immediately - pretty sure this could and should be done differently.
for (FEditorLineData& EditorLine : EditorLines)
{
AddLineFromEditorData(EditorLine);
......@@ -106,8 +106,6 @@ void UGPUInstancedLineComponent::Init()
FUpdateTextureRegion2D* UGPUInstancedLineComponent::CalculateTextureRegions(const FIntPoint& StartIndex,
int32 NumberOfPoints, int32& NumberOfRegionsOut)
{
const bool bMultiRow = StartIndex.X + NumberOfPoints > TextureWidth;
// Calculate the first consecutive region:
int32 RemainingPoints = NumberOfPoints;
......@@ -336,11 +334,14 @@ int32 UGPUInstancedLineComponent::AddLine(const TArray<FVector>& Line, FLinearCo
return LineId;
}
int32 UGPUInstancedLineComponent::AddLineFromEditorData(const FEditorLineData& LineData)
int32 UGPUInstancedLineComponent::AddLineFromEditorData(FEditorLineData& LineData)
{
const TArray<FEditorPoint>* EditorLineDataPtr = &LineData.Points;
const TArray<FVector>* FVectorLineDataPtr = reinterpret_cast<const TArray<FVector>*>(EditorLineDataPtr);
return AddLine(*FVectorLineDataPtr, LineData.Color, LineData.Width);
LineData.RespectiveLineId = AddLine(*FVectorLineDataPtr, LineData.Color, LineData.Width);
return LineData.RespectiveLineId;
}
......
......@@ -26,7 +26,7 @@ struct FEditorPoint
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, meta = (MakeEditWidget = true))
FVector Point;
FEditorPoint()
......@@ -45,7 +45,7 @@ struct FEditorLineData
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere)
UPROPERTY(EditAnywhere, meta = (MakeEditWidget = true, EditFixedOrder))
TArray<FEditorPoint> Points;
UPROPERTY(EditAnywhere)
......@@ -54,6 +54,8 @@ struct FEditorLineData
UPROPERTY(EditAnywhere)
FColor Color;
int32 RespectiveLineId = -1;
FEditorLineData()
{
}
......@@ -143,7 +145,7 @@ public:
* @return int32 Id of the line, can be used to access it later on.
*/
UFUNCTION(BlueprintCallable, Category = "Components|InstancedLineComponent")
int32 AddLineFromEditorData(const FEditorLineData& LineData);
int32 AddLineFromEditorData(FEditorLineData& LineData);
/**
* Adds a point at the end of the specified line.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment