void AAIController::GrabDebugSnapshot(FVisualLogEntry* Snapshot) const { FVisualLogStatusCategory MyCategory; MyCategory.Category = TEXT("AI Controller"); MyCategory.Add(TEXT("Pawn"), GetNameSafe(GetPawn())); AActor* FocusActor = GetFocusActor(); MyCategory.Add(TEXT("Focus"), GetDebugName(FocusActor)); if (FocusActor == nullptr) { MyCategory.Add(TEXT("Focus Location"), TEXT_AI_LOCATION(GetFocalPoint())); } Snapshot->Status.Add(MyCategory); if (GetPawn()) { Snapshot->Location = GetPawn()->GetActorLocation(); } if (PathFollowingComponent) { PathFollowingComponent->DescribeSelfToVisLog(Snapshot); } if (BrainComponent != NULL) { BrainComponent->DescribeSelfToVisLog(Snapshot); } if (PerceptionComponent != NULL) { PerceptionComponent->DescribeSelfToVisLog(Snapshot); } }
void UPawnActionsComponent::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const { static const FString Category = TEXT("PawnActions"); if (IsPendingKill()) { return; } for (int32 PriorityIndex = 0; PriorityIndex < ActionStacks.Num(); ++PriorityIndex) { const UPawnAction* Action = ActionStacks[PriorityIndex].GetTop(); if (Action == NULL) { continue; } FVisualLogStatusCategory StatusCategory; StatusCategory.Category = Category + TEXT(": ") + GetPriorityName(PriorityIndex); while (Action) { StatusCategory.Add(Action->GetName(), Action->GetStateDescription()); Action = Action->GetParentAction(); } Snapshot->Status.Add(StatusCategory); } }
void UCrowdFollowingComponent::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const { if (!bEnableCrowdSimulation) { Super::DescribeSelfToVisLog(Snapshot); return; } FVisualLogStatusCategory Category; Category.Category = TEXT("Path following"); if (DestinationActor.IsValid()) { Category.Add(TEXT("Goal"), GetNameSafe(DestinationActor.Get())); } FString StatusDesc = GetStatusDesc(); FNavMeshPath* NavMeshPath = Path.IsValid() ? Path->CastPath<FNavMeshPath>() : NULL; FAbstractNavigationPath* DirectPath = Path.IsValid() ? Path->CastPath<FAbstractNavigationPath>() : NULL; if (Status == EPathFollowingStatus::Moving) { StatusDesc += FString::Printf(TEXT(" [path:%d, visited:%d]"), PathStartIndex, LastPathPolyIndex); } Category.Add(TEXT("Status"), StatusDesc); Category.Add(TEXT("Path"), !Path.IsValid() ? TEXT("none") : NavMeshPath ? TEXT("navmesh") : DirectPath ? TEXT("direct") : TEXT("unknown")); UObject* CustomLinkOb = GetCurrentCustomLinkOb(); if (CustomLinkOb) { Category.Add(TEXT("SmartLink"), CustomLinkOb->GetName()); } UCrowdManager* Manager = UCrowdManager::GetCurrent(GetWorld()); if (Manager && !Manager->IsAgentValid(this)) { Category.Add(TEXT("Simulation"), TEXT("unable to register!")); } Snapshot->Status.Add(Category); }
void UBrainComponent::DescribeSelfToVisLog(FVisualLogEntry* Snapshot) const { const static UEnum* PriorityEnum = FindObject<UEnum>(ANY_PACKAGE, TEXT("EAIRequestPriority")); if (IsPendingKill()) { return; } FVisualLogStatusCategory StatusCategory; StatusCategory.Category = FString::Printf(TEXT("Resource lock: %s"), *ResourceLock.GetLockPriorityName()); for (int32 LockLevel = 0; LockLevel < int32(EAIRequestPriority::MAX); ++LockLevel) { StatusCategory.Add(*PriorityEnum->GetEnumName(LockLevel), ResourceLock.IsLockedBy(EAIRequestPriority::Type(LockLevel)) ? TEXT("Locked") : TEXT("Unlocked")); } Snapshot->Status.Add(StatusCategory); if (BlackboardComp) { BlackboardComp->DescribeSelfToVisLog(Snapshot); } }