mapviz
mapviz copied to clipboard
736 add a duplicate feature for plugins
Closes #736. Added a "duplicate" feature to quickly create a deep copy of a plugin including all its configurations. Current methods for creating a duplicate:
- Right click on the plugin to duplicate and select the "duplicate" option in the drop down
- Select the plugin to duplicate and press the "Ctrl+d" hotkey
https://user-images.githubusercontent.com/33141599/120910447-b9126b80-c644-11eb-82f6-048480bb7eb5.mp4
Looks pretty useful at first glance. I need to look at the temp file code, that seems a little odd.
There might be a more efficient way, but I was trying to use the existing plugin interface. I didn't initially see a super easy way to go from YAML::Emitter to YAML::Node directly. I did however see a way to go from YAML::Node to YAML::Emitter easily. It would be nice if the MapvizPlugin::SaveConfig interface took in a YAML::Node directly and then let the user decide how to save that since it's not actually saving to a file in any of the implementations I've looked at.
Changing the existing MapvizPlugin interface or adding another pure virtual method to the MapvizPlugin class would break all existing plugins. Avoiding that was my primary objective for doing something kinda quick and dirty. I can look around in yaml-cpp to see if there is a more efficient way to do that conversion in case I'm just missing something.
@danthony06 I found a better way to save/load the config for the plugin to be duplicated that does not require using a temp file. I've tested locally on melodic. The CI seems to be failing because it can't find catkin tools, so It didn't even make it to the build.