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

Method reparent

radiantcore/selection/algorithm/Group.cpp:81–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void ParentPrimitivesToEntityWalker::reparent()
82{
83 for (const scene::INodePtr& i : _childrenToReparent)
84 {
85 // Remove this path from the old parent
86 scene::removeNodeFromParent(i);
87
88 // Insert the child node into the parent node
89 _parent->addChildNode(i);
90 }
91
92 rMessage() << "Reparented " << _childrenToReparent.size()
93 << " primitives." << std::endl;
94
95 // Update parent node/subgraph visibility after reparenting
96 scene::UpdateNodeVisibilityWalker updater(_parent->getRootNode()->getLayerManager());
97
98 // Update the new parent too
99 _parent->traverse(updater);
100
101 for (const scene::INodePtr& i : _oldParents)
102 {
103 i->traverse(updater);
104 }
105
106 // Now check if any parents were left behind empty
107 for (const scene::INodePtr& oldParent : _oldParents)
108 {
109 if (!scene::hasChildPrimitives(oldParent))
110 {
111 // Is empty, but make sure we're not removing the worldspawn
112 if (Node_isWorldspawn(oldParent)) continue;
113
114 // Is empty now, remove it
115 scene::removeNodeFromParent(oldParent);
116 }
117 }
118
119 // Update the scene
120 SceneChangeNotify();
121}
122
123void ParentPrimitivesToEntityWalker::selectReparentedPrimitives()
124{

Callers 5

revertGroupToWorldSpawnFunction · 0.80
parentSelectionFunction · 0.80
mergeSelectedEntitiesFunction · 0.80

Calls 9

removeNodeFromParentFunction · 0.85
rMessageFunction · 0.85
hasChildPrimitivesFunction · 0.85
Node_isWorldspawnFunction · 0.85
SceneChangeNotifyFunction · 0.85
addChildNodeMethod · 0.80
sizeMethod · 0.45
getRootNodeMethod · 0.45
traverseMethod · 0.45

Tested by

no test coverage detected