| 1459 | } |
| 1460 | |
| 1461 | IParticleDef::Ptr ParticleEditor::createAndSelectNewParticle() |
| 1462 | { |
| 1463 | std::string particleName = queryNewParticleName(); |
| 1464 | |
| 1465 | if (particleName.empty()) |
| 1466 | { |
| 1467 | return IParticleDef::Ptr(); // no valid name, abort |
| 1468 | } |
| 1469 | |
| 1470 | std::string destFile = queryParticleFile(); |
| 1471 | |
| 1472 | if (destFile.empty()) |
| 1473 | { |
| 1474 | return IParticleDef::Ptr(); // no valid destination file |
| 1475 | } |
| 1476 | |
| 1477 | // Good filename, good destination file, we're set to go |
| 1478 | auto particle = GlobalParticlesManager().findOrInsertParticleDef(particleName); |
| 1479 | |
| 1480 | particle->setFilename("particles/" + destFile); |
| 1481 | |
| 1482 | // Re-load the particles list |
| 1483 | populateParticleDefList(); |
| 1484 | |
| 1485 | // Highlight our new particle |
| 1486 | selectParticleDef(particle->getDeclName()); |
| 1487 | |
| 1488 | return particle; |
| 1489 | } |
| 1490 | |
| 1491 | std::string ParticleEditor::queryParticleFile() |
| 1492 | { |
nothing calls this directly
no test coverage detected