TDME2  1.9.200
dumpmodel-main.cpp
Go to the documentation of this file.
1 #include <memory>
2 #include <string>
3 
4 #include <tdme/tdme.h>
9 #include <tdme/engine/Version.h>
12 #include <tdme/utilities/Console.h>
14 
15 using std::unique_ptr;
16 using std::string;
17 using std::to_string;
18 
28 
29 int main(int argc, char** argv)
30 {
31  Console::println(string("dumpmodel ") + Version::getVersion());
32  Console::println(Version::getCopyright());
33  Console::println();
34  if (argc != 2) {
35  Console::println("Usage: dumpmodel sourcefile");
36  Application::exit(Application::EXITCODE_FAILURE);
37  }
38  string fileName = string(argv[1]);
39  try {
40  Console::println("Loading source model: " + fileName);
41  auto model = unique_ptr<Model>(
42  ModelReader::read(
43  FileSystem::getInstance()->getPathName(fileName),
44  FileSystem::getInstance()->getFileName(fileName)
45  )
46  );
47  Console::println("Animation setups:");
48  for (const auto& [srcAnimationSetupId, srcAnimationSetup]: model->getAnimationSetups()) {
49  if (srcAnimationSetup->getOverlayFromNodeId().length() == 0) {
50  Console::println(
51  "Base animation: id = '" + srcAnimationSetup->getId() + "', " +
52  "start frame: " + to_string(srcAnimationSetup->getStartFrame()) + ", " +
53  "end frame: " + to_string(srcAnimationSetup->getEndFrame()) + ", " +
54  "loop: " + to_string(srcAnimationSetup->isLoop()) + ", " +
55  "speed: " + to_string(srcAnimationSetup->getSpeed())
56  );
57  } else {
58  Console::println(
59  "Overlay animation: id = '" + srcAnimationSetup->getId() + "', " +
60  "overlay node: '" + srcAnimationSetup->getOverlayFromNodeId() + "', " +
61  "start frame: " + to_string(srcAnimationSetup->getStartFrame()) + ", " +
62  "end frame: " + to_string(srcAnimationSetup->getEndFrame()) + ", " +
63  "loop: " + to_string(srcAnimationSetup->isLoop()) + ", " +
64  "speed: " + to_string(srcAnimationSetup->getSpeed())
65  );
66  }
67  }
68  } catch (Exception& exception) {
69  Console::println("An error occurred: " + string(exception.what()));
70  }
71 
72  //
73  Application::exit(Application::EXITCODE_SUCCESS);
74 }
Application base class, please make sure to allocate application on heap to have correct application ...
Definition: Application.h:41
Representation of a 3D model.
Definition: Model.h:35
File system singleton class.
Definition: FileSystem.h:17
Console class.
Definition: Console.h:29
int main(int argc, char **argv)
std::exception Exception
Exception base class.
Definition: Exception.h:18