| 1285 | } |
| 1286 | |
| 1287 | void LiveEditor::_remove_node_func(const NodePath &p_at) { |
| 1288 | SceneTree *scene_tree = SceneTree::get_singleton(); |
| 1289 | if (!scene_tree) { |
| 1290 | return; |
| 1291 | } |
| 1292 | |
| 1293 | Node *base = nullptr; |
| 1294 | if (scene_tree->root->has_node(live_edit_root)) { |
| 1295 | base = scene_tree->root->get_node(live_edit_root); |
| 1296 | } |
| 1297 | |
| 1298 | HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene); |
| 1299 | if (!E) { |
| 1300 | return; //scene not editable |
| 1301 | } |
| 1302 | |
| 1303 | Vector<Node *> to_delete; |
| 1304 | |
| 1305 | for (HashSet<Node *>::Iterator F = E->value.begin(); F; ++F) { |
| 1306 | Node *n = *F; |
| 1307 | |
| 1308 | if (base && !base->is_ancestor_of(n)) { |
| 1309 | continue; |
| 1310 | } |
| 1311 | |
| 1312 | if (!n->has_node(p_at)) { |
| 1313 | continue; |
| 1314 | } |
| 1315 | Node *n2 = n->get_node(p_at); |
| 1316 | |
| 1317 | to_delete.push_back(n2); |
| 1318 | } |
| 1319 | |
| 1320 | for (int i = 0; i < to_delete.size(); i++) { |
| 1321 | memdelete(to_delete[i]); |
| 1322 | } |
| 1323 | } |
| 1324 | |
| 1325 | void LiveEditor::_remove_and_keep_node_func(const NodePath &p_at, ObjectID p_keep_id) { |
| 1326 | SceneTree *scene_tree = SceneTree::get_singleton(); |
no test coverage detected