I have a plugin which act as a integrated map editor inside of Godot. The idea is that the plugin detect if the edited scene is of a certain type and then activate an interface where I can add new nodes through a custom UI. The new nodes are customs scenes. Both the map and the custom elements are declared as "tools". Unfortunately it does not work as expected, most notably Godot when I add a node I can see them in the TreeView or in the Viewport but Godot does mark the scene as change and therefore I cannot save the change manually. If I save automatically through EditorInterface, the scene is not save exactly as is, nodes are misplaced and when I reload I don't get the same scene.
So my question is simple, what is the correct way to modify a scene through a plugin and tools in order to be able to save it correctly afterward?