From c08bd3cfca26b39cd516511fa38a9e72847eef0e Mon Sep 17 00:00:00 2001 From: gradient Date: Fri, 20 Oct 2017 18:52:03 -0500 Subject: [PATCH] node editor: push/pop imgui ID scopes when rendering nodes This is a really bad, undefined-behavior hack. we should hash or something? or just use the index in the render ordering[1] [1]: topological ordering of the render graph --- src/gui/node_editor.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/node_editor.h b/src/gui/node_editor.h index d011840..02cebd6 100644 --- a/src/gui/node_editor.h +++ b/src/gui/node_editor.h @@ -122,6 +122,9 @@ public: for (const auto &node : nodeList) { bool visible = viewportRect.intersects(node.bbox); if (visible) { + // TODO: this is garbage + ImGui::PushID((void *)&node); + // -- Draw the node boxes draw_list->ChannelsSetCurrent(0); // Switch to the background layer @@ -137,6 +140,7 @@ public: // draw_list->AddCircleFilled(offset + position, 4.0f, ImColor(150, 150, 150, 150)); // } + ImGui::PopID(); } }