32 APPLOG_WARNING(
"Could not parse engine version '{}' from project file. "
33 "Using zero-initialized version.",
43 entt::meta_factory<project_info>{}
44 .type(
"project_info"_hs)
50 .data<&project_info::project_guid>(
"project_guid"_hs)
54 entt::attribute{
"tooltip",
"Stable unique id generated when this project was created."},
61 try_save(ar, ser20::make_nvp(
"project_guid", obj.project_guid));
64 const std::string created = to_nvp_string(obj.engine_version_created);
65 const std::string opened = to_nvp_string(obj.engine_version_opened);
66 try_save(ar, ser20::make_nvp(
"engine_version_created", created));
67 try_save(ar, ser20::make_nvp(
"engine_version_opened", opened));
74 try_load(ar, ser20::make_nvp(
"project_guid", obj.project_guid));
77 if(
try_load(ar, ser20::make_nvp(
"engine_version_created", created)))
79 from_nvp_string(created, obj.engine_version_created);
82 if(
try_load(ar, ser20::make_nvp(
"engine_version_opened", opened)))
84 from_nvp_string(opened, obj.engine_version_opened);
92 std::ofstream stream(absolute_path);
98 try_save(ar, ser20::make_nvp(
"project", obj));
100 catch(
const std::exception& e)
102 APPLOG_WARNING(
"Failed to save project info {}: {}", absolute_path, e.what());
109 std::ifstream stream(absolute_path);
115 return try_load(ar, ser20::make_nvp(
"project", obj));
117 catch(
const std::exception& e)
119 APPLOG_WARNING(
"Failed to load project info {}: {}", absolute_path, e.what());
#define APPLOG_WARNING(...)
attributes::value_type attribute
std::map< std::string, meta_any > attributes
auto create_oarchive_associative(std::ostream &stream)
BinaryInputArchive iarchive_binary_t
auto create_iarchive_associative(std::istream &stream)
simd::JSONOutputArchive oarchive_associative_t
BinaryOutputArchive oarchive_binary_t
simd::JSONInputArchive iarchive_associative_t
void load_from_file(const std::string &absolute_path, animation_clip &obj)
void save_to_file(const std::string &absolute_path, const animation_clip &obj)
auto parse(std::string_view text) -> std::optional< engine_version >
Parses a version string. Returns nullopt on malformed input.
#define SAVE_INSTANTIATE(cls, Archive)
auto try_save(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool
#define LOAD_INSTANTIATE(cls, Archive)
auto try_load(Archive &ar, ser20::NameValuePair< T > &&t, const hpp::source_location &loc=hpp::source_location::current()) -> bool