I have created a BrushTracker class extending the ABrush to validate some properties of the brushes I am creating. It compiles and works fine, but after placing it in the editor and setting brush type to Cube, it doesn’t appear on the viewport. No bounds, Edges, Surfaces appear.
Header File:
#pragma once
#include <list>
#include <Runtime\Engine\Classes\Engine\Brush.h>
#include <Runtime\Engine\Classes\Kismet\GameplayStatics.h>
#include <Runtime\Core\Public\Async\Async.h>
#include "CoreMinimal.h"
#include "BrushTracker.generated.h"
UCLASS()
class TRAPPEDINSIDE_API ABrushTracker : public ABrush
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABrushTracker();
UFUNCTION(BlueprintCallable, Category = Trackers)
void TrackBrushesAsync();
UPROPERTY(EditAnywhere, Category = Trackers)
bool Debug;
UPROPERTY(EditAnywhere, Category = Trackers)
bool Test;
UPROPERTY(EditAnywhere, Category = Trackers)
bool ListSizes;
UPROPERTY(EditAnywhere, Category = Trackers)
bool ListLocation;
private:
std::list<float> BrushXSizes;
std::list<float> BrushYSizes;
std::list<float> BrushZSizes;
std::list<float> BrushXLocation;
std::list<float> BrushYLocation;
std::list<float> BrushZLocation;
private:
void TrackBrushes();
void TrackNormal(ABrush* brush);
void TrackCurve(ABrush* brush);
void TrackFit(ABrush* brush);
void TrackStep(ABrush* brush);
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
Implementation file:
#include <list>
#include <future>
#include "BrushTracker.h"
// Sets default values
ABrushTracker::ABrushTracker()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
void ABrushTracker::TrackBrushesAsync()
{
std::thread(&ABrushTracker::TrackBrushes, this).detach();
}
void ABrushTracker::TrackBrushes()
{
(...)
}
void ABrushTracker::TrackNormal(ABrush* brush)
{
(...)
}
void ABrushTracker::TrackCurve(ABrush* brush)
{
(...)
}
void ABrushTracker::TrackFit(ABrush* brush)
{
(...)
}
void ABrushTracker::TrackStep(ABrush* brush)
{
(...)
}
// Called when the game starts or when spawned
void ABrushTracker::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABrushTracker::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}