[aseprite] 34/308: Export AniDir field for FrameTags in JSON meta attribute
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:44:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 2d2434daea092310a5e8c2d29201430db183c7c5
Author: David Capello <davidcapello at gmail.com>
Date: Thu Dec 3 12:07:46 2015 -0300
Export AniDir field for FrameTags in JSON meta attribute
---
src/app/document_exporter.cpp | 4 +++-
src/doc/CMakeLists.txt | 1 +
src/doc/anidir.cpp | 25 +++++++++++++++++++++++++
src/doc/anidir.h | 4 ++++
4 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/app/document_exporter.cpp b/src/app/document_exporter.cpp
index 1aaf4eb..ee5d4bb 100644
--- a/src/app/document_exporter.cpp
+++ b/src/app/document_exporter.cpp
@@ -697,9 +697,11 @@ void DocumentExporter::createDataFile(const Samples& samples, std::ostream& os,
firstTag = false;
else
os << ",";
+
os << "\n { \"name\": \"" << escape_for_json(tag->name()) << "\","
<< " \"from\": " << tag->fromFrame() << ","
- << " \"to\": " << tag->toFrame() << " }";
+ << " \"to\": " << tag->toFrame() << ","
+ << " \"direction\": \"" << escape_for_json(convert_to_string(tag->aniDir())) << "\" }";
}
}
os << "\n ]";
diff --git a/src/doc/CMakeLists.txt b/src/doc/CMakeLists.txt
index 1c8c56a..0d3bf8e 100644
--- a/src/doc/CMakeLists.txt
+++ b/src/doc/CMakeLists.txt
@@ -11,6 +11,7 @@ add_library(doc-lib
algorithm/rotsprite.cpp
algorithm/shift_image.cpp
algorithm/shrink_bounds.cpp
+ anidir.cpp
blend_funcs.cpp
brush.cpp
cel.cpp
diff --git a/src/doc/anidir.cpp b/src/doc/anidir.cpp
new file mode 100644
index 0000000..ecf8989
--- /dev/null
+++ b/src/doc/anidir.cpp
@@ -0,0 +1,25 @@
+// Aseprite Document Library
+// Copyright (c) 2001-2015 David Capello
+//
+// This file is released under the terms of the MIT license.
+// Read LICENSE.txt for more information.
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "doc/anidir.h"
+
+namespace doc {
+
+std::string convert_to_string(AniDir anidir)
+{
+ switch (anidir) {
+ case AniDir::FORWARD: return "forward";
+ case AniDir::REVERSE: return "reverse";
+ case AniDir::PING_PONG: return "pingpong";
+ }
+ return "";
+}
+
+} // namespace doc
diff --git a/src/doc/anidir.h b/src/doc/anidir.h
index e459f4a..208e8ed 100644
--- a/src/doc/anidir.h
+++ b/src/doc/anidir.h
@@ -8,6 +8,8 @@
#define DOC_ANIDIR_H_INCLUDED
#pragma once
+#include <string>
+
namespace doc {
enum class AniDir {
@@ -16,6 +18,8 @@ namespace doc {
PING_PONG = 2,
};
+ std::string convert_to_string(AniDir anidir);
+
} // namespace doc
#endif // DOC_ANIDIR_H_INCLUDED
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list