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

Links copy not implemented?

Open lyd405121 opened this issue 2 years ago • 1 comments

Background

  • I am wrting a node editor to render my scene graph data
  • Here is the early version video:

https://github.com/thedmd/imgui-node-editor/assets/16344694/bc8f9c7c-23e1-4232-950f-9a12b60bd934

Question

  • But I met a quetion which is how to copy and paste node and link togather
  • I found imgui-node-editor can't catch both selected links and nodes
  • Here is demo:

https://github.com/thedmd/imgui-node-editor/assets/16344694/636aad86-2554-47a7-b909-cc0274bf4264

  • And I found there is a series of shortcut function in imgui-node-editor, but not used in any samples

My solution

  • So I should do my own data-structure to store the relationship for all selected nodes,
  • Like sub-graph in a graph, eavluate the relationship for all possible outputs/inputs
  • Is that right? or there is more easy way in the framework of imgui-node-editor

lyd405121 avatar Jun 30 '23 04:06 lyd405121

You're correct that selection can contain only nodes or links but not both.

Inteded way to make copy is to:

  • get selected nodes
  • clone them on the user side
  • clone links between cloned nodes (if possible)

That was done because Node Editor cannot say if connection between cloned nodes are valid.

You're also correct that it had to be done on the user side.


It should be possible to create Copy/Duplicate actions on the node editor side and use same API as for user interaction. I will keep this issue open to keep track of the idea.

thedmd avatar Sep 01 '23 13:09 thedmd