Open setzer22 opened 2 years ago
You can now lookup the nodes outputs via graph.outgoing(output_id)
to check if they are connected to anything. Which is more efficient (it should be O(nodes * output_ports)
), but on large graphs might still be a bit too slow if you're searching for final nodes every frame or something.
The modified events mean that it's easier to maintain an efficient external (to the library) datastructure containing a list of final nodes - since the ConnectionAdded/Removed events will now always specify the output port, from which you can get the node with the output port, and then determine if you need to modify your your final nodes set by looking at only that nodes output ports (again via graph.outgoing(output_id)
). If this paragraph isn't clear I'd be happy to write some example code.
@rsaccon you might be interested in the above.
Discussed in https://github.com/setzer22/egui_node_graph/discussions/13