LogNavOctree

LogNavOctree

#Overview

name: LogNavOctree

This variable is created as a Console Variable (cvar).

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LogNavOctree is to provide logging functionality for the navigation octree system in Unreal Engine 5. It is used to log various operations and events related to the navigation octree, which is a data structure used for efficient spatial partitioning and querying in navigation systems.

This setting variable is primarily used by the Navigation System module in Unreal Engine 5. Based on the callsites, it is heavily utilized in the NavigationDataHandler class, which is responsible for managing navigation data and the navigation octree.

The value of this variable is likely set through the engine’s logging configuration system, typically in the project settings or through command-line arguments.

LogNavOctree interacts with other navigation-related systems and variables, such as FNavigationOctree, FNavigationDataHandler, and various navigation-related functions.

Developers must be aware that this logging variable can provide valuable information for debugging and understanding the behavior of the navigation system, particularly when working with complex navigation scenarios or optimizing performance.

Best practices when using this variable include:

  1. Enable it selectively during development and debugging phases, as excessive logging can impact performance.
  2. Use it in conjunction with other navigation-related logs to get a comprehensive view of the navigation system’s behavior.
  3. Be mindful of the log verbosity levels (Log, Warning, Error) to prioritize important information.
  4. Consider disabling or reducing the verbosity of this log in shipping builds to minimize performance overhead.
  5. Use the logged information to identify potential issues in navigation data generation, updates, and queries.

By leveraging LogNavOctree effectively, developers can gain insights into the navigation system’s inner workings and troubleshoot navigation-related issues more efficiently.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VisualLogger/VisualLogger.cpp:1216

Scope (from outer to inner):

file
class        class FLogVisualizerExec : private FSelfRegisteringExec
function     virtual bool Exec_Dev

Source code excerpt:

			}
		}
		else if (FParse::Command(&Cmd, TEXT("LogNavOctree")))
		{
			FVisualLogger::NavigationDataDump(GetWorldForVisualLogger(InWorld), LogNavigation, ELogVerbosity::Log, FBox());
		}

		return false;
	}

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:32

Scope (from outer to inner):

file
function     void FNavigationDataHandler::ConstructNavOctree

Source code excerpt:

