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

Function deleteSelection

radiantcore/selection/algorithm/General.cpp:447–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void deleteSelection()
448{
449 std::set<scene::INodePtr> eraseList;
450
451 // Traverse the scene, collecting all selected nodes
452 GlobalSelectionSystem().foreachSelected([&] (const scene::INodePtr& node)
453 {
454 // Check for selected nodes whose parent is not NULL and are not root
455 if (node->getParent() != NULL && !node->isRoot())
456 {
457 // Found a candidate
458 eraseList.insert(node);
459 }
460 });
461
462 std::for_each(eraseList.begin(), eraseList.end(), [] (const scene::INodePtr& node)
463 {
464 scene::INodePtr parent = node->getParent();
465
466 // Check for NULL parents. It's possible that both parent and child are in the eraseList
467 // and the parent has been deleted already.
468 if (parent)
469 {
470 // Remove the childnodes
471 scene::removeNodeFromParent(node);
472
473 if (!parent->hasChildNodes())
474 {
475 // Remove the parent as well
476 scene::removeNodeFromParent(parent);
477 }
478 }
479 });
480
481 SceneChangeNotify();
482}
483
484void deleteSelectionCmd(const cmd::ArgumentList& args)
485{

Callers 7

deleteSelectionCmdFunction · 0.85
DoSelectionMethod · 0.85
cutFunction · 0.85
setRegionFromBrushMethod · 0.85
exportSelectedAsModelFunction · 0.85
createSimplePatchFunction · 0.85

Calls 10

for_eachFunction · 0.85
removeNodeFromParentFunction · 0.85
SceneChangeNotifyFunction · 0.85
isRootMethod · 0.80
hasChildNodesMethod · 0.80
foreachSelectedMethod · 0.45
getParentMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected