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)
96 UFUNCTION(BlueprintCallable)
97 void SetUpdateTransformAutomatically(
bool UpdateAutomatically);
102 UFUNCTION(BlueprintCallable)
103 bool IsTreeActor()
const;
111 PreviousTransform = NewTransform;
118 UFUNCTION(BlueprintPure)
119 bool IsAddedToInstancedRendering()
const
121 return AddedToInstancedRenderer;
124 UFUNCTION(BlueprintPure)
125 UStaticMeshComponent* GetStaticMeshComponent()
const
127 return StaticMeshComponent;
130 UFUNCTION(BlueprintPure)
131 int GetInstanceStartCullDistance()
const
133 return InstanceStartCullDistanceInCm;
136 UFUNCTION(BlueprintPure)
137 int GetInstanceEndCullDistance()
const
139 return InstanceEndCullDistanceInCm;
142 UFUNCTION(BlueprintPure)
143 bool UpdateTransformAutomatically()
const
145 return ShouldUpdateTransformAutomatically;
148 UFUNCTION(BlueprintCallable)
149 FString GetTypeIDString()
const
154 UFUNCTION(BlueprintCallable)
155 FString GetModelIDString()
const
162 return ComponentIndex;
167 return InstanceNumber;
172 return AlternativeMaterial;
177 return CustomDepthSetup;
182 return AllowWorldPositionOffsetDisable;
187 return PreviousTransform;
190 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category =
"AInstancedActor")
191 UStaticMeshComponent* StaticMeshComponent =
nullptr;
193 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
194 bool AllowWorldPositionOffsetDisable = false;
196 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
197 bool AddToInstancedRenderer = true;
199 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
200 int InstanceStartCullDistanceInCm = 45000;
202 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
203 int InstanceEndCullDistanceInCm = 46500;
206 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
207 bool ShouldUpdateTransformAutomatically = false;
210 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
211 bool AlternativeMaterial = false;
213 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "
AInstancedActor")
214 FText InteractableName;
216 virtual FText GetInteractableName_Implementation()
const override
218 return InteractableName;
223 return GetActorTransform();
238 ActorName = NewActorName;
243 ActorName = NewActorName;
245 SetAndValidateActorIDAndName(ActorName, ActorID, TWeakObjectPtr<AActor>(
this));
250 UPROPERTY(VisibleAnywhere)
253 UPROPERTY(VisibleAnywhere)
256 FTransform PreviousTransform;
258 int32 ComponentIndex = 9999999;
260 int32 InstanceNumber = 9999999;
262 bool AddedToInstancedRenderer = false;
264 FString TypeID = "none";
266 FString ModelID = "none";
268 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