Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavigationOctreeController.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

106 lines
3.7 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "NavigationOctree.h"
struct NAVIGATIONSYSTEM_API FNavigationOctreeController
{
enum EOctreeUpdateMode
{
OctreeUpdate_Default = 0, // regular update, mark dirty areas depending on exported content
OctreeUpdate_Geometry = 1, // full update, mark dirty areas for geometry rebuild
OctreeUpdate_Modifiers = 2, // quick update, mark dirty areas for modifier rebuild
OctreeUpdate_Refresh = 4, // update is used for refresh, don't invalidate pending queue
OctreeUpdate_ParentChain = 8, // update child nodes, don't remove anything
};
TSet<FNavigationDirtyElement> PendingOctreeUpdates;
TSharedPtr<FNavigationOctree, ESPMode::ThreadSafe> NavOctree;
/** Map of all objects that are tied to indexed navigation parent */
TMultiMap<UObject*, FWeakObjectPtr> OctreeChildNodesMap;
/** if set, navoctree updates are ignored, use with caution! */
uint8 bNavOctreeLock : 1;
void SetNavigationOctreeLock(bool bLock);
bool HasPendingObjectNavOctreeId(UObject& Object) const;
void RemoveObjectsNavOctreeId(const UObject& Object);
void SetNavigableGeometryStoringMode(FNavigationOctree::ENavGeometryStoringMode NavGeometryMode);
void Reset();
const FNavigationOctree* GetOctree() const;
FNavigationOctree* GetMutableOctree();
const FOctreeElementId* GetObjectsNavOctreeId(const UObject& Object) const;
bool GetNavOctreeElementData(const UObject& NodeOwner, int32& DirtyFlags, FBox& DirtyBounds);
const FNavigationRelevantData* GetDataForObject(const UObject& Object) const;
FNavigationRelevantData* GetMutableDataForObject(const UObject& Object);
bool HasObjectsNavOctreeId(const UObject& Object) const;
bool IsNavigationOctreeLocked() const;
/** basically says if navoctree has been created already */
bool IsValid() const { return NavOctree.IsValid(); }
bool IsValidElement(const FOctreeElementId& ElementId) const;
bool IsEmpty() const { return (IsValid() == false) || NavOctree->GetSizeBytes() == 0; }
private:
static uint32 HashObject(const UObject& Object);
};
//----------------------------------------------------------------------//
// inlines
//----------------------------------------------------------------------//
FORCEINLINE uint32 FNavigationOctreeController::HashObject(const UObject& Object)
{
return FNavigationOctree::HashObject(Object);
}
FORCEINLINE_DEBUGGABLE const FOctreeElementId* FNavigationOctreeController::GetObjectsNavOctreeId(const UObject& Object) const
{
return NavOctree.IsValid()
? NavOctree->ObjectToOctreeId.Find(HashObject(Object))
: nullptr;
}
FORCEINLINE_DEBUGGABLE bool FNavigationOctreeController::HasObjectsNavOctreeId(const UObject& Object) const
{
return NavOctree.IsValid() && (NavOctree->ObjectToOctreeId.Find(HashObject(Object)) != nullptr);
}
FORCEINLINE bool FNavigationOctreeController::HasPendingObjectNavOctreeId(UObject& Object) const
{
return PendingOctreeUpdates.Contains(FNavigationDirtyElement(&Object));
}
FORCEINLINE_DEBUGGABLE void FNavigationOctreeController::RemoveObjectsNavOctreeId(const UObject& Object)
{
if (NavOctree.IsValid())
{
NavOctree->ObjectToOctreeId.Remove(HashObject(Object));
}
}
FORCEINLINE const FNavigationOctree* FNavigationOctreeController::GetOctree() const
{
return NavOctree.Get();
}
FORCEINLINE FNavigationOctree* FNavigationOctreeController::GetMutableOctree()
{
return NavOctree.Get();
}
FORCEINLINE bool FNavigationOctreeController::IsNavigationOctreeLocked() const
{
return bNavOctreeLock;
}
FORCEINLINE void FNavigationOctreeController::SetNavigationOctreeLock(bool bLock)
{
bNavOctreeLock = bLock;
}
FORCEINLINE bool FNavigationOctreeController::IsValidElement(const FOctreeElementId& ElementId) const
{
return IsValid() && NavOctree->IsValidElementId(ElementId);
}