@Megalomaniak said:
You could try using the bool selected
property to see which GraphNode is/are selected and store their string title
in a dict/list perhaps? Then disconnect_node()
the each in the list?
The problem is that disconnect_node does not need the nodes title. The title is just a lable set for each node. So in my case, i have different node types and each type has a unique title. But you can have multiple nodes of the same type. For example take acalculator. There are nodes for constants and nodes for adding, subtracting and co. The title would be for example "add". But in the connections, the node is encoded es GraphNode@32 or something like that. So i have no clue how to match the selected nodes, which are instances of GraphNode, against those string values.
@Megalomaniak said:
Or it might be just easier to get_connection_list()
and store it, then clear_connections()
, node.queue_free()
the selected ones, and then rebuild all the remaining relevant nodes connections based on stored data/list.
This wouldn't be that nice as a solution, but even with this, i would have the same problem. I can get the connections. So i know that some node XYZ is connected to some other node ABC and which slots are connected. But i don't know what node types they are. So i can not know if node XYZ is for example an "add"-node or a "sub"-node.
I could listen for mouse-click and mouse-release events on the nodes. Then i could save those nodes and if a new connection is made, i could save the connection-data with those two nodes by myself. With that i could make a mapping between those strange strings and the real node instances. But that would be a really dirty hack and i think this should be easier. The engine has some way to identify a node-instance by this strange string and it has some way to get this string-value our of such a node-instance. So it must be possible for me to get this working. I think there is some easy thing i am missing.
But thanks for your input.