diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 20:20:06 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 20:34:02 +0100 |
commit | b29c649a478d638af9778d0cff45a8f457db923b (patch) | |
tree | 2bdbb8f08cb43bffa6f210aa61cd10ca60c4c451 | |
parent | 3836f0340841c47a846604328e0b0cd7c5244316 (diff) |
serialize: make anim_group::offset field optional
-rw-r--r-- | serialize/anim.cpp | 10 |
1 files 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<anim_group>::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<anim_group>::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); |