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

Method onRemoveFromScene

libs/scene/SelectableNode.cpp:50–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void SelectableNode::onRemoveFromScene(IMapRootNode& root)
51{
52 setSelected(false);
53
54 disconnectUndoSystem(root.getUndoSystem());
55
56 // When a node is removed from the scene with a non-empty group assignment
57 // we do notify the SelectionGroup to remove ourselves, but we keep the ID list
58 // That way we can re-add ourselves when being inserted into the scene again
59
60 if (!_groups.empty())
61 {
62 // Copy the group IDs, as calling removeNode() will alter the group ID list
63 GroupIds copy(_groups);
64
65 // Remove ourselves from all groups
66 while (!_groups.empty())
67 {
68 std::size_t id = _groups.front();
69
70 auto group = root.getSelectionGroupManager().getSelectionGroup(id);
71
72 if (group)
73 {
74 group->removeNode(getSelf());
75 }
76 else
77 {
78 _groups.erase(_groups.begin());
79 }
80 }
81
82 // Now copy the values back in for later use
83 _groups.swap(copy);
84 }
85
86 Node::onRemoveFromScene(root);
87}
88
89void SelectableNode::setSelected(bool select)
90{

Callers

nothing calls this directly

Calls 6

setSelectedFunction · 0.85
emptyMethod · 0.45
getSelectionGroupMethod · 0.45
removeNodeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected