DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Add methods 'set_selected_nodes' and 'set_selected_links' for setting selected items in node graph.

Open Tomislaw opened this issue 1 year ago • 1 comments

As name suggest, It would be great to have methods for selecting node editor items programmatically.

I tried to implement node duplication callback, and I would want to mark new duplicated nodes as selected. Unfortunately, I was unable to achieve this result.

Tomislaw avatar Jun 30 '24 19:06 Tomislaw

Alternatively, we could add selected to the node or link config (and change it with configure_item). Then, use ImNodes::SelectNode() to change it, and ImNodes::IsNodeSelected() to update it from ImNodes...

However, at the moment, ImNodes::IsNodeSelected() is slow (it performs a linear search in std::vector), so it might be better to use dedicated functions (set/get_selected_nodes) rather than a per-node config field.

v-ein avatar Jun 30 '24 20:06 v-ein