1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2015 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Author: Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
19 #include <nel/misc/types_nl.h>
20 #include "../mesh_utils/mesh_utils.h"
22 #include <nel/misc/cmd_args.h>
23 #include <nel/misc/path.h>
25 #include <nel/3d/register_3d.h>
26 #include <nel/3d/scene.h>
28 int main(int argc
, char *argv
[])
30 NLMISC::CApplicationContext app
;
32 NLMISC::CCmdArgs args
;
34 args
.addArg("d", "dst", "destination", "Destination directory path");
35 args
.addArg("", "dependlog", "log", "Dependencies log path");
36 args
.addArg("", "errorlog", "log", "Errors log path");
37 args
.addAdditionalArg("input", "Filename of 3D model to convert", false);
39 if (!args
.parse(argc
, argv
)) return EXIT_SUCCESS
;
41 const std::vector
<std::string
> &filePathes
= args
.getAdditionalArg("input");
43 NL3D::CScene::registerBasics();
44 NL3D::registerSerial3d();
48 for(uint i
= 0; i
< filePathes
.size(); ++i
)
50 std::string filePath
= filePathes
[i
];
52 if (!NLMISC::CFile::fileExists(filePath
))
54 nlerror("File '%s' does not exist", filePath
.c_str());
58 CMeshUtilsSettings settings
;
59 settings
.SourceFilePath
= filePath
;
61 if (args
.haveArg("d"))
62 settings
.DestinationDirectoryPath
= args
.getArg("d").front();
64 if (settings
.DestinationDirectoryPath
.empty())
65 settings
.DestinationDirectoryPath
= filePath
+ "_export";
67 settings
.DestinationDirectoryPath
= NLMISC::CPath::standardizePath(settings
.DestinationDirectoryPath
);
69 if (args
.haveLongArg("dependlog"))
70 settings
.ToolDependLog
= args
.getLongArg("dependlog").front();
72 if (settings
.ToolDependLog
.empty())
73 settings
.ToolDependLog
= settings
.DestinationDirectoryPath
+ "depend.log";
75 if (args
.haveLongArg("errorlog"))
76 settings
.ToolErrorLog
= args
.getLongArg("errorlog").front();
78 if (settings
.ToolErrorLog
.empty())
79 settings
.ToolErrorLog
= settings
.DestinationDirectoryPath
+ "error.log";
81 res
= exportScene(settings
);
83 if (res
!= EXIT_SUCCESS
) break;