Browse Source

node editor: draw edges

master
gradient 8 years ago
parent
commit
a97b7e5dcb
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      src/gui/node_editor.h

+ 12
- 0
src/gui/node_editor.h View File

@ -92,6 +92,7 @@ public:
ImVec2 offset = canvas_pos - scrolling; // TODO: add scrolling ImVec2 offset = canvas_pos - scrolling; // TODO: add scrolling
// -- Draw the grid // -- Draw the grid
draw_list->ChannelsSetCurrent(0);
if (show_grid) { if (show_grid) {
ImVec2 local_offset = ImGui::GetCursorPos() - scrolling; ImVec2 local_offset = ImGui::GetCursorPos() - scrolling;
@ -105,6 +106,17 @@ public:
ImVec2(canvas_size.x, y)+canvas_pos, color); 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); Rect viewportRect = Rect(scrolling, canvas_size);
for (const auto &node : nodeList) { for (const auto &node : nodeList) {


Loading…
Cancel
Save