Files
UnrealEngineUWP/Engine/Source/Developer/LogVisualizer/Private/VisualLoggerRenderingComponent.h
Yoan StAmant 166f970337 [DebugDrawDelegate]
Update registration flow since CreateRenderState_Concurrent can't be used to register our delegate since it needs to be initialized first (CreateSceneProxy) and in some code paths for loaded actors the call order might be different since primitive registration gets deferred (i.e. FRegisterComponentContext != nullptr).
In that case initialization won't called and an ensure will fire in UnregisterDebugDrawDelegate since registration failed (was not initialized).
Case 1: FRegisterComponentContext == nullptr  ==> Super::CreateRenderState_Concurrent + sync CreateSceneProxy (init) + RegisterDebugDrawDelegate ==> works fine
Case 2: FRegisterComponentContext != nullptr  ==> Super::CreateRenderState_Concurrent + deferred CreateSceneProxy + RegisterDebugDrawDelegate (skipped since not init) + CreateSceneProxy ==> ensures in UnregisterDebugDrawDelegate

Bonus:
- some code analysis fixes
- removed some 'CoreMinimal.h' includes
- exported log category 'LogVisual'
- fixed some uninitialized properties (FNavTestDebugDrawDelegateHelper, UNavMeshRenderingComponent, FNavMeshSceneProxyData)
- fixed some methods hiding non-virtual from base class (GetAllocatedSize)
- fixed FGameplayDebuggerCompositeSceneProxy::GetMemoryFootprint that was not considering base class allocations

#rnx
#jira UE-125097
#preflight 614362684778fa00016a8cad
#rb mieszko.zielinski

[CL 17544171 by Yoan StAmant in ue5-main branch]
2021-09-16 16:47:25 -04:00

29 lines
667 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "DebugRenderSceneProxy.h"
#include "Components/PrimitiveComponent.h"
#include "VisualLoggerRenderingComponent.generated.h"
/**
* Transient actor used to draw visual logger data on level
*/
UCLASS()
class UVisualLoggerRenderingComponent : public UPrimitiveComponent
{
public:
GENERATED_UCLASS_BODY()
virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
virtual FBoxSphereBounds CalcBounds(const FTransform &LocalToWorld) const override;
virtual void DestroyRenderState_Concurrent() override;
private:
#if WITH_EDITOR
FDebugDrawDelegateHelper DebugDrawDelegateHelper;
#endif
};