Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
BehaviorTreeDebugWindow.cpp File Reference

Implementation of behavior tree runtime debugger. More...

#include "BehaviorTreeDebugWindow.h"
#include "BTEditorCommand.h"
#include "../World.h"
#include "../GameEngine.h"
#include "../ECS_Components.h"
#include "../ECS_Components_AI.h"
#include "../json_helper.h"
#include "../third_party/imgui/imgui.h"
#include "../third_party/imnodes/imnodes.h"
#include "../third_party/imgui/backends/imgui_impl_sdl3.h"
#include "../third_party/imgui/backends/imgui_impl_sdlrenderer3.h"
#include "../third_party/nlohmann/json.hpp"
#include <SDL3/SDL.h>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <ctime>
#include <fstream>
#include <unordered_set>
#include <set>
+ Include dependency graph for BehaviorTreeDebugWindow.cpp:

Go to the source code of this file.

Namespaces

namespace  Olympe
 

Functions

 Olympe::for (auto &node :m_editingTree.nodes)
 
m_selectedNodes clear ()
 
toVisit push_back (childId)
 
 while (!toVisit.empty())
 

Variables

constexpr float Olympe::MIN_ZOOM = 0.3f
 
constexpr float Olympe::MAX_ZOOM = 3.0f
 
constexpr float Olympe::ZOOM_EPSILON = 0.001f
 
 m_isDirty = true
 
 m_treeModified = true
 
 m_currentLayout = m_layoutEngine.ComputeLayout(&m_editingTree, m_nodeSpacingX, m_nodeSpacingY, m_currentZoom)
 
 m_validationMessages = m_editingTree.ValidateTreeFull()
 
std::cout<< "[BTEditor] Duplicated node: "<< duplicate.name<< " (ID: "<< duplicate.id<< ")"<< std::endl;} } m_selectedNodes=newNodes;m_treeModified=true;m_currentLayout=m_layoutEngine.ComputeLayout(&m_editingTree, m_nodeSpacingX, m_nodeSpacingY, m_currentZoom);m_validationMessages=m_editingTree.ValidateTreeFull();} bool BehaviorTreeDebugWindow::ValidateConnection(uint32_t parentId, uint32_t childId) const { const BTNode *parent=m_editingTree.GetNode(parentId);const BTNode *child=m_editingTree.GetNode(childId);if(!parent||!child) return false;if(parentId==childId) return false;if(parent->type !=BTNodeType::Selector &&parent->type !=BTNodeType::Sequence &&parent->type !=BTNodeType::Inverter &&parent->type !=BTNodeType::Repeater) { return false;} if((parent->type==BTNodeType::Inverter||parent->type==BTNodeType::Repeater) &&parent->decoratorChildId !=0) { return false;} if(parent->type==BTNodeType::Selector||parent->type==BTNodeType::Sequence) { if(std::find(parent->childIds.begin(), parent->childIds.end(), childId) !=parent->childIds.end()) { return false;} } std::vector< uint32_tvisited
 
std::vector< uint32_ttoVisit
 
return true
 

Detailed Description

Implementation of behavior tree runtime debugger.

Definition in file BehaviorTreeDebugWindow.cpp.

Function Documentation

◆ clear()

m_selectedNodes clear ( )

◆ push_back()

toVisit push_back ( childId  )

Referenced by EventQueue::Push(), to_json(), to_json(), to_json(), to_json(), to_json(), to_json(), to_json(), to_json(), and Olympe::NodeGraph::ToJson().

+ Here is the caller graph for this function:

◆ while()

while ( !toVisit.  empty())

Definition at line 2137 of file BehaviorTreeDebugWindow.cpp.

References GetComponentTypeID_Static(), toVisit, and visited.

+ Here is the call graph for this function:

Variable Documentation

◆ m_currentLayout

m_currentLayout = m_layoutEngine.ComputeLayout(&m_editingTree, m_nodeSpacingX, m_nodeSpacingY, m_currentZoom)

◆ m_isDirty

m_isDirty = true

◆ m_treeModified

m_treeModified = true

◆ m_validationMessages

m_validationMessages = m_editingTree.ValidateTreeFull()

◆ toVisit

Definition at line 2134 of file BehaviorTreeDebugWindow.cpp.

Referenced by while().

◆ true

return true

Definition at line 2168 of file BehaviorTreeDebugWindow.cpp.

◆ visited

std::cout<< "[BTEditor] Duplicated node: " << duplicate.name << " (ID: " << duplicate.id << ")" << std::endl; } } m_selectedNodes = newNodes; m_treeModified = true; m_currentLayout = m_layoutEngine.ComputeLayout(&m_editingTree, m_nodeSpacingX, m_nodeSpacingY, m_currentZoom); m_validationMessages = m_editingTree.ValidateTreeFull(); } bool BehaviorTreeDebugWindow::ValidateConnection(uint32_t parentId, uint32_t childId) const { const BTNode* parent = m_editingTree.GetNode(parentId); const BTNode* child = m_editingTree.GetNode(childId); if (!parent || !child) return false; if (parentId == childId) return false; if (parent->type != BTNodeType::Selector && parent->type != BTNodeType::Sequence && parent->type != BTNodeType::Inverter && parent->type != BTNodeType::Repeater) { return false; } if ((parent->type == BTNodeType::Inverter || parent->type == BTNodeType::Repeater) && parent->decoratorChildId != 0) { return false; } if (parent->type == BTNodeType::Selector || parent->type == BTNodeType::Sequence) { if (std::find(parent->childIds.begin(), parent->childIds.end(), childId) != parent->childIds.end()) { return false; } } std::vector<uint32_t> visited