From 11f27ee84b255ee5a3f9d72832f5bfef261d2378 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 5 Nov 2022 19:30:58 +0100 Subject: add pixel size to anim atlas --- anim-crop-tool/main.cpp | 1 + serialize/anim.cpp | 2 +- serialize/anim.hpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/anim-crop-tool/main.cpp b/anim-crop-tool/main.cpp index 430e4b80..215d9994 100644 --- a/anim-crop-tool/main.cpp +++ b/anim-crop-tool/main.cpp @@ -291,6 +291,7 @@ int main(int argc, char** argv) << std::strerror(errno); // NOLINT(concurrency-mt-unsafe) return EX_CANTCREAT; } + anim_info.pixel_size = Magnum::Vector2ui(atlas.size()); floormat::json_helper::to_json(anim_info, opts.output_dir/(base_name + ".json")); return 0; diff --git a/serialize/anim.cpp b/serialize/anim.cpp index 76d72485..7a5f06fb 100644 --- a/serialize/anim.cpp +++ b/serialize/anim.cpp @@ -11,7 +11,7 @@ namespace floormat::Serialize { NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_frame, ground, offset, size) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim_group, name, frames, ground) -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim, object_name, anim_name, nframes, actionframe, fps, groups, width, height) +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(anim, object_name, anim_name, pixel_size, nframes, actionframe, fps, groups, width, height) } // namespace floormat::Serialize diff --git a/serialize/anim.hpp b/serialize/anim.hpp index 536824d3..74b418a8 100644 --- a/serialize/anim.hpp +++ b/serialize/anim.hpp @@ -34,6 +34,7 @@ struct anim final int nframes = 0; int width = 0, height = 0; int actionframe = -1, fps = default_fps; + Vector2ui pixel_size; }; } // namespace floormat::Serialize -- cgit v1.2.3