Ember
Loading...
Searching...
No Matches
BehaviorTreeScene Class Reference

Scene implementation for behavior tree visualization. More...

#include <BehaviorTreeScene.h>

Inheritance diagram for BehaviorTreeScene:
IScene

Public Types

using NodeSelectionCallback = std::function<void(EmberCore::ITreeNode *)>

Public Member Functions

 BehaviorTreeScene (wxWindow *parent, const wxString &title="Behavior Tree")
 Construct a new BehaviorTreeScene.
virtual ~BehaviorTreeScene ()
wxPanel * GetPanel () override
 Returns the wxPanel used as the scene content.
wxString GetTitle () const override
 Returns the display title of the scene.
wxString GetSceneType () const override
 Returns the scene type identifier.
void OnActivated () override
 Called when the scene becomes active.
void OnDeactivated () override
 Called when the scene becomes inactive.
void Refresh () override
 Refreshes the scene content.
bool HasUnsavedChanges () const override
 Returns true if the scene has unsaved changes.
bool Save () override
 Saves the scene content; returns true on success.
void SetBehaviorTree (std::shared_ptr< EmberCore::Node > root)
 Set the behavior tree for this scene using legacy Node interface.
void SetBehaviorTree (std::shared_ptr< EmberCore::ITreeStructure > tree)
 Set the behavior tree for this scene using new abstraction interface.
EmberCore::NodeGetBehaviorTree () const
 Get the behavior tree root node (legacy interface)
EmberCore::ITreeStructureGetAbstractedTree () const
 Get the abstracted tree structure.
std::shared_ptr< EmberCore::ITreeStructureGetTreeAdapter () const
EmberForge::ForgeTreeCanvasGetTreeVisualization () const
void CreateSampleBehaviorTree ()
 Create a sample behavior tree for testing/demo purposes.
void SetTitle (const wxString &title)
 Set the title of this scene.
void SetNodeSelectionCallback (NodeSelectionCallback callback)
 Set callback for node selection events.
void SetCanvasBackgroundColor (const wxColour &color)
 Set the canvas background color.
 BehaviorTreeScene (const BehaviorTreeScene &)=delete
BehaviorTreeSceneoperator= (const BehaviorTreeScene &)=delete
Public Member Functions inherited from IScene
virtual ~IScene ()=default
virtual bool IsClosable () const
 Returns true if the scene can be closed.

Private Member Functions

void CreateLayout ()

Private Attributes

wxPanel * m_panel
EmberForge::ForgeTreeCanvasm_treeVisualization
std::shared_ptr< EmberCore::Nodem_behaviorTreeRoot
std::shared_ptr< EmberCore::ITreeStructurem_treeAdapter
wxString m_title
bool m_hasUnsavedChanges
NodeSelectionCallback m_nodeSelectionCallback

Detailed Description

Scene implementation for behavior tree visualization.

This class encapsulates all behavior tree specific functionality that was previously embedded in MainPanel, allowing MainPanel to be generic.

Definition at line 21 of file BehaviorTreeScene.h.

Member Typedef Documentation

◆ NodeSelectionCallback

Definition at line 24 of file BehaviorTreeScene.h.

Constructor & Destructor Documentation

◆ BehaviorTreeScene() [1/2]

BehaviorTreeScene::BehaviorTreeScene ( wxWindow * parent,
const wxString & title = "Behavior Tree" )

Construct a new BehaviorTreeScene.

Parameters
parentParent window for the scene panel
titleTitle for this scene tab (optional)

Definition at line 8 of file BehaviorTreeScene.cpp.

◆ ~BehaviorTreeScene()

BehaviorTreeScene::~BehaviorTreeScene ( )
virtual

Definition at line 29 of file BehaviorTreeScene.cpp.

◆ BehaviorTreeScene() [2/2]

BehaviorTreeScene::BehaviorTreeScene ( const BehaviorTreeScene & )
delete

Member Function Documentation

◆ CreateLayout()

void BehaviorTreeScene::CreateLayout ( )
private

Definition at line 39 of file BehaviorTreeScene.cpp.

◆ CreateSampleBehaviorTree()

void BehaviorTreeScene::CreateSampleBehaviorTree ( )

Create a sample behavior tree for testing/demo purposes.

Definition at line 113 of file BehaviorTreeScene.cpp.

◆ GetAbstractedTree()

EmberCore::ITreeStructure * BehaviorTreeScene::GetAbstractedTree ( ) const
inline

Get the abstracted tree structure.

Returns
EmberCore::ITreeStructure* Abstracted tree or nullptr if no tree set

Definition at line 68 of file BehaviorTreeScene.h.

◆ GetBehaviorTree()

EmberCore::Node * BehaviorTreeScene::GetBehaviorTree ( ) const
inline

Get the behavior tree root node (legacy interface)

Returns
EmberCore::Node* Root node or nullptr if no tree set

Definition at line 62 of file BehaviorTreeScene.h.

◆ GetPanel()

wxPanel * BehaviorTreeScene::GetPanel ( )
inlineoverridevirtual

