Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 948 vs 949 for /trunk/Source Code/Graphs/SceneGraph.cpp

Diff revisions: vs.
  @@ -129,21 +129,27 @@
129 129
130 130 void SceneGraph::idle()
131 131 {
132 - if (!_pendingDeletionNodes.empty()) {
133 - for (SceneGraphNode_wptr node : _pendingDeletionNodes) {
134 - deleteNode(node, true);
132 + if (!_pendingRemovalNodes.empty()) {
133 + for (SceneGraphNode_wptr node : _pendingRemovalNodes) {
134 + removeNode(node, false);
135 135 }
136 136
137 - _pendingDeletionNodes.clear();
137 + _pendingRemovalNodes.clear();
138 138 }
139 139 }
140 140
141 - void SceneGraph::deleteNode(SceneGraphNode_wptr node, bool deleteOnAdd) {
141 + void SceneGraph::removeNodesByType(SceneNodeType nodeType) {
142 + getRoot().removeNodesByType(nodeType);
143 + }
144 +
145 + void SceneGraph::removeNode(SceneGraphNode_wptr node, bool deferrRemoval) {
142 146 SceneGraphNode_ptr sgn = node.lock();
143 147 if (!sgn) {
144 148 return;
145 149 }
146 - if (deleteOnAdd) {
150 + if (deferrRemoval) {
151 + _pendingRemovalNodes.push_back(node);
152 + } else {
147 153 SceneGraphNode_ptr parent = sgn->getParent().lock();
148 154 if (parent) {
149 155 parent->removeNode(*sgn, false);
  @@ -151,8 +157,6 @@
151 157
152 158 assert(sgn.unique());
153 159 sgn.reset();
154 - } else {
155 - _pendingDeletionNodes.push_back(node);
156 160 }
157 161 }
158 162