Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavigationDataHandler.h
yoan stamant 7a102e17b3 [Navigation]
- Added flag in FNavigationRelevantData to indicates elements that want to skip dirty areas when added/removed from the NavigationOctree.
- Method ShouldSkipDirtyAreaOnAddOrRemove has been added to INavRelevantInterface to control the flag.
- UpdateNavOctreeElementBounds now takes a list of dirty areas instead of a single area to allow batched modifications.

UInstancedStaticMeshComponent updates:
- Added a cache for navigation bounds
- Implements ShouldSkipDirtyAreaOnAddOrRemove so we don't dirty the whole area covered by the instances on registration but only a list of explicit areas using the instances.
- Added PartialNavigationUpdates for batched modifications
- Fixed partial update not sending the right area for the original position
#rb aris.theophanidis
#rb mikko.mononen
#rb mieszko.zielinski
#jira UE-195210#preflight 653bd451cc4d2d32203134e5

[CL 29185555 by yoan stamant in ue5-main branch]
2023-10-27 12:18:00 -04:00

45 lines
3.0 KiB
C

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "NavigationOctreeController.h"
#include "NavigationDirtyAreasController.h"
struct FNavigationDirtyElement;
struct FNavigationDataHandler
{
FNavigationOctreeController& OctreeController;
FNavigationDirtyAreasController& DirtyAreasController;
NAVIGATIONSYSTEM_API FNavigationDataHandler(FNavigationOctreeController& InOctreeController, FNavigationDirtyAreasController& InDirtyAreasController);
NAVIGATIONSYSTEM_API void ConstructNavOctree(const FVector& Origin, const float Radius, const ENavDataGatheringModeConfig DataGatheringMode, const float GatheringNavModifiersWarningLimitTime);
NAVIGATIONSYSTEM_API void RemoveNavOctreeElementId(const FOctreeElementId2& ElementId, int32 UpdateFlags);
NAVIGATIONSYSTEM_API FSetElementId RegisterNavOctreeElement(UObject& ElementOwner, INavRelevantInterface& ElementInterface, int32 UpdateFlags);
NAVIGATIONSYSTEM_API void AddElementToNavOctree(const FNavigationDirtyElement& DirtyElement);
/** Removes associated NavOctreeElement and invalidates associated pending updates. Also removes object from the list of children
* of the NavigationParent, if any.
* @param ElementOwner Object for which we must remove associated NavOctreeElement
* @param ElementInterface Object associated NavRelevantInterface to access NavigationParent when registered as children
* @param UpdateFlags Flags indicating in which context the method is called to allow/forbid certain operations
*
* @return True if associated NavOctreeElement has been removed or pending update has been invalidated; false otherwise.
*/
NAVIGATIONSYSTEM_API bool UnregisterNavOctreeElement(UObject& ElementOwner, INavRelevantInterface& ElementInterface, int32 UpdateFlags);
NAVIGATIONSYSTEM_API void UpdateNavOctreeElement(UObject& ElementOwner, INavRelevantInterface& ElementInterface, int32 UpdateFlags);
NAVIGATIONSYSTEM_API void UpdateNavOctreeParentChain(UObject& ElementOwner, bool bSkipElementOwnerUpdate = false);
NAVIGATIONSYSTEM_API bool UpdateNavOctreeElementBounds(UObject& Object, const FBox& NewBounds, const TConstArrayView<FBox> DirtyAreas);
NAVIGATIONSYSTEM_API void FindElementsInNavOctree(const FBox& QueryBox, const FNavigationOctreeFilter& Filter, TArray<FNavigationOctreeElement>& Elements);
NAVIGATIONSYSTEM_API bool ReplaceAreaInOctreeData(const UObject& Object, TSubclassOf<UNavArea> OldArea, TSubclassOf<UNavArea> NewArea, bool bReplaceChildClasses);
NAVIGATIONSYSTEM_API void AddLevelCollisionToOctree(ULevel& Level);
NAVIGATIONSYSTEM_API void RemoveLevelCollisionFromOctree(ULevel& Level);
NAVIGATIONSYSTEM_API void UpdateActorAndComponentsInNavOctree(AActor& Actor);
NAVIGATIONSYSTEM_API void ProcessPendingOctreeUpdates();
NAVIGATIONSYSTEM_API void DemandLazyDataGathering(FNavigationRelevantData& ElementData);
UE_DEPRECATED(5.4, "Use the overloaded version taking a list of areas as parameter instead.")
NAVIGATIONSYSTEM_API bool UpdateNavOctreeElementBounds(UObject& Object, const FBox& NewBounds, const FBox& DirtyArea);
};