Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing node does not delete connected links #276

Open
sodamouse opened this issue Jan 17, 2024 · 0 comments
Open

Removing node does not delete connected links #276

sodamouse opened this issue Jan 17, 2024 · 0 comments

Comments

@sodamouse
Copy link

sodamouse commented Jan 17, 2024

Hi, I saw in another closed issue that this problem was fixed in develop, however this does not seem to be the case. When I delete a node, QueryDeletedLink does not return anything, and the second while loop is never executed.

Repro:

if (ax::NodeEditor::BeginDelete())
{
	ax::NodeEditor::NodeId deletedNodeId;
	while (ax::NodeEditor::QueryDeletedNode(&deletedNodeId))
	{
		if (ax::NodeEditor::AcceptDeletedItem)
		{
			auto it = std::find_if(nodes.begin(), nodes.end(), [deletedNodeId](Node& node) {
				return node.id == deletedNodeId.Get();
			});
			
			if (it != nodes.end())
			{
				std::cout << "removed node: " << it->id << '\n';
				nodes.erase(it);
			}
		}
	}

	ax::NodeEditor::LinkId deletedLinkId;
	while (ax::NodeEditor::QueryDeletedLink(&deletedLinkId))
	{
		if (ax::NodeEditor::AcceptDeletedItem())
		{
			auto it = std::find_if(links.begin(), links.end(), [deletedLinkId](Link& link) {
				return link.id == deletedLinkId.Get();
			});

			if (it != links.end())
			{
				std::cout << "removed link: " << it->id << '\n';
				links.erase(it);
			}
		}
	}

        ax::NodeEditor::EndDelete();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant