FPrimitiveSceneProxy* UGameplayDebuggerDrawComponent::CreateSceneProxy() { FDebugRenderSceneCompositeProxy* CompositeProxy = nullptr; #if ENABLED_GAMEPLAY_DEBUGGER AGameplayDebuggerReplicator* Replicator = Cast<AGameplayDebuggerReplicator>(GetOwner()); if (!Replicator || Replicator->IsActorTickEnabled() == false || !World || World->GetNetMode() == NM_DedicatedServer || IsPendingKill()) { return nullptr; } CompositeProxy = new FDebugRenderSceneCompositeProxy(this); for (UGameplayDebuggerBaseObject* Obj : Replicator->ReplicatedObjects) { if (Obj && Replicator->IsCategoryEnabled(Obj->GetCategoryName())) { FDebugRenderSceneProxy* ChildSceneProxy = Obj->CreateSceneProxy(this, World, Replicator->GetSelectedActorToDebug()); if (ChildSceneProxy) { CompositeProxy->AddChild(ChildSceneProxy); } } } #endif //ENABLED_GAMEPLAY_DEBUGGER return CompositeProxy; }
//----------------------------------------------------------------------// // rendering //----------------------------------------------------------------------// FPrimitiveSceneProxy* UGameplayDebuggingComponent::CreateSceneProxy() { FDebugRenderSceneCompositeProxy* CompositeProxy = NULL; AGameplayDebuggingReplicator* Replicator = Cast<AGameplayDebuggingReplicator>(GetOwner()); if (!World || World->GetNetMode() == NM_DedicatedServer) { return NULL; } if (!Replicator || !Replicator->IsDrawEnabled()) { return NULL; } #if WITH_RECAST if (ShouldReplicateData(EAIDebugDrawDataView::NavMesh)) { FNavMeshSceneProxyData NewNavmeshRenderData; NewNavmeshRenderData.Reset(); NewNavmeshRenderData.bNeedsNewData = false; NewNavmeshRenderData.bEnableDrawing = false; PrepareNavMeshData(&NewNavmeshRenderData); NavMeshBounds = NewNavmeshRenderData.Bounds; CompositeProxy = CompositeProxy ? CompositeProxy : (new FDebugRenderSceneCompositeProxy(this)); CompositeProxy->AddChild(new FRecastRenderingSceneProxy(this, &NewNavmeshRenderData, true)); } #endif #if USE_EQS_DEBUGGER if (ShouldReplicateData(EAIDebugDrawDataView::EQS) && IsClientEQSSceneProxyEnabled()) { const int32 EQSIndex = EQSLocalData.Num() > 0 ? FMath::Clamp(CurrentEQSIndex, 0, EQSLocalData.Num() - 1) : INDEX_NONE; if (EQSLocalData.IsValidIndex(EQSIndex)) { CompositeProxy = CompositeProxy ? CompositeProxy : (new FDebugRenderSceneCompositeProxy(this)); auto& CurrentLocalData = EQSLocalData[EQSIndex]; FString ViewFlagName = TEXT("Game"); #if WITH_EDITOR UEditorEngine* EEngine = Cast<UEditorEngine>(GEngine); if (EEngine && EEngine->bIsSimulatingInEditor) { ViewFlagName = TEXT("DebugAI"); } #endif CompositeProxy->AddChild(new FEQSSceneProxy(this, ViewFlagName, false, CurrentLocalData.SolidSpheres, CurrentLocalData.Texts)); } } #endif // USE_EQS_DEBUGGER return CompositeProxy; }