annotate goatview/src/main.cc @ 90:8b156bc5205b
[maxgoat] fixed the transform export bug
[goatview] added widgets for the animation controls
[goatview] added a grid ground plane with automatic sizing and transitions from size to size
author |
John Tsiombikas <nuclear@member.fsf.org> |
date |
Sat, 17 May 2014 06:26:24 +0300 |
parents |
9785847d52d4 |
children |
21319e71117f |
rev |
line source |
nuclear@73
|
1 #include <QtWidgets/QtWidgets>
|
nuclear@75
|
2 #include <QtCore/QtCore>
|
nuclear@73
|
3 #include "goatview.h"
|
nuclear@73
|
4
|
nuclear@73
|
5 int main(int argc, char **argv)
|
nuclear@73
|
6 {
|
nuclear@73
|
7 QApplication app(argc, argv);
|
nuclear@75
|
8 app.setOrganizationName("Mutant Stargoat");
|
nuclear@75
|
9 app.setOrganizationDomain("mutantstargoat.com");
|
nuclear@75
|
10 app.setApplicationName("GoatView");
|
nuclear@82
|
11
|
nuclear@82
|
12 GoatView gview;
|
nuclear@75
|
13
|
nuclear@75
|
14 QCommandLineParser argparse;
|
nuclear@75
|
15 argparse.addHelpOption();
|
nuclear@75
|
16
|
nuclear@75
|
17 argparse.addPositionalArgument("scene", "scene file to open");
|
nuclear@75
|
18 argparse.addOption(QCommandLineOption("a", "add animation file"));
|
nuclear@75
|
19 argparse.process(app);
|
nuclear@75
|
20
|
nuclear@75
|
21 const QStringList &args = argparse.positionalArguments();
|
nuclear@75
|
22 if(!args.isEmpty()) {
|
nuclear@75
|
23 if(args.count() > 1) {
|
nuclear@75
|
24 fprintf(stderr, "please specify at most one scene file to open\n");
|
nuclear@75
|
25 return 1;
|
nuclear@75
|
26 }
|
nuclear@75
|
27 std::string fname = args.at(0).toStdString();
|
nuclear@75
|
28 printf("loading scene file: %s ...\n", fname.c_str());
|
nuclear@82
|
29 if(!gview.load_scene(fname.c_str())) {
|
nuclear@75
|
30 fprintf(stderr, "failed to load scene: %s\n", fname.c_str());
|
nuclear@75
|
31 return 1;
|
nuclear@75
|
32 }
|
nuclear@75
|
33 }
|
nuclear@75
|
34
|
nuclear@75
|
35 const QStringList &anims = argparse.values("a");
|
nuclear@75
|
36 QStringList::const_iterator it = anims.begin();
|
nuclear@75
|
37 while(it != anims.end()) {
|
nuclear@75
|
38 std::string fname = it++->toStdString();
|
nuclear@75
|
39 printf("loading animation file: %s ...\n", fname.c_str());
|
nuclear@75
|
40
|
nuclear@75
|
41 if(goat3d_load_anim(scene, fname.c_str()) == -1) {
|
nuclear@75
|
42 fprintf(stderr, "failed to load animation: %s\n", fname.c_str());
|
nuclear@75
|
43 return 1;
|
nuclear@75
|
44 }
|
nuclear@75
|
45 }
|
nuclear@73
|
46
|
nuclear@73
|
47 gview.show();
|
nuclear@73
|
48
|
nuclear@73
|
49 return app.exec();
|
nuclear@73
|
50 }
|