0 votes

Right now, I'm working on a dialog editor using GraphEdit/GraphNode, but I've hit an issue with deleting nodes that have connections.

I have a graph setup like so:

Graph setup

When the close button is pressed, the following code runs on the graph:

var node_to_delete = graph.get_node(name)

It has to be run on the graph and not the actual node so that UndoRedo works with the setup. However, when the node is deleted, the connections are left behind:

The issue

The same issue occurs if I only remove the node as a child of the graph, or just queue_free it.

The next time the graph refreshes (via scrolling, zooming in, or adding another node), these connections all disappear, and the debugger says that it can't find the deleted node.

How am I supposed to properly remove a GraphNode from a scene? The visual shader editor doesn't have this issue, so there has to be a proper way of doing it that doesn't have this error.

I'm using Godot 3.1.1 stable, on Linux Mint 19.2.

in Engine by (26 points)

1 Answer

–1 vote

i have the same issue, need help!

by (54 points)

In the end, I ended up manually disconnecting everything via parsing GraphEdit.get_connection_list(). I can share the code if you want.

please, i want the code, thanks!

thanks so much! i learn a lot by reading your code.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.