8#include "CoreMinimal.h"
9#include "GameFramework/Actor.h"
10#include "Engine/EngineTypes.h"
11#include "Engine/StaticMesh.h"
12#include "Components/StaticMeshComponent.h"
13#include "Internationalization/Text.h"
19#include "InstancedActor.generated.h"
45 virtual void BeginPlay()
override;
47 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
53 UFUNCTION(BlueprintCallable)
54 bool AddToInstancedRendering();
60 UFUNCTION(BlueprintCallable)
61 void RemoveFromInstancedRendering(
bool EnableStaticMeshComponent =
true);
66 UFUNCTION(BlueprintCallable)
67 void UpdateTransformPosition();
73 void InstanceAdded(int32 CompIndex, int32 InstanceNum);
79 void UpdateIndex(int32 UpdatedIndex);
85 UFUNCTION(BlueprintCallable)
86 void SetTypeAndModel(const FString& Type, const FString& Model)
95 UFUNCTION(BlueprintCallable)
96 bool IsTreeActor()
const;
104 PreviousTransform = NewTransform;
111 UFUNCTION(BlueprintPure)
112 bool IsAddedToInstancedRendering()
const
114 return AddedToInstancedRenderer;
117 UFUNCTION(BlueprintPure)
118 UStaticMeshComponent* GetStaticMeshComponent()
const
120 return StaticMeshComponent;
123 UFUNCTION(BlueprintPure)
124 int GetInstanceStartCullDistance()
const
126 return InstanceStartCullDistanceInCm;
129 UFUNCTION(BlueprintPure)
130 int GetInstanceEndCullDistance()
const
132 return InstanceEndCullDistanceInCm;
135 UFUNCTION(BlueprintPure)
136 bool UpdateTransformAutomatically()
const
138 return ShouldUpdateTransformAutomatically;
141 UFUNCTION(BlueprintCallable)
142 FString GetTypeIDString()
const
147 UFUNCTION(BlueprintCallable)
148 FString GetModelIDString()
const
155 return ComponentIndex;
160 return InstanceNumber;
165 return AlternativeMaterial;
170 return CustomDepthSetup;
175 return AllowWorldPositionOffsetDisable;
180 return PreviousTransform;
183 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category =
"AInstancedActor")
184 UStaticMeshComponent* StaticMeshComponent =
nullptr;
186 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
187 bool AllowWorldPositionOffsetDisable = false;
189 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
190 bool AddToInstancedRenderer = true;
192 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
193 int InstanceStartCullDistanceInCm = 45000;
195 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
196 int InstanceEndCullDistanceInCm = 46500;
199 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
200 bool ShouldUpdateTransformAutomatically = false;
203 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
204 bool AlternativeMaterial = false;
206 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
207 FText InteractableName;
209 virtual FText GetInteractableName_Implementation()
const override
211 return InteractableName;
216 return GetActorTransform();
231 ActorName = NewActorName;
236 ActorName = NewActorName;
238 SetAndValidateActorIDAndName(ActorName, ActorID, TWeakObjectPtr<AActor>(
this));
243 UPROPERTY(VisibleAnywhere)
246 UPROPERTY(VisibleAnywhere)
249 FTransform PreviousTransform;
251 int32 ComponentIndex = 9999999;
253 int32 InstanceNumber = 9999999;
255 bool AddedToInstancedRenderer = false;
257 FString TypeID = "none";
259 FString ModelID = "none";
261 bool CustomDepthSetup = false;
int GetInstanceIndex() const
virtual void SetActorIDAndName_Implementation(const FString &NewActorName, const FString &NewID) override
FTransform GetPreviousTransform() const
bool HasAlternativeMaterial() const
int GetComponentIndex() const
virtual void SetActorName_Implementation(const FString &NewActorName) override
virtual FString GetActorID_Implementation() const override
virtual FTransform GetInteractableWorldTransform_Implementation() const override
void UpdatePreviousTransform(const FTransform &NewTransform)
bool IsCustomDepthSetup() const
bool GetAllowWorldPositionOffsetDisable() const
virtual FString GetActorName_Implementation() const override