Returns the wxPanel used as the scene content.

Implements IScene.

Definition at line 36 of file BehaviorTreeScene.h.

◆ GetSceneType()

wxString BehaviorTreeScene::GetSceneType ( ) const
inlineoverridevirtual

Returns the scene type identifier.

Implements IScene.

Definition at line 38 of file BehaviorTreeScene.h.

◆ GetTitle()

wxString BehaviorTreeScene::GetTitle ( ) const
inlineoverridevirtual

Returns the display title of the scene.

Implements IScene.

Definition at line 37 of file BehaviorTreeScene.h.

◆ GetTreeAdapter()

std::shared_ptr< EmberCore::ITreeStructure > BehaviorTreeScene::GetTreeAdapter ( ) const
inline

Definition at line 70 of file BehaviorTreeScene.h.

◆ GetTreeVisualization()

EmberForge::ForgeTreeCanvas * BehaviorTreeScene::GetTreeVisualization ( ) const
inline

Definition at line 71 of file BehaviorTreeScene.h.

◆ HasUnsavedChanges()

bool BehaviorTreeScene::HasUnsavedChanges ( ) const
inlineoverridevirtual

Returns true if the scene has unsaved changes.

Reimplemented from IScene.

Definition at line 42 of file BehaviorTreeScene.h.

◆ OnActivated()

void BehaviorTreeScene::OnActivated ( )
overridevirtual

Called when the scene becomes active.

Reimplemented from IScene.

Definition at line 59 of file BehaviorTreeScene.cpp.

◆ OnDeactivated()

void BehaviorTreeScene::OnDeactivated ( )
overridevirtual

Called when the scene becomes inactive.

Reimplemented from IScene.

Definition at line 66 of file BehaviorTreeScene.cpp.

◆ operator=()

BehaviorTreeScene & BehaviorTreeScene::operator= ( const BehaviorTreeScene & )
delete

◆ Refresh()

void BehaviorTreeScene::Refresh ( )
overridevirtual

Refreshes the scene content.

Reimplemented from IScene.

Definition at line 68 of file BehaviorTreeScene.cpp.

◆ Save()

bool BehaviorTreeScene::Save ( )
overridevirtual

Saves the scene content; returns true on success.

Reimplemented from IScene.

Definition at line 74 of file BehaviorTreeScene.cpp.

◆ SetBehaviorTree() [1/2]

void BehaviorTreeScene::SetBehaviorTree ( std::shared_ptr< EmberCore::ITreeStructure > tree)

Set the behavior tree for this scene using new abstraction interface.

Parameters
treeTree structure to visualize

Definition at line 101 of file BehaviorTreeScene.cpp.

◆ SetBehaviorTree() [2/2]

void BehaviorTreeScene::SetBehaviorTree ( std::shared_ptr< EmberCore::Node > root)

Set the behavior tree for this scene using legacy Node interface.

Parameters
rootRoot node of the behavior tree (for backward compatibility)

Definition at line 79 of file BehaviorTreeScene.cpp.

◆ SetCanvasBackgroundColor()

void BehaviorTreeScene::SetCanvasBackgroundColor ( const wxColour & color)

Set the canvas background color.

Parameters
colorBackground color to apply

Definition at line 138 of file BehaviorTreeScene.cpp.

◆ SetNodeSelectionCallback()

void BehaviorTreeScene::SetNodeSelectionCallback ( NodeSelectionCallback callback)
inline

Set callback for node selection events.

Parameters
callbackFunction to call when a node is selected in the scene view

Definition at line 88 of file BehaviorTreeScene.h.

◆ SetTitle()

void BehaviorTreeScene::SetTitle ( const wxString & title)

Set the title of this scene.

Parameters
titleNew title for the scene tab

Definition at line 136 of file BehaviorTreeScene.cpp.

Member Data Documentation

◆ m_behaviorTreeRoot

std::shared_ptr<EmberCore::Node> BehaviorTreeScene::m_behaviorTreeRoot
private

Definition at line 108 of file BehaviorTreeScene.h.

◆ m_hasUnsavedChanges

bool BehaviorTreeScene::m_hasUnsavedChanges
private

Definition at line 111 of file BehaviorTreeScene.h.

◆ m_nodeSelectionCallback

NodeSelectionCallback BehaviorTreeScene::m_nodeSelectionCallback
private

Definition at line 114 of file BehaviorTreeScene.h.

◆ m_panel

wxPanel* BehaviorTreeScene::m_panel
private

Definition at line 104 of file BehaviorTreeScene.h.

◆ m_title

wxString BehaviorTreeScene::m_title
private

Definition at line 110 of file BehaviorTreeScene.h.

◆ m_treeAdapter

std::shared_ptr<EmberCore::ITreeStructure> BehaviorTreeScene::m_treeAdapter
private

Definition at line 109 of file BehaviorTreeScene.h.

◆ m_treeVisualization

EmberForge::ForgeTreeCanvas* BehaviorTreeScene::m_treeVisualization
private

Definition at line 105 of file BehaviorTreeScene.h.


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