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

Adapter for visualizing BehaviorTree runtime using unified renderer. More...

#include <BTDebugAdapter.h>

+ Collaboration diagram for Olympe::NodeGraphShared::BTDebugAdapter:

Public Member Functions

 BTDebugAdapter (const BehaviorTreeAsset *tree, BTGraphLayoutEngine *layoutEngine)
 Construct a debug adapter for a behavior tree.
 
 ~BTDebugAdapter ()
 
void Initialize (NodeGraph::NodeGraphRenderer *renderer, const NodeGraph::RenderConfig *config=nullptr)
 Initialize the adapter with a renderer instance.
 
void Shutdown ()
 Shutdown and cleanup resources.
 
bool IsInitialized () const
 Check if adapter is ready to render.
 
void SetActiveNode (uint32_t nodeId)
 Set the currently executing node (for highlighting)
 
void ClearRuntimeState ()
 Clear all runtime highlighting.
 
uint32_t GetActiveNodeId () const
 Get current active node ID.
 
void RecomputeLayout (float nodeSpacingX, float nodeSpacingY, float zoomFactor)
 Recompute layout (call after tree structure changes)
 
bool UpdateNodePosition (uint32_t nodeId, float x, float y)
 Update a single node position (user drag in editor mode)
 
void FitToView ()
 Fit graph to view (auto-zoom)
 
void CenterOnActiveNode ()
 Center view on active node.
 
void Render (float deltaTime)
 Render the behavior tree using unified pipeline.
 
void SetEditorMode (bool enabled)
 Enable editor mode (allows modifications via commands)
 
bool IsEditorMode () const
 Check if adapter is in editor mode.
 

Private Member Functions

void EnsureGraphDocumentConverted ()
 
void ConvertBehaviorTreeToDocument ()
 
void SyncLayoutToDocument ()
 
void ApplyRuntimeHighlighting ()
 

Private Attributes

const BehaviorTreeAssetm_tree
 
BTGraphLayoutEnginem_layoutEngine
 
NodeGraph::NodeGraphRenderer * m_renderer
 
std::unique_ptr< NodeGraph::GraphDocumentm_document
 
bool m_documentDirty
 
uint32_t m_activeNodeId
 
bool m_editorMode
 
std::vector< BTNodeLayoutm_currentLayout
 
float m_lastNodeSpacingX
 
float m_lastNodeSpacingY
 
float m_lastZoomFactor
 

Detailed Description

Adapter for visualizing BehaviorTree runtime using unified renderer.

Usage in BehaviorTreeDebugWindow:

// Setup (once per tree load)
adapter.Initialize(&renderer);
// Update active node each frame
adapter.SetActiveNode(btRuntime.AICurrentNodeIndex);
// Render
adapter.Render(deltaTime);
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static SDL_Renderer * renderer
Adapter for visualizing BehaviorTree runtime using unified renderer.

Definition at line 54 of file BTDebugAdapter.h.

Constructor & Destructor Documentation

◆ BTDebugAdapter()

Olympe::NodeGraphShared::BTDebugAdapter::BTDebugAdapter ( const BehaviorTreeAsset tree,
BTGraphLayoutEngine layoutEngine 
)

Construct a debug adapter for a behavior tree.

Parameters
treeBehaviorTree runtime asset to visualize
layoutEngineLayout engine for node positioning

◆ ~BTDebugAdapter()

Olympe::NodeGraphShared::BTDebugAdapter::~BTDebugAdapter ( )

Member Function Documentation

◆ ApplyRuntimeHighlighting()

void Olympe::NodeGraphShared::BTDebugAdapter::ApplyRuntimeHighlighting ( )
private

◆ CenterOnActiveNode()

void Olympe::NodeGraphShared::BTDebugAdapter::CenterOnActiveNode ( )

Center view on active node.

◆ ClearRuntimeState()

void Olympe::NodeGraphShared::BTDebugAdapter::ClearRuntimeState ( )

Clear all runtime highlighting.

◆ ConvertBehaviorTreeToDocument()

void Olympe::NodeGraphShared::BTDebugAdapter::ConvertBehaviorTreeToDocument ( )
private

◆ EnsureGraphDocumentConverted()

void Olympe::NodeGraphShared::BTDebugAdapter::EnsureGraphDocumentConverted ( )
private

◆ FitToView()

void Olympe::NodeGraphShared::BTDebugAdapter::FitToView ( )

Fit graph to view (auto-zoom)

◆ GetActiveNodeId()

uint32_t Olympe::NodeGraphShared::BTDebugAdapter::GetActiveNodeId ( ) const
inline

Get current active node ID.

Definition at line 111 of file BTDebugAdapter.h.

References m_activeNodeId.

◆ Initialize()

