19#include "../system/system_utils.h"
20#include "../system/system_consts.h"
21#include "../NodeGraphCore/GlobalTemplateBlackboard.h"
22#include "../DataManager.h"
24#include "../third_party/imgui/imgui.h"
25#include "../third_party/imnodes/imnodes.h"
26#include "../json_helper.h"
27#include "../TaskSystem/TaskGraphLoader.h"
37#include <unordered_set>
63 ImNodes::SetNodeGridSpacePos(
76 SYSTEM_LOG <<
"[VSEditor] Undo complete. Template now has "
96 ImNodes::SetNodeGridSpacePos(
106 SYSTEM_LOG <<
"[VSEditor] Redo complete. Template now has "
120 ImGui::Begin(
"VS Graph Editor", &
m_visible);
141 float totalWidth = ImGui::GetContentRegionAvail().x;
166 if (ImGui::IsItemHovered())
174 ImGui::PopStyleColor(3);
211 if (ImGui::IsItemHovered())
218 ImGui::PopStyleColor(3);
238 if (ImGui::Button(
"Save"))
240 SYSTEM_LOG <<
"[VisualScriptEditorPanel] Save button clicked. m_currentPath='"
248 ImGui::OpenPopup(
"SaveError");
252 if (ImGui::Button(
"Save As"))
260 if (ImGui::Button(
"Verify##gvs"))
265 if (ImGui::Button(
"Run Graph##sim"))
287 if (ImGui::DragFloat(
"Size##minimap_vs", &
m_minimapSize, 0.01f, 0.05f, 0.5f,
"%.2f"))
295 const char*
positionLabels[] = {
"Top-Left",
"Top-Right",
"Bottom-Left",
"Bottom-Right" };
305 ?
"Untitled VS Graph"
307 ImGui::TextDisabled(
"%s%s", title,
m_dirty ?
" *" :
"");
322 ImGui::TextColored(
ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
327 ImGui::TextColored(
ImVec4(1.0f, 0.85f, 0.0f, 1.0f),
"[OK - warnings]");
331 ImGui::TextColored(
ImVec4(0.3f, 1.0f, 0.3f, 1.0f),
"[OK]");
341 SYSTEM_LOG <<
"[VisualScriptEditorPanel] Ctrl+S pressed. m_currentPath='"
349 ImGui::OpenPopup(
"SaveError");
368 if (ImGui::BeginPopup(
"SaveError"))
370 ImGui::TextColored(
ImVec4(1,0,0,1),
"Save failed — check file path.");
371 if (ImGui::Button(
"OK")) ImGui::CloseCurrentPopup();
388 if (
dotPos != std::string::npos)
397 dm.RenderSaveFilePickerModal();
400 if (
dm.IsSaveFilePickerModalOpen() ==
false) {
403 SYSTEM_LOG <<
"[VisualScriptEditorPanel] SaveAs dialog confirmed. fullPath='"
406 std::cout <<
"[VisualScriptEditorPanel] Saved to: " <<
selectedFile << std::endl;
409 SYSTEM_LOG <<
"[VisualScriptEditorPanel] Save failed - check directory and permissions\n";
UI-side registry of available atomic tasks with display metadata.
Wrapper around the graph blackboard entries for dropdown editors.
Registry of available condition types for Branch/While node dropdowns.
Runtime debug controller for ATS Visual Scripting (Phase 5).
ComponentTypeID GetComponentTypeID_Static()
Defines MathOpOperand — operand references for MathOp nodes.
Hardcoded lists of math and comparison operators for dropdown editors.
ImNodes-based graph editor for ATS Visual Script graphs (Phase 5).
static DataManager & Get()
std::vector< TaskNodeDefinition > Nodes
All graph nodes.
std::vector< ExecPinConnection > ExecConnections
Explicit exec connections (ATS VS only)
bool CanUndo() const
Returns true if there is at least one command to undo.
bool CanRedo() const
Returns true if there is at least one command to redo.
std::string PeekUndoDescription() const
Returns the description of the top undo command, or "" if empty.
void Redo(TaskGraphTemplate &graph)
Re-applies the last undone command, moving it back to the undo stack.
std::string PeekRedoDescription() const
Returns the description of the top redo command, or "" if empty.
void Undo(TaskGraphTemplate &graph)
Undoes the last command, moving it to the redo stack.
UndoRedoStack m_undoStack
Undo/Redo command stack for reversible graph editing operations.
bool Save()
Saves the current canvas state to JSON v4 at the loaded path.
void RunGraphSimulation()
Simulates runtime execution of the current graph and logs traces.
void PerformRedo()
Re-applies the last undone command and syncs the canvas.
TaskGraphTemplate m_template
The template currently being edited.
float m_nodePropertiesPanelHeight
Height of the Node Properties panel (Part A) in the right panel.
void RenderRightPanelTabs()
Phase 26 — Tab system: Renders the tab bar for the 3-panel right section Displays tabs for Presets,...
bool m_skipPositionSyncNextFrame
Set to true by Undo/Redo; causes next frame to skip SyncNodePositionsFromImNodes() so that the positi...
void PerformUndo()
Undoes the last command and syncs the canvas (nodes + links).
void Render()
Renders the full panel window.
void RenderContent()
Renders panel content without window wrapper - for fixed layout.
void RenderNodePropertiesPanel()
Part A: Node Properties panel (top-left of right panel)
void RenderSaveAsDialog()
VSVerificationResult m_verificationResult
Latest verification result (produced by RunVerification())
void RunVerification()
Runs VSGraphVerifier on the current graph and stores the result.
bool SaveAs(const std::string &path)
Saves the current canvas state to a new JSON v4 file.
bool m_showSaveAsDialog
True when the "Save As" modal should be opened next frame.
std::unique_ptr< ImNodesCanvasEditor > m_canvasEditor
Canvas editor adapter for minimap support (Phase 37) Abstracts imnodes minimap rendering through ICan...
void RebuildLinks()
Rebuilds ImNodes exec/data link arrays from the template.
void RenderRightPanelTabContent()
Phase 26 — Tab system: Renders the content of the active tab Dispatches to appropriate render functio...
int m_minimapPosition
Minimap position (0=TopLeft, 1=TopRight, 2=BottomLeft, 3=BottomRight)
float m_propertiesPanelWidth
Width of the properties+blackboard panel on the right.
bool m_justPerformedUndoRedo
Set to true immediately after Undo/Redo; blocks node movement tracking for 1 frame to allow ImNodes t...
std::unordered_map< int, std::pair< float, float > > m_nodeDragStartPositions
Per-node drag-start positions used to record a single MoveNodeCommand per drag gesture instead of one...
std::string m_currentPath
bool m_verificationDone
True once RunVerification() has been called at least once for the current graph.
float m_minimapSize
Minimap size ratio (0.05-0.5 of canvas)
std::vector< VSEditorNode > m_editorNodes
Editor nodes (mirrors m_template.Nodes + position/selection state)
bool m_minimapVisible
Minimap visibility flag for VisualScript canvas.
void SyncEditorNodesFromTemplate()
Rebuilds m_editorNodes from m_template, preserving existing node positions.
std::unique_ptr< ConditionPresetLibraryPanel > m_libraryPanel
Global condition preset library panel (UI for creating/editing/deleting presets).
< Provides AssetID and INVALID_ASSET_ID
@ Blueprint
.ats files (SubGraph/VisualScript)
std::vector< VSVerificationIssue > issues