10#include "Engine/GameViewportClient.h"
11#include "Engine/World.h"
14#include "Kismet/GameplayStatics.h"
15#include "GameFramework/Actor.h"
16#include "Containers/Map.h"
30 FString ActorIDLower = ActorID.ToLower();
31 FString FinalID = ActorIDLower;
38 if (!Data.
Actor.IsValid())
46 FinalID = ActorIDLower + FString::Printf(TEXT(
"%d"), Data.
Count);
52 FinalID = ActorIDLower + FString::Printf(TEXT(
"%d"), Data.
Count);
64 return FGuid::NewGuid().ToString(EGuidFormats::DigitsWithHyphensLower);
72 UE_LOG(LogTemp, Warning, TEXT(
"IActorID.cpp: Invalid Actor!"));
77 if (ActorName.IsEmpty())
81 ActorName = Actor->GetActorNameOrLabel();
84 if (!ActorID.IsEmpty())
98 if (!GEngine || !GEngine->GameViewport)
103 TArray<AActor*> ActorsWithInterface;
104 UWorld* World = GEngine->GameViewport->GetWorld();
105 UGameplayStatics::GetAllActorsWithInterface(World, UActorInformation::StaticClass(), ActorsWithInterface);
108 FString IDLowered = ID.ToLower();
110 for (AActor* Actor : ActorsWithInterface)
112 FString ActorID = IActorInformation::Execute_GetActorID(Actor);
113 if (ActorID == IDLowered)
115 return Actor->Destroy();
124 if (!GEngine || !GEngine->GameViewport)
129 TArray<AActor*> ActorsWithInterface;
130 UWorld* World = GEngine->GameViewport->GetWorld();
131 UGameplayStatics::GetAllActorsWithInterface(World, UActorInformation::StaticClass(), ActorsWithInterface);
134 FString IDLowered = ID.ToLower();
136 for (AActor* Actor : ActorsWithInterface)
140 FString ActorID = IActorInformation::Execute_GetActorID(Actor);
141 if (ActorID == IDLowered)
154 if (!GEngine || !GEngine->GameViewport)
159 TArray<AActor*> ActorsWithInterface;
160 UWorld* World = GEngine->GameViewport->GetWorld();
161 UGameplayStatics::GetAllActorsWithInterface(World, UActorInformation::StaticClass(), ActorsWithInterface);
164 TArray<T*> ConvertedActors;
165 for (AActor* Actor : ActorsWithInterface)
167 T* TypedActor = Cast<T>(Actor);
170 ConvertedActors.Add(TypedActor);
174 return ConvertedActors;
179 FString Message =
"IDs: ";
184 for (
auto It =
ExistingIDs.CreateIterator(); It; ++It)
186 if (It.Value().Actor.IsValid())
189 Message += FString::Printf(TEXT(
"%s"), *It.Key());
190 if (++IdCounter < NumIds)
193 Message += TEXT(
", ");
207void IActorInformation::ClearTMapEditor()
static void Log(const FString &Message, bool LogToTextFile=true, bool LogToROS=true)
TWeakObjectPtr< AActor > Actor