diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-28 04:52:25 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-11-28 04:52:25 +0100 |
commit | 16f1261264f2a4d65753fb63471e0a1519377192 (patch) | |
tree | f2910a4c4ef4cca9ddcd8e3e179dc5a16c75e1a0 /serialize/wall-atlas.cpp | |
parent | 8171d7f7cbc097c58a2097e14ce814d6a97d54bf (diff) |
a
Diffstat (limited to 'serialize/wall-atlas.cpp')
-rw-r--r-- | serialize/wall-atlas.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/serialize/wall-atlas.cpp b/serialize/wall-atlas.cpp index ac37e59c..cbac35d5 100644 --- a/serialize/wall-atlas.cpp +++ b/serialize/wall-atlas.cpp @@ -190,7 +190,6 @@ bool is_direction_defined(const Direction& dir) Group read_group_metadata(const json& jgroup) { fm_assert(jgroup.is_object()); - Group val; { @@ -208,18 +207,24 @@ Group read_group_metadata(const json& jgroup) // todo check index within range } - if (jgroup.contains("pixel-size")) - val.pixel_size = jgroup["pixel-size"]; + val.default_tint = true; if (jgroup.contains("tint-mult")) + { val.tint_mult = jgroup["tint-mult"]; + val.default_tint = false; + } if (jgroup.contains("tint-add")) + { val.tint_add = jgroup["tint-add"]; + val.default_tint = false; + } + + if (jgroup.contains("pixel-size")) + val.pixel_size = jgroup["pixel-size"]; if (jgroup.contains("from-rotation") && !jgroup["from-rotation"].is_null()) val.from_rotation = (uint8_t)direction_index_from_name(std::string{ jgroup["from-rotation"] }); if (jgroup.contains("mirrored")) val.mirrored = !!jgroup["mirrored"]; - if (jgroup.contains("default-tint")) - val.default_tint = !!jgroup["default-tint"]; val.is_defined = true; return val; @@ -287,14 +292,16 @@ void write_group_metadata(json& jgroup, const Group& val) jgroup["count"] = val.count; jgroup["pixel-size"] = val.pixel_size; - jgroup["tint-mult"] = val.tint_mult; - jgroup["tint-add"] = val.tint_add; + if (!val.default_tint) + { + jgroup["tint-mult"] = val.tint_mult; + jgroup["tint-add"] = val.tint_add; + } if (val.from_rotation != group_defaults.from_rotation) jgroup["from-rotation"] = direction_index_to_name(val.from_rotation); else jgroup["from-rotation"] = nullptr; jgroup["mirrored"] = val.mirrored; - jgroup["default-tint"] = val.default_tint; } void write_direction_metadata(json& jdir, const Direction& dir) |