File tree Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Expand file tree Collapse file tree 2 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,10 @@ void PrintUsage()
9
9
std::cout << " fbxcppcli [COMMAND]" << std::endl <<
10
10
std::endl <<
11
11
" Available Commands" << std::endl <<
12
- " help Display this help text." << std::endl <<
13
- " info [FILENAME] Display file info about FILENAME." << std::endl <<
14
- " print [FILENAME] Display the contents of FILENAME." << std::endl <<
12
+ " help Display this help text." << std::endl <<
13
+ " info [FILENAME] Display file info about FILENAME." << std::endl <<
14
+ " print [FILENAME] Display the contents of FILENAME." << std::endl <<
15
+ " convert [SOURCE] [DEST] Open the SOURCE file and then save it as ascii at DEST." << std::endl <<
15
16
std::endl;
16
17
}
17
18
@@ -79,6 +80,29 @@ int main (int argc, const char *argv[])
79
80
return 0 ;
80
81
}
81
82
83
+ if (command == " convert" )
84
+ {
85
+ if (argc <= 2 )
86
+ {
87
+ std::cout << " print: No source filename provided." << std::endl;
88
+ PrintUsage ();
89
+ return 2 ;
90
+ }
91
+ if (argc <= 3 )
92
+ {
93
+ std::cout << " print: No destination filename provided." << std::endl;
94
+ PrintUsage ();
95
+ return 2 ;
96
+ }
97
+
98
+ std::string source = argv[2 ];
99
+ FbxScene* scene = Load (source.c_str ());
100
+ std::string dest = argv[3 ];
101
+ Save (dest.c_str (), scene);
102
+ return 0 ;
103
+ }
104
+
82
105
std::cout << " Unknown command \" " << command << " \" " << std::endl;
106
+ PrintUsage ();
83
107
return 1 ;
84
108
}
Original file line number Diff line number Diff line change @@ -29,11 +29,11 @@ void Save(const char* filename, FbxScene* scene)
29
29
FbxManager* manager = scene->GetFbxManager ();
30
30
31
31
FbxIOSettings* ios = FbxIOSettings::Create (manager, IOSROOT);
32
- ios->SetEnumProp (EXP_ASCIIFBX, 1 );
32
+ ios->SetBoolProp (EXP_ASCIIFBX, true );
33
33
34
34
FbxExporter * ex = FbxExporter::Create (manager, " " );
35
-
36
- ex->Initialize (filename, - 1 , ios);
35
+ int lFormat = manager-> GetIOPluginRegistry ()-> FindWriterIDByDescription ( " FBX ascii (*.fbx) " );
36
+ ex->Initialize (filename, lFormat , ios);
37
37
ex->Export (scene);
38
38
}
39
39
You can’t perform that action at this time.
0 commit comments