void FNavigationDataHandler::ConstructNavOctree(const FVector& Origin, const float Radius, const ENavDataGatheringModeConfig DataGatheringMode, const float GatheringNavModifiersWarningLimitTime)
{
	UE_LOG(LogNavOctree, Log, TEXT("CREATE (Origin:%s Radius:%.2f)"), *Origin.ToString(), Radius);

	OctreeController.Reset();
	OctreeController.NavOctree = MakeShareable(new FNavigationOctree(Origin, Radius));
	OctreeController.NavOctree->SetDataGatheringMode(DataGatheringMode);
#if !UE_BUILD_SHIPPING
	OctreeController.NavOctree->SetGatheringNavModifiersTimeLimitWarning(GatheringNavModifiersWarningLimitTime);

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:71

Scope (from outer to inner):

file
function     FSetElementId FNavigationDataHandler::RegisterNavOctreeElement

Source code excerpt:

	if (OctreeController.IsNavigationOctreeLocked())
	{
		UE_LOG(LogNavOctree, Log, TEXT("IGNORE(RegisterNavOctreeElement) %s"), *GetPathNameSafe(&ElementOwner));
		return SetId;
	}

	const bool bIsRelevant = ElementInterface.IsNavigationRelevant();
	UE_LOG(LogNavOctree, Log, TEXT("REG %s %s"), *UE::NavigationHelper::Private::GetElementName(ElementOwner), bIsRelevant ? TEXT("[relevant]") : TEXT("[skip]"));

	if (bIsRelevant)
	{
		bool bCanAdd = false;

		UObject* ParentNode = ElementInterface.GetNavigationParent();

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:164

Scope (from outer to inner):

file
function     void FNavigationDataHandler::AddElementToNavOctree

Source code excerpt:

		if (ElementId && ensure(OctreeController.IsValidElement(*ElementId)))
		{
			UE_LOG(LogNavOctree, Log, TEXT("ADD %s to %s"), *UE::NavigationHelper::Private::GetElementName(*ElementOwner), *GetNameSafe(NavigationParent));
			OctreeController.NavOctree->AppendToNode(*ElementId, DirtyElement.NavInterface, ElementBounds, GeneratedData);
		}
		else
		{
			UE_LOG(LogNavOctree, Warning, TEXT("Can't add node [%s] - parent [%s] not found in octree!"), *UE::NavigationHelper::Private::GetElementName(*ElementOwner), *UE::NavigationHelper::Private::GetElementName(*NavigationParent));
		}
	}
	else
	{
		UE_LOG(LogNavOctree, Log, TEXT("ADD %s"), *UE::NavigationHelper::Private::GetElementName(*ElementOwner));
		OctreeController.NavOctree->AddNode(ElementOwner, DirtyElement.NavInterface, ElementBounds, GeneratedData);
	}

	// mark area occupied by given element as dirty except if explicitly set to skip this default behavior
	const int32 DirtyFlag = DirtyElement.FlagsOverride ? DirtyElement.FlagsOverride : GeneratedData.Data->GetDirtyFlag();
	if (GeneratedData.Data->bShouldSkipDirtyAreaOnAddOrRemove)

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:205

Scope (from outer to inner):

file
function     bool FNavigationDataHandler::UnregisterNavOctreeElement

Source code excerpt:

	{
#if !WITH_EDITOR
		UE_LOG(LogNavOctree, Log, TEXT("IGNORE(UnregisterNavOctreeElement) %s"), *GetPathNameSafe(&ElementOwner));
#endif // WITH_EDITOR
		return false;
	}

	bool bUnregistered = false;
	const FOctreeElementId2* ElementId = OctreeController.GetObjectsNavOctreeId(ElementOwner);
	UE_LOG(LogNavOctree, Log, TEXT("UNREG %s %s"), *UE::NavigationHelper::Private::GetElementName(ElementOwner), ElementId ? TEXT("[exists]") : TEXT("[doesn\'t exist]"));

	if (ElementId != nullptr)
	{
		RemoveNavOctreeElementId(*ElementId, UpdateFlags);
		OctreeController.RemoveObjectsNavOctreeId(ElementOwner);
		bUnregistered = true;

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:261

Scope (from outer to inner):

file
function     void FNavigationDataHandler::UpdateNavOctreeElement

Source code excerpt:

	if (OctreeController.IsNavigationOctreeLocked())
	{
		UE_LOG(LogNavOctree, Log, TEXT("IGNORE(UpdateNavOctreeElement) %s"), *ElementOwner.GetPathName());
		return;
	}

	// grab existing octree data
	FBox CurrentBounds;
	int32 CurrentFlags;

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:420

Scope (from outer to inner):

file
function     void FNavigationDataHandler::FindElementsInNavOctree

Source code excerpt:

	if (OctreeController.NavOctree.IsValid() == false)
	{
		UE_LOG(LogNavOctree, Warning, TEXT("FNavigationDataHandler::FindElementsInNavOctree gets called while NavOctree is null"));
		return;
	}

	OctreeController.NavOctree->FindElementsWithBoundsTest(QueryBox, [&Elements, &Filter](const FNavigationOctreeElement& Element)
	{
		if (Element.IsMatchingFilter(Filter))

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:504

Scope (from outer to inner):

file
function     void FNavigationDataHandler::AddLevelCollisionToOctree

Source code excerpt:

				DirtyAreasController.AddArea(Bounds, ENavigationDirtyFlag::All, [&Level] { return &Level; }, nullptr, "Add level");

				UE_LOG(LogNavOctree, Log, TEXT("ADD %s"), *UE::NavigationHelper::Private::GetElementName(Level));
			}
		}
	}
#endif// WITH_RECAST
}

#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavigationDataHandler.cpp:516

Scope (from outer to inner):

file
function     void FNavigationDataHandler::RemoveLevelCollisionFromOctree

Source code excerpt:

	{
		const FOctreeElementId2* ElementId = OctreeController.GetObjectsNavOctreeId(Level);
		UE_LOG(LogNavOctree, Log, TEXT("UNREG %s %s"), *UE::NavigationHelper::Private::GetElementName(Level), ElementId ? TEXT("[exists]") : TEXT(""));

		if (ElementId != nullptr)
		{
			if (ensure(OctreeController.IsValidElement(*ElementId)))
			{
				// mark area occupied by given actor as dirty