diff --git a/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp b/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp index e3398a05bbb71b4bc6370dafea6a5db6d4d728e9..4b2acaa3614f85c672d4453f6c3a11a493a60c13 100644 --- a/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp +++ b/Source/InstancedMeshLineRendering/Private/GPUInstancedLineComponent.cpp @@ -9,6 +9,9 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer& ObjectInitializer) { + SetWorldTransform(FTransform::Identity); + SetUsingAbsoluteLocation(true); + SetCastShadow(false); SetCollisionEnabled(ECollisionEnabled::NoCollision); SetGenerateOverlapEvents(false); @@ -32,6 +35,9 @@ UGPUInstancedLineComponent::UGPUInstancedLineComponent(const FObjectInitializer& TextureWidth = 2048; TextureHeight = 2048; + SetMobility(EComponentMobility::Static); + + //DynamicLineMaterial = nullptr; //PositionTexture = nullptr; } @@ -419,6 +425,12 @@ void UGPUInstancedLineComponent::PostEditChangeProperty(FPropertyChangedEvent& P Super::PostEditChangeProperty(PropertyChangedEvent); } + +// This is hacky - reset the transform to 0,0,0 every time the component is moved to not mess up the editor gizmos +void UGPUInstancedLineComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) +{ + SetWorldTransform(FTransform::Identity); +} #endif // Doesn't do anything yet, just as a testing function to see execution order on Unreal startup. diff --git a/Source/InstancedMeshLineRendering/Public/GPUInstancedLineComponent.h b/Source/InstancedMeshLineRendering/Public/GPUInstancedLineComponent.h index 9c87a461585bfb09f7d268f69f863b466586d7e6..d3e9bda0ac146af29879f6c2093954f6835fccf0 100644 --- a/Source/InstancedMeshLineRendering/Public/GPUInstancedLineComponent.h +++ b/Source/InstancedMeshLineRendering/Public/GPUInstancedLineComponent.h @@ -75,7 +75,7 @@ struct FEditorLineData }; -UCLASS(Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent), HideCategories=("Instances")) +UCLASS(Blueprintable, BlueprintType, meta = (BlueprintSpawnableComponent), HideCategories=("Instances", "Object", "LOD", "Physics", "Activation", "Materials", "Cooking", "Sockets", "Collision", "Mobile", "HLOD")) class INSTANCEDMESHLINERENDERING_API UGPUInstancedLineComponent : public UInstancedStaticMeshComponent { GENERATED_BODY() @@ -125,6 +125,9 @@ protected: #if WITH_EDITOR virtual void PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) override; 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 + virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport = ETeleportType::None) override; + #endif virtual void PostLoad() override;