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

- Added a (little hacky) way to load visualizations on editor startup without...

- Added a (little hacky) way to load visualizations on editor startup without re-initializing textures. Keep an eye on that as it might break for various reasons.
parent e4afd3b0
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,6 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer& ...@@ -18,10 +18,6 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer&
TextureWidth = 2048; TextureWidth = 2048;
TextureHeight = 2048; TextureHeight = 2048;
//PrimaryComponentTick.bCanEverTick = true;
//bTickInEditor = true;
//bAutoActivate = true;
SetWorldTransform(FTransform::Identity); SetWorldTransform(FTransform::Identity);
SetUsingAbsoluteLocation(true); SetUsingAbsoluteLocation(true);
...@@ -43,6 +39,18 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer& ...@@ -43,6 +39,18 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer&
//DynamicLineMaterial = UMaterialInstanceDynamic::Create(LineMaterialInterface, GetTransientPackage()); //DynamicLineMaterial = UMaterialInstanceDynamic::Create(LineMaterialInterface, GetTransientPackage());
SetMaterial(0, DynamicLineMaterial); SetMaterial(0, DynamicLineMaterial);
SetMobility(EComponentMobility::Static); SetMobility(EComponentMobility::Static);
#if WITH_EDITOR
bAutoActivate = true;
PrimaryComponentTick.bCanEverTick = true;
bTickInEditor = true;
SetComponentTickEnabled(true);
#else
PrimaryComponentTick.bCanEverTick = false;
bTickInEditor = false;
SetComponentTickEnabled(false);
#endif
} }
UGPUInstancedLineComponent::~UGPUInstancedLineComponent() UGPUInstancedLineComponent::~UGPUInstancedLineComponent()
...@@ -407,6 +415,22 @@ void UGPUInstancedLineComponent::OnUpdateTransform(EUpdateTransformFlags UpdateT ...@@ -407,6 +415,22 @@ void UGPUInstancedLineComponent::OnUpdateTransform(EUpdateTransformFlags UpdateT
SetWorldTransform(FTransform::Identity); SetWorldTransform(FTransform::Identity);
} }
void UGPUInstancedLineComponent::TickComponent(float DeltaTime, ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if(TickCount < MaxTicksUntilInit)
{
TickCount++;
}
else
{
Init();
bTickInEditor = false;
SetComponentTickEnabled(false);
}
}
#endif #endif
... ...
......
...@@ -105,6 +105,8 @@ public: ...@@ -105,6 +105,8 @@ public:
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; // need this for the widget as for some godforsaken reason the Chain event doesn't fire... virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; // need this for the widget as for some godforsaken reason the Chain event doesn't fire...
// This is ABSURDLY hacky // This is ABSURDLY hacky
virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport = ETeleportType::None) override; virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport = ETeleportType::None) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
#endif #endif
//virtual TStructOnScope<FActorComponentInstanceData> GetComponentInstanceData() const override; //virtual TStructOnScope<FActorComponentInstanceData> GetComponentInstanceData() const override;
...@@ -484,6 +486,11 @@ public: ...@@ -484,6 +486,11 @@ public:
UPROPERTY(Transient) UPROPERTY(Transient)
bool bIsInitialized = false; bool bIsInitialized = false;
private:
// hacky way to initialize components.
uint32 TickCount = 0;
uint32 MaxTicksUntilInit = 5;
}; };
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment