Skip to content

Is linking from input to output intended action? #200

Description

@frijuly7

`

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions