49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
#include "DeerStudio/EditorEngine/DockPanel/DockPanelInfo.h"
|
|
#include "Deer/Log.h"
|
|
|
|
#include "cereal/cereal.hpp"
|
|
#include "cereal/archives/json.hpp"
|
|
#include "cereal/types/string.hpp"
|
|
#include "cereal/types/vector.hpp"
|
|
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
#include <cstring>
|
|
|
|
namespace Deer {
|
|
namespace EditorEngine {
|
|
template <class Archive>
|
|
void serialize(Archive& ar, DockPanelInfo& data) {
|
|
ar(cereal::make_nvp("name", data.name));
|
|
ar(cereal::make_nvp("author", data.author));
|
|
ar(cereal::make_nvp("version", data.version));
|
|
ar(cereal::make_nvp("services", data.services));
|
|
}
|
|
|
|
template <class Archive>
|
|
void serialize(Archive& ar, ServiceScriptRef& data) {
|
|
ar(cereal::make_nvp("name", data.name));
|
|
ar(cereal::make_nvp("version", data.version));
|
|
}
|
|
|
|
DockPanelInfo* loadDockPanelInfo(Path dockPanelInfoPath) {
|
|
try {
|
|
std::ifstream is(dockPanelInfoPath);
|
|
|
|
if (!is)
|
|
return new DockPanelInfo();
|
|
|
|
DockPanelInfo* info = new DockPanelInfo();
|
|
{
|
|
cereal::JSONInputArchive archive(is);
|
|
archive(cereal::make_nvp("dockPanelModule", *info));
|
|
}
|
|
|
|
return info;
|
|
} catch (const std::exception& e) {
|
|
DEER_EDITOR_ENGINE_TRACE(e.what());
|
|
return new DockPanelInfo();
|
|
}
|
|
}
|
|
}
|
|
} |