22#include "../AI/BehaviorTree.h"
ComponentTypeID GetComponentTypeID_Static()
Computes clean hierarchical layouts for behavior trees.
bool DoNodesOverlap(const BTNodeLayout &a, const BTNodeLayout &b, float padding) const
void ShiftSubtree(uint32_t nodeId, const BehaviorTreeAsset *tree, float offset)
const BTNodeLayout * GetNodeLayout(uint32_t nodeId) const
Get computed layout for a specific node.
void PlaceSubtree(uint32_t nodeId, const BehaviorTreeAsset *tree, int depth, float &nextAvailableX)
void ResolveCollisions(float nodeSpacingX)
std::map< uint32_t, size_t > m_nodeIdToIndex
void ApplyBuchheimWalkerLayout(const BehaviorTreeAsset *tree)
std::vector< uint32_t > GetChildren(const BTNode *node) const
void BuildParentMap(const BehaviorTreeAsset *tree)
void SetLayoutDirection(BTLayoutDirection direction)
Set layout direction.
BTLayoutDirection GetLayoutDirection() const
Get current layout direction.
void AssignXCoordinates(float nodeSpacingX)
BTLayoutDirection m_layoutDirection
Default vertical.
std::map< uint32_t, std::vector< uint32_t > > m_parentMap
std::vector< BTNodeLayout > ComputeLayout(const BehaviorTreeAsset *tree, float nodeSpacingX=180.0f, float nodeSpacingY=120.0f, float zoomFactor=1.0f)
Compute layout for a behavior tree.
void ReduceCrossings(const BehaviorTreeAsset *tree)
void ResolveNodeCollisionsForceDirected(float nodePadding, int maxIterations)
void PushNodeApart(uint32_t nodeA, uint32_t nodeB, float minDistance)
~BTGraphLayoutEngine()=default
int CountEdgeCrossings(const BehaviorTreeAsset *tree) const
float CalculateBarycenter(uint32_t nodeId, const std::vector< BTNodeLayout * > &neighbors) const
std::vector< BTNodeLayout > m_layouts
void AssignLayers(const BehaviorTreeAsset *tree)
std::vector< std::vector< uint32_t > > m_layers
BTLayoutDirection
Layout direction for behavior tree visualization.
@ LeftToRight
Horizontal left-to-right layout.
@ TopToBottom
Traditional top-down layout (vertical)
Represents a single node in a behavior tree.
Layout information for a single behavior tree node.
int orderInLayer
Order within the layer.
Vector position
Final position (x, y)
float height
Node visual height (increased for readability)
uint32_t nodeId
BT node ID.
int layer
Hierarchical layer (0 = root)
float width
Node visual width (increased for readability)