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

Method createAndSelectNewParticle

radiant/ui/particles/ParticleEditor.cpp:1461–1489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1459}
1460
1461IParticleDef::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
1491std::string ParticleEditor::queryParticleFile()
1492{

Callers

nothing calls this directly

Calls 4

getDeclNameMethod · 0.80
emptyMethod · 0.45
setFilenameMethod · 0.45

Tested by

no test coverage detected