24#include "../system/system_utils.h"
25#include "../system/system_consts.h"
26#include "../NodeGraphCore/GlobalTemplateBlackboard.h"
27#include "../third_party/imgui/imgui.h"
28#include "../json_helper.h"
44 const std::vector<BlackboardEntry>&
allVars,
47 ImGui::PushID(conditionIndex);
49 ImGui::Text(
"Condition #%d", conditionIndex + 1);
82 else if (
condition.leftMode ==
"Variable")
93 const char*
operators[] = {
"==",
"!=",
"<",
">",
"<=",
">=" };
95 for (
int i = 0;
i < 6; ++
i)
103 ImGui::SetNextItemWidth(70.0f);
111 ImGui::Text(
"Right:");
141 else if (
condition.rightMode ==
"Variable")
150 ImGui::Text(
"Type:");
152 const char* types[] = {
"None",
"Bool",
"Int",
"Float",
"String",
"Vector" };
158 for (
int i = 0;
i < 6; ++
i)
166 ImGui::SetNextItemWidth(80.0f);
167 if (ImGui::Combo(
"##cmptype", &
typeIdx, types, 6))
175 ImGui::TextColored(
ImVec4(0.7f, 1.0f, 0.7f, 1.0f),
176 "Preview: %s",
preview.c_str());
187 const std::vector<BlackboardEntry>&
allVars,
192 std::vector<std::string>
names;
204 ImGui::TextDisabled(
"(no variables)");
228 std::vector<const char*>
cstrs;
230 for (
size_t i = 0;
i <
names.size(); ++
i)
233 ImGui::SetNextItemWidth(120.0f);
234 if (ImGui::Combo(label, &selected,
cstrs.data(),
static_cast<int>(
cstrs.size())))
273 bool bVal = value.IsNone() ?
false : value.AsBool();
274 if (ImGui::Checkbox(label, &
bVal))
276 value = TaskValue(
bVal);
283 int iVal = value.IsNone() ? 0 : value.AsInt();
284 ImGui::SetNextItemWidth(80.0f);
285 if (ImGui::InputInt(label, &
iVal))
287 value = TaskValue(
iVal);
294 float fVal = value.IsNone() ? 0.0f : value.AsFloat();
295 ImGui::SetNextItemWidth(80.0f);
296 if (ImGui::InputFloat(label, &
fVal, 0.0f, 0.0f,
"%.3f"))
298 value = TaskValue(
fVal);
305 const std::string
sVal = value.IsNone() ?
"" : value.AsString();
308 ImGui::SetNextItemWidth(120.0f);
309 if (ImGui::InputText(label,
sBuf,
sizeof(
sBuf)))
311 value = TaskValue(std::string(
sBuf));
320 ImGui::SetNextItemWidth(160.0f);
321 if (ImGui::InputFloat3(label,
v))
331 ImGui::TextDisabled(
"(set Type first)");
348 ImGui::TextDisabled(
"(no data-output pins in graph)");
352 ImGui::SetNextItemWidth(160.0f);
361 ImGui::SetItemDefaultFocus();
373 auto descSide = [](
const std::string& mode,
374 const std::string&
pin,
375 const std::string&
var,
376 const TaskValue& constValue) -> std::string
379 return "[Pin: " + (
pin.empty() ?
"?" :
pin) +
"]";
380 if (mode ==
"Variable")
381 return "[Var: " + (
var.empty() ?
"?" :
var) +
"]";
384 if (!constValue.IsNone())
386 std::ostringstream
oss;
387 switch (constValue.GetType())
395 const ::Vector
v = constValue.AsVector();
396 oss <<
"(" <<
v.x <<
"," <<
v.y <<
"," <<
v.z <<
")";
399 default:
oss <<
"?";
break;
401 return "[Const: " +
oss.str() +
"]";
408 const std::string op =
cond.operatorStr.empty() ?
"?" :
cond.operatorStr;
410 return left +
" " + op +
" " + right;
419#ifndef OLYMPE_HEADLESS
452 allOptions.push_back(
"[Pin-in] (none available)");
461 std::ostringstream
oss;
462 oss << std::fixed << std::setprecision(3) <<
operand.constValue;
466 if (
dot != std::string::npos)
517 const std::vector<GlobalEntryDefinition>&
globalVars =
gtb.GetAllVariables();
522 allOptions.push_back(
"--- Global Variables ---");
544 ImGui::SetNextItemWidth(120.0f);
599 ImGui::SameLine(0.0f, 4.0f);
600 ImGui::SetNextItemWidth(60.0f);
601 if (ImGui::InputDouble(
"##const_value", &
operand.constValue, 0.0, 0.0,
"%.3f"))
ComponentTypeID GetComponentTypeID_Static()
ImNodes-based graph editor for ATS Visual Script graphs (Phase 5).
static GlobalTemplateBlackboard & Get()
std::vector< BlackboardEntry > Blackboard
Local blackboard declared in this graph.
std::unique_ptr< DynamicDataPinManager > m_pinManager
Dynamic pin manager shared across all Branch nodes in this panel.
TaskGraphTemplate m_template
The template currently being edited.
void RenderVariableSelector(std::string &selectedVar, const std::vector< BlackboardEntry > &allVars, VariableType expectedType, const char *label)
Renders a type-filtered variable selector combo box.
void RenderPinSelector(std::string &selectedPin, const std::vector< std::string > &availablePins, const char *label)
Renders a pin selector combo box.
void RenderConstValueInput(TaskValue &value, VariableType varType, const char *label)
Renders a type-aware const value input widget.
static std::string BuildConditionPreview(const Condition &cond)
Builds a human-readable preview string for a condition.
bool RenderOperandEditor(Operand &operand, const char *labelSuffix)
Render a single operand with dropdown for mode and value editor Returns true if the operand was modif...
void RenderConditionEditor(Condition &condition, int conditionIndex, const std::vector< BlackboardEntry > &allVars, const std::vector< std::string > &availablePins)
Renders the full editor UI for one Condition entry on a Branch/While node.
< Provides AssetID and INVALID_ASSET_ID
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)
@ None
Uninitialized / empty value.
@ Variable
References a blackboard variable by ID (string key)
@ Const
Literal numeric constant (double)
@ Pin
External data input pin on the node (identified by label)