8#include "CoreMinimal.h"
9#include "GameFramework/Actor.h"
10#include "Components/InstancedStaticMeshComponent.h"
17#include "InstancedActorRenderer.generated.h"
27 UPROPERTY(EditAnywhere, BlueprintReadWrite)
28 TSubclassOf<AActor> ActorClass;
30 UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
31 TWeakObjectPtr<UStaticMesh> Mesh;
33 UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
34 TArray<UMaterialInterface*> Materials;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite)
37 int32 CustomDepthStencilValue = 0;
39 UPROPERTY(EditAnywhere, BlueprintReadWrite)
40 bool AllowWorldPositionOffsetDisable = false;
42 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
58 virtual void BeginPlay()
override;
60 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
62 UFUNCTION(BlueprintCallable)
65 UFUNCTION(BlueprintCallable)
66 bool SpawnInstanceBackToActor(UInstancedStaticMeshComponent* ISM, int32 Index,
bool OnlyTree);
68 bool Matches(UStaticMeshComponent* StaticMeshComponent,
const bool CanHaveAlternativeMaterial)
const;
70 bool Matches(UInstancedStaticMeshComponent* ISM)
const;
72 UFUNCTION(BlueprintCallable)
73 bool SpawnInstancesBackActors();
75 UFUNCTION(BlueprintPure)
76 UInstancedStaticMeshComponent* GetInstancedStaticMeshComponent()
const
78 return InstancedStaticMeshComponent;
81 UFUNCTION(BlueprintPure)
84 return InstancedActorParameters;
87 UFUNCTION(BlueprintPure)
88 UStaticMesh* GetStaticMesh()
const;
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category =
"InstancedActorRenderer")
91 UInstancedStaticMeshComponent* InstancedStaticMeshComponent =
nullptr;
95 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "InstancedActorRenderer")
102 UFUNCTION(BlueprintCallable, Category = "InstancedActorRenderer")
103 void SetWorldPositionOffsetDistance(int32 NewWPODistance);
109 UFUNCTION(BlueprintCallable, Category = "InstancedActorRenderer")
110 void SetShadowCacheBehaviour(EShadowCacheInvalidationBehavior ShadowCacheInvalidationBehaviour);
116 UFUNCTION(BlueprintCallable, Category = "Instanced Renderer")
117 void SetRenderWorldPositionOffet(
bool RenderWPO);
132 int32 WorldPositionOffsetDistance = 30000;
134 bool Rendering = true;
136 bool RenderingWPO = false;