nodes: Added primitive saving and loading mechanism

Not fully integrated yet. Also doesn't yet save any node settings, just nodes and links
This commit is contained in:
WerWolv
2021-05-17 23:17:58 +02:00
parent cf67adfa42
commit ee2b412a10
8 changed files with 148 additions and 6 deletions

View File

@@ -160,7 +160,13 @@ namespace hex {
template<hex::derived_from<dp::Node> T, typename ... Args>
static void add(std::string_view unlocalizedCategory, std::string_view unlocalizedName, Args&& ... args) {
add(Entry{ unlocalizedCategory.data(), unlocalizedName.data(), [args...]{ return new T(std::forward<Args>(args)...); } });
add(Entry{ unlocalizedCategory.data(), unlocalizedName.data(),
[args..., name = std::string(unlocalizedName)]{
auto node = new T(std::forward<Args>(args)...);
node->setUnlocalizedName(name);
return node;
}
});
}
static void addSeparator();