imgui-node-editor icon indicating copy to clipboard operation
imgui-node-editor copied to clipboard

Link is not deleted when connected node is deleted

Open SadE54 opened this issue 2 years ago • 7 comments

Hi

I'm using the last develop branch and I can see that if i'm deleting a connected node , the link is not deleted and still exist in memory. It cannot be dwran anymore but you can see that the ports are still connected:

MEFlow_qAALNJvyva MEFlow_3sk5fTfllB

SadE54 avatar Oct 04 '21 15:10 SadE54

I find a way to delete link when deleting from context menus

if (ImGui::MenuItem("Delete"))
{
     ed::BreakLinks(contextNodeId); // force delete of links connected to the node
     ed::DeleteNode(contextNodeId);
}

But I'm still unable to get it deleted if I delete the node using the delete key. The system seems to be different and deeply embedded in node editor internals 🤔

SadE54 avatar Oct 04 '21 17:10 SadE54

Hey, your problem is easy solvable. You just need to manually remove the links from the list. I made a Pull Request where this is shown #133

ToppDev avatar Oct 05 '21 11:10 ToppDev

Thx, I managed to implement something like xthat at the application level. But I think it should be embedded at the lower level. Maybe by providing a bool when you want to delete a node with the connected links 🤔

SadE54 avatar Oct 05 '21 20:10 SadE54

In blueprint example there is a bug. There is a easy workaround. Basically first run node QueryDeletedNode, this will queue all connected link to be deleted and QueryDeletedLink will return them too.

Does this help?

thedmd avatar Nov 18 '21 08:11 thedmd

Thanks ! I found a temporary solution , but I will try asap your fix

SadE54 avatar Nov 18 '21 08:11 SadE54

My choice of API make it easy to make this mistake. Sorry for that.

thedmd avatar Nov 18 '21 09:11 thedmd

No problem, I'm already so happy to use such a nice tool ! :)

SadE54 avatar Nov 18 '21 09:11 SadE54

Duplicate of #182, fixed on develop.

thedmd avatar Nov 02 '22 07:11 thedmd