-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathassimp.ts
244 lines (239 loc) · 6.38 KB
/
assimp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
const helpOptions: Fig.Option[] = [
{
name: ["-h", "--help"],
description: "Detailed help on a command",
},
];
const commonOptions: Fig.Option[] = [
{
name: "-cfast",
description: "Fast post processing preset, runs just a few important steps",
},
{
name: "-cdefault",
description: "Default post processing: runs all recommended steps",
},
{
name: "-cfull",
description: "Fires almost all post processing steps",
},
];
const importExtGenerator: Fig.Generator = {
script: ["assimp", "listext"],
postProcess: function (out) {
return out.split(";").map((ext) => {
return {
name: ext,
description: "Extension",
};
});
},
};
const exportExtGenerator: Fig.Generator = {
script: ["assimp", "listexport"],
postProcess: function (out) {
return out.split("\n").map((ext) => {
return {
name: ext,
description: "Extension",
};
});
},
};
const completionSpec: Fig.Spec = {
name: "assimp",
description: "Open Asset Import Library",
subcommands: [
{
name: "listext",
description: "List all known file extensions available for import",
},
{
name: "listexport",
description: "List all supported export formats",
},
{
name: "knowext",
description: "List all known file extensions available for import",
args: {
name: "extension",
description: "Check whether a particular file extension is known by us",
generators: importExtGenerator,
},
},
{
name: "exportinfo",
description: "Show basic information on a specific export format",
args: {
name: "extension",
description: "Specific file extension",
generators: exportExtGenerator,
},
},
{
name: "info",
description:
"Load a model file and print basic statistics. Full postprocessing is applied unless the `-r` switch is specified",
args: {
name: "file",
description: "Print basic structure of a 3D model",
template: "filepaths",
isVariadic: true,
},
options: [
{
name: ["-r", "--raw"],
description: "No postprocessing, do a raw import",
},
{
name: ["-v", "--verbose"],
description: "Print verbose info such as node transform data",
},
{
name: ["-s", "--silent"],
description: "Print only minimal info",
},
...helpOptions,
],
},
{
name: "export",
description: "Export a file to one of the supported output formats",
args: [
{
name: "model",
description: "Relative or absolute path to the input model",
template: "filepaths",
},
{
name: "out",
description:
"Relative or absolute path to write the output export to",
template: "folders",
},
],
options: [
{
name: ["-f", "--format"],
description: "Export file formats supported by Assimp",
args: {
name: "format",
generators: exportExtGenerator,
},
},
...helpOptions,
],
},
{
name: "extract",
description: "Extract embedded texture images",
args: [
{
name: "model",
description: "Relative or absolute path to the input model",
template: "filepaths",
},
{
name: "out",
description:
"Relative or absolute path to write the output images to",
template: "folders",
isOptional: true,
},
],
options: [
{
name: ["-t", "--texture"],
description: "Zero-based index of the texture to be extracted",
args: {
name: "index",
},
},
{
name: ["-ba", "–-bmp-with-alpha"],
description:
"Specifies whether output BMPs contain an alpha channel or not",
},
{
name: ["-f", "--format"],
description:
"Specifies the output file format. Supported formats are BMP and TGA. The default value is BMP (if a full output filename is specified, the output file format is taken from its extension)",
args: {
name: "format",
suggestions: ["bmp", "tga"],
},
},
{
name: ["-s", "–-nosuffix"],
description:
"Prevents the tool from adding the _img<n> suffix to all filenames. This option must be specified together with -t to ensure that just one image is written",
},
...commonOptions,
...helpOptions,
],
},
{
name: "dump",
description: "Convert models to a binary or textual dump (ASSBIN/ASSXML)",
args: [
{
name: "model",
description: "Relative or absolute path to the input model",
template: "filepaths",
},
{
name: "out",
description:
"Relative or absolute path to write the output dump to. If it is omitted, the dump is written to '<model>-dump.txt'",
template: "folders",
isOptional: true,
},
],
options: [
{
name: ["-b", "--binary"],
description: "If true, the dump is written in binary format",
},
{
name: ["-s", "--short"],
description:
"If true, the dump is shortened to include only min/max values for all vertex components and animation channels",
},
{
name: ["-z", "--compressed"],
description: "If true, Compressed",
},
...commonOptions,
...helpOptions,
],
},
{
name: "cmpdump",
description: "Compare dumps created using 'assimp dump <file> -s ...'",
args: [
{
name: "actual",
description: "Mini dump now",
template: "filepaths",
},
{
name: "expected",
description: "Archived dump from some point in the past",
template: "filepaths",
},
],
options: helpOptions,
},
{
name: "version",
description: "Display Assimp version",
},
],
options: [
{
name: ["-h", "--help"],
description: "Display some basic help",
},
],
};
export default completionSpec;