Nelarius/imnodes

Is linking from input to output intended action?

frijuly7 opened this issue · 0 comments

`

ImGui::Begin("Node Graph Test");

ImNodes::BeginNodeEditor();

ImNodes::BeginNode(0);

ImNodes::BeginNodeTitleBar();
ImGui::TextUnformatted("output node");
ImNodes::EndNodeTitleBar();

ImNodes::BeginInputAttribute(2);
ImGui::Text("input");
ImNodes::EndInputAttribute();

ImNodes::BeginOutputAttribute(3);
ImGui::Text("output");
ImNodes::EndOutputAttribute();

ImNodes::EndNode();


ImNodes::BeginNode(1);

ImNodes::BeginNodeTitleBar();
ImGui::TextUnformatted("output node");
ImNodes::EndNodeTitleBar();

ImNodes::BeginInputAttribute(4);
ImGui::Text("input");
ImNodes::EndInputAttribute();

ImNodes::BeginOutputAttribute(5);
ImGui::Text("output");
ImNodes::EndOutputAttribute();

ImNodes::EndNode();

std::vector<std::pair<int, int>> links;
links.push_back({ 3, 4 });
links.push_back({ 2, 5 });
// elsewhere in the code...
for (int i = 0; i < links.size(); ++i)
{
    const std::pair<int, int> p = links[i];
    // in this case, we just use the array index of the link
    // as the unique identifier
    ImNodes::Link(i, p.first, p.second);
}
ImNodes::EndNodeEditor();
ImGui::End();

`

I'm testing ImNodes to consider applying on my project. But I found this behavior. I'm wondering if this behavior is intended.
Screenshot 2024-07-09 133902

Off-topic, Thank you for creating a library that allows us to quickly create node graphs