11#include "Delegates/DelegateSignatureImpl.inl"
12#include "Framework/Commands/UIAction.h"
13#include "Engine/World.h"
14#include "Engine/Engine.h"
15#include "Engine/GameViewportClient.h"
18#include "EngineUtils.h"
19#include "Engine/World.h"
27 TEXT(
"r.WorldRendering"),
28 TEXT(
"Toggle World rendering"),
33 TEXT(
"r.InstancedRendering"),
34 TEXT(
"Toggle Agrarsense Instanced rendering"),
42 TEXT(
"r.HideInstancedActors"),
43 TEXT(
"Hide all Agrarsense Instanced actors"),
48 TEXT(
"r.ShowInstancedActors"),
49 TEXT(
"Show all Agrarsense Instanced actors"),
55 TEXT(
"Hide all Agrarsense Instanced Trees"),
61 TEXT(
"Show all Agrarsense Instanced Trees"),
78 if (GEngine && GEngine->GameViewport)
80 GEngine->GameViewport->bDisableWorldRendering = !GEngine->GameViewport->bDisableWorldRendering;
86 if (GEngine && GEngine->GameViewport)
88 UWorld* World = GEngine->GameViewport->GetWorld();
94 InstanceRenderer->SetInstancedRendering(!InstanceRenderer->IsRendering());
103 UWorld* World = GEditor ? GEditor->GetEditorWorldContext().World() :
nullptr;
109 for (TActorIterator<AInstancedActor> ActorItr(World); ActorItr; ++ActorItr)
115 if (StaticMeshComponent)
117 StaticMeshComponent->SetVisibility(Visible);
128 TArray<FString> TreeNames = {
"birch",
"spruce",
"pine",
"alder",
"willow" };
130 UWorld* World = GEditor ? GEditor->GetEditorWorldContext().World() :
nullptr;
136 for (TActorIterator<AInstancedActor> ActorItr(World); ActorItr; ++ActorItr)
142 if (StaticMeshComponent)
146 UStaticMesh* Mesh = StaticMeshComponent->GetStaticMesh();
149 FString MeshName = Mesh->GetName().ToLower();
150 for (
size_t i = 0; i < TreeNames.Num(); i++)
152 if (MeshName.Contains(TreeNames[i]))
162 StaticMeshComponent->SetVisibility(Visible);
UStaticMeshComponent * GetStaticMeshComponent() const
TArray< TUniquePtr< FAutoConsoleCommand > > ConsoleCommands
UAgrarsenseConsoleCommands()
void ToggleWorldRendering()
~UAgrarsenseConsoleCommands()
void SetInstancedActorsVisibilityEditor(bool Visible)
void ToggleInstancedRendering()
void SetInstacedTreesVisibilityEditor(bool Visible)
static AInstancedRenderer * GetInstancedRenderer(const UObject *WorldContextObject)