Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Static Public Member Functions | Private Member Functions | List of all members
Olympe::NodeGraphShared::BTGraphDocumentConverter Class Reference

Converts a BehaviorTreeAsset into an Olympe::NodeGraph for display in the NodeGraphPanel (Blueprint Editor pipeline). More...

#include <BTGraphDocumentConverter.h>

Static Public Member Functions

static NodeGraphFromBehaviorTree (const BehaviorTreeAsset *tree)
 Converts a BehaviorTreeAsset into a heap-allocated NodeGraph.
 
static void SyncActiveNode (NodeGraph *graph, uint32_t currentNodeId)
 Synchronises the active-node metadata in an existing NodeGraph.
 

Private Member Functions

 BTGraphDocumentConverter ()=delete
 

Detailed Description

Converts a BehaviorTreeAsset into an Olympe::NodeGraph for display in the NodeGraphPanel (Blueprint Editor pipeline).

The resulting NodeGraph preserves the original BT node IDs so that NodeGraphPanel::SetActiveDebugNode() works directly with BT node indices.

Definition at line 29 of file BTGraphDocumentConverter.h.

Constructor & Destructor Documentation

◆ BTGraphDocumentConverter()

Olympe::NodeGraphShared::BTGraphDocumentConverter::BTGraphDocumentConverter ( )
privatedelete

Member Function Documentation

◆ FromBehaviorTree()

NodeGraph * Olympe::NodeGraphShared::BTGraphDocumentConverter::FromBehaviorTree ( const BehaviorTreeAsset tree)
static

Converts a BehaviorTreeAsset into a heap-allocated NodeGraph.

Two-priority loading strategy:

  1. JSON source file (preferred): queries BehaviorTreeManager::GetTreePathFromId() to obtain the asset path, then calls NodeGraphManager::LoadGraph() to parse the file. This preserves the visual positions saved in the JSON, making the debugger layout identical to the Blueprint Editor standalone view. ClearDirty() is called on the resulting graph because the debugger is read-only. The temporary graph slot in NodeGraphManager is closed immediately after cloning.
  2. BFS fallback: used when the path is unknown (prefixed "TreeName:") or when LoadGraph returns -1. Positions are computed by BTGraphLayoutEngine.
Parameters
treeBehaviorTree asset to convert (non-null).
Returns
Newly allocated NodeGraph (caller takes ownership). Returns nullptr if tree is null.

Definition at line 41 of file BTGraphDocumentConverter.cpp.

References Olympe::NodeGraph::ClearDirty(), Olympe::NodeGraphManager::CloseGraph(), Olympe::BTGraphLayoutEngine::ComputeLayout(), BehaviorTreeManager::Get(), Olympe::NodeGraphManager::Get(), GetComponentTypeID_Static(), Olympe::NodeGraphManager::GetGraph(), BehaviorTreeManager::GetTreePathFromId(), Olympe::NodeGraphManager::LoadGraph(), Olympe::NodeGraphShared::MapBTToEditor(), Olympe::NodeGraph::name, Olympe::NodeTypeToString(), Olympe::BTNodeLayout::position, and Vector::x.

Referenced by Olympe::BehaviorTreeDebugWindow::RenderNodeGraphDebugPanel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SyncActiveNode()

void Olympe::NodeGraphShared::BTGraphDocumentConverter::SyncActiveNode ( NodeGraph graph,
uint32_t  currentNodeId 
)
static

Synchronises the active-node metadata in an existing NodeGraph.

No-op for the NodeGraph model; actual highlight is driven by NodeGraphPanel::SetActiveDebugNode(). Kept for API symmetry.

Parameters
graphTarget graph (may be null — safely ignored).
currentNodeIdBT node currently executing.

Definition at line 147 of file BTGraphDocumentConverter.cpp.

Referenced by Olympe::BehaviorTreeDebugWindow::RenderNodeGraphDebugPanel().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: