4#include "../AI/BehaviorTree.h"
5#include "../BlueprintEditor/NodeStyleRegistry.h"
6#include <unordered_set>
13 namespace NodeGraphShared
42 if (
registryName.find(
"Condition") != std::string::npos ||
70 float posX,
float posY,
float width,
float height,
77 ImNodes::SetNodeGridSpacePos(nodeId,
ImVec2(posX, posY));
83 ImNodes::BeginNode(nodeId);
84 ImNodes::BeginNodeTitleBar();
86 ImNodes::EndNodeTitleBar();
90 ImNodes::BeginInputAttribute(nodeId * 10000);
91 ImGui::TextUnformatted(
"In");
92 ImNodes::EndInputAttribute();
93 ImNodes::PopColorStyle(); ImNodes::PopColorStyle();
95 ImGui::TextDisabled(
" ");
97 ImGui::Text(
"ID: %d", nodeId);
101 ImNodes::BeginOutputAttribute(nodeId * 10000 + 1);
102 ImGui::TextUnformatted(
"Out");
103 ImNodes::EndOutputAttribute();
104 ImNodes::PopColorStyle(); ImNodes::PopColorStyle();
115 ImNodes::PopColorStyle();
137 static_cast<float>(
config.pinRadius),
static_cast<float>(
config.pinOutlineThickness),
static_cast<float>(
config.pinHeaderHeight),
147 for (
const auto&
node :
tree->nodes)
153 ImVec2 pPos = ImNodes::GetNodeScreenSpacePos(
static_cast<int>(
node.id));
154 ImVec2 pDim = ImNodes::GetNodeDimensions(
static_cast<int>(
node.id));
155 ImVec2 cPos = ImNodes::GetNodeScreenSpacePos(
static_cast<int>(childId));
156 ImVec2 cDim = ImNodes::GetNodeDimensions(
static_cast<int>(childId));
158 const float po = ImNodes::GetStyle().PinOffset;
162 float curve = std::max(50.0f, std::abs(
p4.x -
p1.x) * 0.4f);
172 ImVec2 pPos = ImNodes::GetNodeScreenSpacePos(
static_cast<int>(
node.id));
173 ImVec2 pDim = ImNodes::GetNodeDimensions(
static_cast<int>(
node.id));
174 ImVec2 cPos = ImNodes::GetNodeScreenSpacePos(
static_cast<int>(
node.decoratorChildId));
175 ImVec2 cDim = ImNodes::GetNodeDimensions(
static_cast<int>(
node.decoratorChildId));
177 const float po = ImNodes::GetStyle().PinOffset;
181 float curve = std::max(50.0f, std::abs(
p4.x -
p1.x) * 0.4f);
BTNodeType
Behavior tree node types.
@ Action
Leaf node - performs an action.
@ Selector
OR node - succeeds if any child succeeds.
@ OnEvent
Phase 38b: OnEvent root - event-driven entry point (orange, event-triggered)
@ Sequence
AND node - succeeds if all children succeed.
@ Inverter
Decorator - inverts child result.
@ Condition
Leaf node - checks a condition.
@ Repeater
Decorator - repeats child N times.
@ Root
Phase 38b: Root node - entry point of behavior tree (green, fixed position)
ComponentTypeID GetComponentTypeID_Static()
const NodeStyle & GetStyle(NodeType type) const
Returns the style for the given node type.
static NodeStyleRegistry & Get()
Returns the singleton instance.
void DrawPinCircle(ImDrawList *drawList, const ImVec2 ¢er, float radius, ImU32 fillColor, ImU32 outlineColor, float outlineThickness)
void RenderBTNodeConnections(const BehaviorTreeAsset *tree, uint32_t activeNodeId)
void RenderNodeHeader(int nodeId, const NodeStyle &style, const char *icon, const std::string &title, bool isCurrentNode, float pulseTimer)
void RenderBTNode(const BTNode *node, const BTNodeLayout *layout, bool isCurrentNode, float currentZoom, float pulseTimer, const BTConfig &config, std::unordered_set< uint32_t > &positionedNodes)
ImVec2 ComputePinCenterScreen(int nodeId, const BTNodeLayout *layout, bool isOutput, float pinOffset, float headerPx, float currentZoom)
Compute the screen-space center position of a pin.
void RenderNodeVisual(int nodeId, const std::string &title, NodeType editorType, float posX, float posY, float width, float height, bool isCurrentNode, float currentZoom, float pulseTimer, float pinRadius, float pinOutline, float pinHeaderHeight, std::unordered_set< uint32_t > &positionedNodes)
static NodeType MapBTToEditor(BTNodeType t)
NodeType MapBTRegistryNameToEditor(const std::string ®istryName)
< Provides AssetID and INVALID_ASSET_ID
@ BT_OnEvent
Phase 38b: Event-driven root (green, event-triggered)
@ BT_SubGraph
Phase 8: references a subgraph by UUID (BehaviorTree)
@ BT_Root
Phase 38b: Root entry point (green, fixed position)
const char * NodeTypeToString(NodeType type)
Represents a single node in a behavior tree.
Layout information for a single behavior tree node.
Visual descriptor for a single node type.
const char * icon
Short ASCII icon displayed before the node title (no emoji/extended chars).