Skip to content

Deleting a node doesn't remove it from settings #153

@crolando

Description

@crolando

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!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions