| 297 | } |
| 298 | |
| 299 | QString ccCommandLineParser::exportEntity( CLEntityDesc& entityDesc, |
| 300 | const QString& suffix/*=QString()*/, |
| 301 | QString* baseOutputFilename/*=nullptr*/, |
| 302 | ccCommandLineInterface::ExportOptions options/*ExportOptiopn::NoOption*/) |
| 303 | { |
| 304 | print("[SAVING]"); |
| 305 | |
| 306 | //fetch the real entity |
| 307 | ccHObject* entity = entityDesc.getEntity(); |
| 308 | if (!entity) |
| 309 | { |
| 310 | assert(false); |
| 311 | return "[ExportEntity] Internal error: invalid input entity!"; |
| 312 | } |
| 313 | |
| 314 | bool anyForced = options.testFlag(ExportOption::ForceCloud) | options.testFlag(ExportOption::ForceHierarchy) | options.testFlag(ExportOption::ForceMesh); |
| 315 | //specific case: clouds |
| 316 | bool isCloud = entity->isA(CC_TYPES::POINT_CLOUD) || entityDesc.getCLEntityType() == CL_ENTITY_TYPE::CLOUD; |
| 317 | |
| 318 | //specific case: mesh |
| 319 | bool isMesh = entity->isKindOf(CC_TYPES::MESH) || entityDesc.getCLEntityType() == CL_ENTITY_TYPE::MESH; |
| 320 | |
| 321 | QString extension = isCloud ? m_cloudExportExt : isMesh ? m_meshExportExt : m_hierarchyExportExt; |
| 322 | QString format = isCloud ? m_cloudExportFormat : isMesh ? m_meshExportFormat : m_hierarchyExportFormat; |
| 323 | if (anyForced) |
| 324 | { |
| 325 | if (options.testFlag(ExportOption::ForceCloud)) |
| 326 | { |
| 327 | extension = m_cloudExportExt; |
| 328 | format = m_cloudExportFormat; |
| 329 | } |
| 330 | if (options.testFlag(ExportOption::ForceMesh)) |
| 331 | { |
| 332 | extension = m_meshExportExt; |
| 333 | format = m_meshExportFormat; |
| 334 | } |
| 335 | if (options.testFlag(ExportOption::ForceHierarchy)) |
| 336 | { |
| 337 | extension = m_hierarchyExportExt; |
| 338 | format = m_hierarchyExportFormat; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | QString outputFilename = getExportFilename( entityDesc, |
| 343 | extension, |
| 344 | suffix, |
| 345 | baseOutputFilename, |
| 346 | options.testFlag(ExportOption::ForceNoTimestamp) ); |
| 347 | if (outputFilename.isEmpty()) |
| 348 | { |
| 349 | return QString(); |
| 350 | } |
| 351 | |
| 352 | //update the entity name as well |
| 353 | { |
| 354 | QString entName = entity->getName(); |
| 355 | if (entName.isEmpty()) |
| 356 | { |
no test coverage detected