void Olympe::NodeGraphShared::BTDebugAdapter::Initialize ( NodeGraph::NodeGraphRenderer *  renderer,
const NodeGraph::RenderConfig *  config = nullptr 
)

Initialize the adapter with a renderer instance.

Parameters
rendererNodeGraphRenderer to use (must outlive adapter)
configOptional render configuration (nullptr = use defaults)

◆ IsEditorMode()

bool Olympe::NodeGraphShared::BTDebugAdapter::IsEditorMode ( ) const
inline

Check if adapter is in editor mode.

Definition at line 167 of file BTDebugAdapter.h.

References m_editorMode.

◆ IsInitialized()

bool Olympe::NodeGraphShared::BTDebugAdapter::IsInitialized ( ) const
inline

Check if adapter is ready to render.

Definition at line 91 of file BTDebugAdapter.h.

References m_renderer.

◆ RecomputeLayout()

void Olympe::NodeGraphShared::BTDebugAdapter::RecomputeLayout ( float  nodeSpacingX,
float  nodeSpacingY,
float  zoomFactor 
)

Recompute layout (call after tree structure changes)

Parameters
nodeSpacingXHorizontal spacing between nodes
nodeSpacingYVertical spacing between nodes
zoomFactorCurrent zoom level

◆ Render()

void Olympe::NodeGraphShared::BTDebugAdapter::Render ( float  deltaTime)

Render the behavior tree using unified pipeline.

Parameters
deltaTimeTime since last frame (for animations)

◆ SetActiveNode()

void Olympe::NodeGraphShared::BTDebugAdapter::SetActiveNode ( uint32_t  nodeId)

Set the currently executing node (for highlighting)

Parameters
nodeIdID of active node (0 = none)

◆ SetEditorMode()

void Olympe::NodeGraphShared::BTDebugAdapter::SetEditorMode ( bool  enabled)

Enable editor mode (allows modifications via commands)

Parameters
commandStackCommand stack for undo/redo (nullptr = read-only)

◆ Shutdown()

void Olympe::NodeGraphShared::BTDebugAdapter::Shutdown ( )

Shutdown and cleanup resources.

◆ SyncLayoutToDocument()

void Olympe::NodeGraphShared::BTDebugAdapter::SyncLayoutToDocument ( )
private

◆ UpdateNodePosition()

bool Olympe::NodeGraphShared::BTDebugAdapter::UpdateNodePosition ( uint32_t  nodeId,
float  x,
float  y 
)

Update a single node position (user drag in editor mode)

Parameters
nodeIdNode to move
xNew X position
yNew Y position
Returns
true if position updated successfully

Member Data Documentation

◆ m_activeNodeId

uint32_t Olympe::NodeGraphShared::BTDebugAdapter::m_activeNodeId
private

Definition at line 188 of file BTDebugAdapter.h.

Referenced by GetActiveNodeId().

◆ m_currentLayout

std::vector<BTNodeLayout> Olympe::NodeGraphShared::BTDebugAdapter::m_currentLayout
private

Definition at line 192 of file BTDebugAdapter.h.

◆ m_document

std::unique_ptr<NodeGraph::GraphDocument> Olympe::NodeGraphShared::BTDebugAdapter::m_document
private

Definition at line 184 of file BTDebugAdapter.h.

◆ m_documentDirty

bool Olympe::NodeGraphShared::BTDebugAdapter::m_documentDirty
private

Definition at line 185 of file BTDebugAdapter.h.

◆ m_editorMode

bool Olympe::NodeGraphShared::BTDebugAdapter::m_editorMode
private

Definition at line 189 of file BTDebugAdapter.h.

Referenced by IsEditorMode().

◆ m_lastNodeSpacingX

float Olympe::NodeGraphShared::BTDebugAdapter::m_lastNodeSpacingX
private

Definition at line 193 of file BTDebugAdapter.h.

◆ m_lastNodeSpacingY

float Olympe::NodeGraphShared::BTDebugAdapter::m_lastNodeSpacingY
private

Definition at line 194 of file BTDebugAdapter.h.

◆ m_lastZoomFactor

float Olympe::NodeGraphShared::BTDebugAdapter::m_lastZoomFactor
private

Definition at line 195 of file BTDebugAdapter.h.

◆ m_layoutEngine

BTGraphLayoutEngine* Olympe::NodeGraphShared::BTDebugAdapter::m_layoutEngine
private

Definition at line 180 of file BTDebugAdapter.h.

◆ m_renderer

NodeGraph::NodeGraphRenderer* Olympe::NodeGraphShared::BTDebugAdapter::m_renderer
private

Definition at line 181 of file BTDebugAdapter.h.

Referenced by IsInitialized().

◆ m_tree

const BehaviorTreeAsset* Olympe::NodeGraphShared::BTDebugAdapter::m_tree
private

Definition at line 179 of file BTDebugAdapter.h.


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