Commit 54f628e0 authored by Jan Kremer's avatar Jan Kremer

Update 2D plots on step change.

parent ed809578
No preview for this file type
No preview for this file type
......@@ -7,6 +7,7 @@
#include "Plot3D.h"
#include "PawnBase.h"
#include "Plot2D.h"
#include "PlotCanvas.h"
#include "Runtime/Engine/Classes/Engine/World.h"
#include "Runtime/Engine/Classes/Kismet/KismetMathLibrary.h"
#include "Runtime/Core/Public/Async/ParallelFor.h"
......@@ -142,6 +143,14 @@ void UDataComponent::LoadStep(FString GroupName, bool ResetBrush)
Cast<APawnBase>(GetOwner())->Plot3D->OnLoadStep(IsFirstTime, !ResetBrush);
IsFirstTime = false;
APawnBase* BasePawn = Cast<APawnBase>(GetOwner());
for (APlot2D* Plot2D : BasePawn->Plots2D)
{
Plot2D->PlotCanvas->SetXAxisType(Plot2D->PlotCanvas->XAxisType); // this refreshes the min and max values
Plot2D->PlotCanvas->SetYAxisType(Plot2D->PlotCanvas->YAxisType); // this refreshes the min and max values
Plot2D->Redraw();
}
}
FColor UDataComponent::CalculateColorOfPoint(int32 Index, float Min, float Max)
......
......@@ -9,6 +9,8 @@
void UPlotCanvas::SetXAxisType(EAxisType Type)
{
XAxisType = Type;
APawn* Pawn = UGameplayStatics::GetPlayerPawn(this, 0);
APawnBase* PawnBase = Cast<APawnBase>(Pawn);
......@@ -56,6 +58,8 @@ void UPlotCanvas::SetXAxisType(EAxisType Type)
void UPlotCanvas::SetYAxisType(EAxisType Type)
{
YAxisType = Type;
APawn* Pawn = UGameplayStatics::GetPlayerPawn(this, 0);
APawnBase* PawnBase = Cast<APawnBase>(Pawn);
......
......@@ -28,6 +28,11 @@ public:
UFUNCTION(BlueprintCallable, Category = DrawingTools)
void SetYAxisType(EAxisType Type);
UPROPERTY(BlueprintReadOnly)
EAxisType XAxisType;
UPROPERTY(BlueprintReadOnly)
EAxisType YAxisType;
UFUNCTION(BlueprintCallable, Category = DrawingTools)
void InitializeCanvas(const int32 pixelsH, const int32 pixelsV);
UFUNCTION(BlueprintCallable, Category = DrawingTools)
......@@ -73,7 +78,6 @@ public:
float YMax;
private:
// canvas
std::unique_ptr<uint8[]> canvasPixelData;
int canvasWidth;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment