Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavSystemConfigOverride.h
mieszko zielinski c9c9e0790d Reorganized how we configure SupportedAgents. From now on every NavigationSystem instance has data on the full set of SupportedAgents (as configured via ProjectSettings) but also has a SupportedAgentsMask, that marks agents supported by the instance. It has been done this way to keep filtered per-agent NavMeshBoundVolumes work regardless of which supported agents a nav sys instance wants to support.
This approach allowed for easy NavigationSystem's config update with NavSystemConfigOverride's properties. NavSystemConfigOverride can now specify if it wants to fully override the pre-existing nav sys instance or if it just wants to append new information (like supported agents) to the existing navigation system instance. There's also an option to do nothing if there's already a navigation system present.

This CL rolls-back a bunch of temp fixes done in past couple of days.

#rb Yoan.StAmant
Yoan.StAmant


#ROBOMERGE-OWNER: mieszko.zielinski
#ROBOMERGE-AUTHOR: mieszko.zielinski
#ROBOMERGE-SOURCE: CL 8187661 via CL 8193395 via CL 8207613
#ROBOMERGE-BOT: (v401-8057353)

[CL 8207758 by mieszko zielinski in Main branch]
2019-08-21 23:59:12 -04:00

79 lines
2.5 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "GameFramework/Actor.h"
#include "AI/NavigationSystemBase.h"
#include "NavSystemConfigOverride.generated.h"
class UNavigationSystemConfig;
UENUM()
enum class ENavSystemOverridePolicy : uint8
{
Override, // the pre-exising nav system instance will be destroyed.
Append, // config information will be added to pre-existing nav system instance
Skip // if there's already a NavigationSystem in the world then the overriding config will be ignored
};
UCLASS(hidecategories = (Input, Rendering, Actor, LOD, Cooking))
class NAVIGATIONSYSTEM_API ANavSystemConfigOverride : public AActor
{
GENERATED_BODY()
#if WITH_EDITORONLY_DATA
private:
UPROPERTY()
class UBillboardComponent* SpriteComponent;
#endif // WITH_EDITORONLY_DATA
protected:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Navigation, Instanced, meta = (NoResetToDefault))
UNavigationSystemConfig* NavigationSystemConfig;
/** If there's already a NavigationSystem instance in the world how should this nav override behave */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Navigation)
ENavSystemOverridePolicy OverridePolicy;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Navigation, AdvancedDisplay)
uint8 bLoadOnClient : 1;
public:
ANavSystemConfigOverride(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
//~ Begin UObject Interface
virtual void PostLoad() override;
virtual void PostInitProperties() override;
#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif // WITH_EDITOR
//~ End UObject Interface
#if WITH_EDITOR
/** made an explicit function since rebuilding navigation system can be expensive */
UFUNCTION(Category = Navigation, meta = (CallInEditor = "true"))
void ApplyChanges();
//virtual void CheckForErrors() override;
#endif
protected:
/** Creates a new navigation system and plugs it into the world. If there's a
* nav system instance already in place it gets destroyed. */
virtual void OverrideNavSystem();
/** Appends non-conflicting information (like supported agents) to a pre-existing
* nav system instance */
virtual void AppendToNavSystem(UNavigationSystemBase& PrevNavSys);
#if WITH_EDITOR
/** Called only in the editor mode*/
void InitializeForWorld(UNavigationSystemBase* NewNavSys, UWorld* World, const FNavigationSystemRunMode RunMode);
#endif // WITH_EDITOR
void ApplyConfig();
};