-
Notifications
You must be signed in to change notification settings - Fork 616
Description
This is happening both in the blueprint example, and in my own project.
When I delete a node, the node is still present in the string that is passed to the data argument in the ed::Config.SaveSettings function that I implemented and attached to the function pointer there. I did some debugger searching and I think I found what the issue is.
If I use a debugger to watch the memory location associated with Settings.m_Nodes in imgui_node_editor.cpp ... I can see plainly that new nodes are added there at runtime, but when you delete a node at runtime, the element associated with that node is not removed from the Settings.m_Nodes vector. And since that's the serialization buffer, it ends up continually writing the positions for those nodes after deletion. In the end, in my program, this ends up confusing the serialization / deserialization routines I wrote.
REPRO INSTRUCTIONS
To do a test on your computer, run the blueprint example and breakpoint somewhere in
ed::NodeSettings* ed::Settings::AddNode(NodeId id)
Then create a node. This halts the breakpoint inside AddNode. Now add a watch for m_Nodes which is in that function.
Resume execution
Delete ALL the nodes in the example.
Add one new node. This will trap inside addnode again. When you inspect m_Nodes there should be 1-3 elements (depending on if the comment nodes count), but there are like 17!
I am not sure how we should fix this. If you can describe where the changes should be made, I could take a swing at writing a pull request.
Thanks!