From b29c649a478d638af9778d0cff45a8f457db923b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 Mar 2023 20:20:06 +0100 Subject: serialize: make anim_group::offset field optional --- serialize/anim.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/serialize/anim.cpp b/serialize/anim.cpp index 01414f52..42f39328 100644 --- a/serialize/anim.cpp +++ b/serialize/anim.cpp @@ -148,9 +148,12 @@ void adl_serializer::to_json(json& j, const anim_group& val) using nlohmann::to_json; if (!val.mirror_from.isEmpty()) { + const anim_group def{}; + j["name"] = val.name; j["mirror-from"] = val.mirror_from; - j["offset"] = val.offset; + if (val.offset != def.offset) + j["offset"] = val.offset; } else to_json(j, val); @@ -161,9 +164,12 @@ void adl_serializer::from_json(const json& j, anim_group& val) using nlohmann::from_json; if (j.contains("mirror-from")) { + const anim_group def{}; + val.name = j["name"]; val.mirror_from = j["mirror-from"]; - val.offset = j["offset"]; + if (val.offset != def.offset) + val.offset = j["offset"]; } else from_json(j, val); -- cgit v1.2.3