MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / exportSelectedAsModelCmd

Function exportSelectedAsModelCmd

radiantcore/map/algorithm/Export.cpp:190–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void exportSelectedAsModelCmd(const cmd::ArgumentList& args)
191{
192 if (args.size() < 2 || args.size() > 8)
193 {
194 rMessage() << "Usage: ExportSelectedAsModel <Path> <ExportFormat> [<ExportOrigin>] [<OriginEntityName>] "
195 "[<CustomOrigin>][<SkipCaulk>][<ReplaceSelectionWithModel>][<ExportLightsAsObjects>]" << std::endl;
196 rMessage() << " <Path> must be an absolute file system path" << std::endl;
197 rMessage() << " <ExportFormat> one of the available formats, e.g. lwo, ase, obj" << std::endl;
198 rMessage() << " [<ExportOrigin>]: 0 = Map origin, 1 = SelectionCenter, 2 = EntityOrigin, 3 = CustomOrigin" << std::endl;
199 rMessage() << " [<OriginEntityName>]: the name of the entity defining origin (if ExportOrigin == 2)" << std::endl;
200 rMessage() << " [<CustomOrigin>]: the Vector3 to be used as custom origin (if ExportOrigin == 3)" << std::endl;
201 rMessage() << " [<SkipCaulk>] as 1 to skip caulked surfaces" << std::endl;
202 rMessage() << " [<ReplaceSelectionWithModel>] as 1 to delete the selection and put the exported model in its place" << std::endl;
203 rMessage() << " [<ExportLightsAsObjects>] as 1 to export lights as small polyhedric objects" << std::endl;
204 return;
205 }
206
207 model::ModelExportOptions options;
208
209 options.outputFilename = args[0].getString();
210 options.outputFormat = args[1].getString();
211 options.exportOrigin = model::ModelExportOrigin::MapOrigin;
212 options.entityName = std::string();
213 options.customExportOrigin = Vector3(0,0,0);
214 options.skipCaulk = false;
215 options.replaceSelectionWithModel = false;
216 options.exportLightsAsObjects = false;
217
218 if (args.size() >= 3)
219 {
220 options.exportOrigin = model::getExportOriginFromString(args[2].getString());
221 }
222
223 if (args.size() >= 4)
224 {
225 options.entityName = args[3].getString();
226 }
227
228 if (args.size() >= 5)
229 {
230 options.customExportOrigin = args[4].getVector3();
231 }
232
233 if (args.size() >= 6)
234 {
235 options.skipCaulk = (args[5].getInt() != 0);
236 }
237
238 if (args.size() >= 7)
239 {
240 options.replaceSelectionWithModel = (args[6].getInt() != 0);
241 }
242
243 if (args.size() >= 8)
244 {
245 options.exportLightsAsObjects = (args[7].getInt() != 0);
246 }
247

Callers

nothing calls this directly

Calls 7

rMessageFunction · 0.85
exportSelectedAsModelFunction · 0.85
getIntMethod · 0.80
sizeMethod · 0.45
getStringMethod · 0.45
getVector3Method · 0.45

Tested by

no test coverage detected