From a97b7e5dcb90275e23d1ae9aa332b39cc4f9f9bc Mon Sep 17 00:00:00 2001 From: gradient Date: Fri, 20 Oct 2017 18:51:42 -0500 Subject: [PATCH] node editor: draw edges --- src/gui/node_editor.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/gui/node_editor.h b/src/gui/node_editor.h index 921ea05..d011840 100644 --- a/src/gui/node_editor.h +++ b/src/gui/node_editor.h @@ -92,6 +92,7 @@ public: ImVec2 offset = canvas_pos - scrolling; // TODO: add scrolling // -- Draw the grid + draw_list->ChannelsSetCurrent(0); if (show_grid) { ImVec2 local_offset = ImGui::GetCursorPos() - scrolling; @@ -105,6 +106,17 @@ public: ImVec2(canvas_size.x, y)+canvas_pos, color); } + + draw_list->ChannelsSetCurrent(0); + for (const auto &edge : edgeList) { + auto head = offset + edge.lhs->slot_location(GuiNode::OUT, edge.fromSlot); + auto tail = offset + edge.rhs->slot_location(GuiNode::IN, edge.fromSlot); + + draw_list->AddBezierCurve(head, head+ImVec2(50, 0), + tail+ImVec2(-50, 0), tail, + ImColor(200, 200, 200), 3.0f); + } + Rect viewportRect = Rect(scrolling, canvas_size); for (const auto &node : nodeList) {