11#include "../system/system_consts.h"
15#include "../third_party/imgui/imgui.h"
16#include "../third_party/imnodes/imnodes.h"
20#include <unordered_set>
56 default:
return IM_COL32(80, 80, 80, 255);
70 default:
return IM_COL32(110, 110, 110, 255);
106 default:
return "Unknown";
120 default:
return "None";
138 std::string result =
"[";
142 result +=
operand.variableName;
167 return left +
" " +
condition.operatorStr +
" " + right;
184 std::string displayLabel =
baseName;
211 const std::vector<std::pair<std::string, VariableType>>&
dataInputPins,
212 const std::vector<std::pair<std::string, VariableType>>&
dataOutputPins)
322 const std::string& nodeName,
328 const std::vector<std::pair<std::string, VariableType>>&
dataInputPins,
329 const std::vector<std::pair<std::string, VariableType>>&
dataOutputPins,
337 unsigned int titleCol = hasBreakpoint
358 ImNodes::BeginNodeTitleBar();
359 ImGui::TextUnformatted(nodeName.c_str());
360 ImNodes::EndNodeTitleBar();
412 ImGui::Columns(2,
"node_pins",
false);
413 ImGui::SetColumnWidth(0, 80.0f);
425 ImNodes::EndInputAttribute();
426 ImNodes::PopColorStyle();
438 ImNodes::EndInputAttribute();
439 ImNodes::PopColorStyle();
453 ImNodes::EndOutputAttribute();
454 ImNodes::PopColorStyle();
466 ImNodes::EndOutputAttribute();
467 ImNodes::PopColorStyle();
475 ImNodes::PopColorStyle();
477 ImNodes::PopColorStyle();
478 ImNodes::PopColorStyle();
479 ImNodes::PopColorStyle();
495 const std::vector<std::pair<std::string, VariableType>>&
dataInputPins,
496 const std::vector<std::pair<std::string, VariableType>>&
dataOutputPins,
507 unsigned int titleCol = hasBreakpoint
526 ImNodes::BeginNodeTitleBar();
527 ImGui::TextUnformatted(def.
NodeName.c_str());
528 ImNodes::EndNodeTitleBar();
545 ImGui::Columns(2,
"node_pins_extended",
false);
546 ImGui::SetColumnWidth(0, 80.0f);
558 ImNodes::EndInputAttribute();
559 ImNodes::PopColorStyle();
571 ImNodes::EndInputAttribute();
572 ImNodes::PopColorStyle();
585 ImGui::Text(
"%s",
lbl.c_str());
586 ImNodes::EndInputAttribute();
587 ImNodes::PopColorStyle();
634 ImGui::PushID(
nodeUID * 10000 + 5000 +
static_cast<int>(
i));
640 ImGui::Text(
"%s", displayLabel.c_str());
643 if (ImGui::SmallButton(
"[-]"))
645 if (ImGui::IsItemHovered())
646 ImGui::SetTooltip(
"Remove Execution Output");
647 ImGui::PopStyleColor(3);
650 ImNodes::EndOutputAttribute();
673 ImGui::Text(
"%s", displayLabel.c_str());
674 ImNodes::EndOutputAttribute();
677 ImNodes::PopColorStyle();
687 if (ImGui::SmallButton(
"[+]"))
689 if (ImGui::IsItemHovered())
690 ImGui::SetTooltip(
"Add Execution Output");
691 ImGui::PopStyleColor(3);
704 ImNodes::EndOutputAttribute();
705 ImNodes::PopColorStyle();
734 ImGui::TextColored(
ImVec4(0.7f, 0.85f, 1.0f, 1.0f),
753 if (!def.
BBKey.empty())
754 ImGui::TextDisabled(
" %s", def.
BBKey.c_str());
786 ImGui::Text(
" %s %s",
opLabel,
ref.presetID.c_str());
789 ImGui::PopStyleColor();
795 ImGui::TextDisabled(
" %s", def.
ConditionID.c_str());
804 const std::string
lbl =
pin.GetDisplayLabel();
822 if (
dotPos != std::string::npos)
824 ImGui::TextDisabled(
" %s",
base.c_str());
874 ImGui::TextDisabled(
" %s %s %s",
leftStr.c_str(), op.c_str(),
rightStr.c_str());
885 ImNodes::PopColorStyle();
887 ImNodes::PopColorStyle();
888 ImNodes::PopColorStyle();
889 ImNodes::PopColorStyle();
900 ImGui::GetWindowDrawList()->AddCircleFilled(
902 ImGui::GetWindowDrawList()->AddCircle(
918 ImGui::GetWindowDrawList()->AddRect(
UI-side registry of available atomic tasks with display metadata.
Defines OperandRef and ConditionRef — standalone operand-to-pin mapping structures.
ComponentTypeID GetComponentTypeID_Static()
Node style rendering helpers for VisualScriptEditorPanel (Phase 5).
static AtomicTaskUIRegistry & Get()
Returns the singleton instance.
const TaskSpec * GetTaskSpec(const std::string &id) const
Returns the TaskSpec for the given id, or nullptr if not found.
static void RenderNode(int nodeUID, int nodeID, int graphID, const std::string &nodeName, TaskNodeType type, bool hasBreakpoint, bool isActive, const std::vector< std::string > &execInputPins, const std::vector< std::string > &execOutputPins, const std::vector< std::pair< std::string, VariableType > > &dataInputPins, const std::vector< std::pair< std::string, VariableType > > &dataOutputPins, const std::unordered_set< int > &connectedAttrIDs={})
Renders a complete VS node (title + exec pins + data pins).
static void RenderBreakpointIndicator(int nodeUID)
Renders a breakpoint indicator (red circle) next to a node.
static void RenderActiveNodeGlow(int nodeUID)
Renders a "currently executing" glow overlay around a node.
constexpr uint32_t EXEC_PIN_COLOR
White color for execution flow (exec) pins and connections.
constexpr uint32_t DATA_PIN_COLOR
Violet color for data pins and connections.
< Provides AssetID and INVALID_ASSET_ID
static std::string BuildConditionExpressionString(const ConditionRef &condition)
Builds the complete condition expression string.
static float CalculateNodeMinimumWidth(const TaskNodeDefinition &def, const std::vector< std::string > &execInputPins, const std::vector< std::string > &execOutputPins, const std::vector< std::pair< std::string, VariableType > > &dataInputPins, const std::vector< std::pair< std::string, VariableType > > &dataOutputPins)
Calculates the minimum width required for a node to display all content.
const char * GetNodeTypeLabel(TaskNodeType type)
Returns a human-readable label for a TaskNodeType.
VariableType
Type tags used by TaskValue to identify stored data.
@ Int
32-bit signed integer
@ Float
Single-precision float.
@ Vector
3-component vector (Vector from vector.h)
@ EntityID
Entity identifier (uint64_t)
VSNodeStyle
Visual style category for a VS node.
@ Action
Orange — AtomicTask.
@ FlowControl
Blue — Branch, Sequence, While, ForEach, DoOnce.
@ SubGraph
Teal — SubGraph call.
@ Delay
Yellow — Delay timer.
@ EntryPoint
Green — single "Out" exec pin.
@ Data
Purple — GetBBValue, SetBBValue, MathOp.
static float CalculateSwitchCaseLabelWidth(const std::string &baseName, const SwitchCaseDefinition &caseData)
Calculates the width of a Switch case output pin label.
unsigned int GetNodeTitleHoveredColor(VSNodeStyle style)
Returns the title-bar hovered RGBA colour.
@ Literal
Value is embedded directly in the template.
unsigned int GetDataPinColor(VariableType type)
Returns the RGBA colour for a data pin by variable type.
unsigned int GetExecPinColor()
VSNodeStyle GetNodeStyle(TaskNodeType type)
Returns the VSNodeStyle appropriate for a given node type.
static std::string GetOperandDisplayString(const OperandRef &operand)
Builds a display string for a ConditionRef operand.
const char * GetVariableTypeLabel(VariableType type)
Returns a human-readable label for a VariableType.
TaskNodeType
Identifies the role of a node in the task graph.
@ AtomicTask
Leaf node that executes a single atomic task.
@ While
Conditional loop (Loop / Completed exec outputs)
@ Sequence
Executes children in order; stops on first failure.
@ SubGraph
Sub-graph call (SubTask)
@ DoOnce
Single-fire execution (reset via Reset pin)
@ Delay
Timer (Completed exec output after N seconds)
@ GetBBValue
Data node – reads a Blackboard key.
@ MathOp
Data node – arithmetic operation (+, -, *, /)
@ SetBBValue
Data node – writes a Blackboard key.
@ ForEach
Iterate over BB list (Loop Body / Completed exec outputs)
@ Switch
Multi-branch on value (N exec outputs)
@ EntryPoint
Unique entry node for VS graphs (replaces Root)
@ Branch
If/Else conditional (Then / Else exec outputs)
@ Root
Entry point of the graph (exactly one per template)
@ VSSequence
Execute N outputs in order ("VS" prefix avoids collision with BT Sequence=1)
unsigned int GetNodeTitleColor(VSNodeStyle style)
Returns the title-bar RGBA colour for a given style.
Stores the complete reference for one condition including operand-to-DynamicDataPin mapping.
@ Variable
References a blackboard variable by name.
@ Const
Literal constant value.
@ Pin
External data-input pin on the owning node.
std::string variableName
Blackboard key (mode == Variable), e.g. "mMoveSpeed".
std::string constValue
Literal string (mode == Const), e.g. "5.0".
MathOpOperand leftOperand
Left-hand side operand (A)
std::string mathOperator
Arithmetic operator: "+", "-", "*", "/", "%", "^".
MathOpOperand rightOperand
Right-hand side operand (B)
One entry in a NodeBranch's conditions list.
References one operand of a condition (left or right).
@ Variable
References a blackboard variable by name.
@ Const
Literal constant value.
@ Pin
External data-input pin on the owning node.
Describes a single case branch on a Switch node.
Full description of a single node in the task graph.
MathOpRef mathOpRef
For MathOp: complete operand configuration (left operand, operator, right operand).
std::vector< NodeConditionRef > conditionRefs
Multi-condition refs to global presets (Phase 24)
std::string SubGraphPath
For SubGraph: path to the sub-graph JSON.
std::string BBKey
For GetBBValue/SetBBValue: BB key (scope:key)
std::string ConditionID
For Branch/While/Switch: ATS condition ID.
std::string AtomicTaskID
Atomic task type identifier (used when Type == AtomicTask)
TaskNodeType Type
Node role.
std::vector< ConditionRef > conditionOperandRefs
Parallel to conditions[]: each entry stores the OperandRef->DynamicDataPin UUID mapping for the corre...
std::vector< SwitchCaseDefinition > switchCases
For Switch: structured case definitions.
std::string NodeName
Human-readable name.
std::unordered_map< std::string, ParameterBinding > Parameters
Named parameter bindings passed to the atomic task.
std::vector< DynamicDataPin > dynamicPins
Dynamic data-input pins for Pin-mode operands (Phase 24)
std::vector< std::string > DynamicExecOutputPins
For VSSequence: dynamically-added exec-out pins beyond the default "Out".
float DelaySeconds
For Delay: duration in seconds.
Display metadata for a single atomic task type.