| 2427 | } |
| 2428 | |
| 2429 | NodePath Node::get_path() const { |
| 2430 | ERR_FAIL_COND_V_MSG(!is_inside_tree(), NodePath(), "Cannot get path of node as it is not in a scene tree."); |
| 2431 | |
| 2432 | if (data.path_cache) { |
| 2433 | return *data.path_cache; |
| 2434 | } |
| 2435 | |
| 2436 | const Node *n = this; |
| 2437 | |
| 2438 | Vector<StringName> path; |
| 2439 | |
| 2440 | while (n) { |
| 2441 | path.push_back(n->get_name()); |
| 2442 | n = n->data.parent; |
| 2443 | } |
| 2444 | |
| 2445 | path.reverse(); |
| 2446 | |
| 2447 | data.path_cache = memnew(NodePath(path, true)); |
| 2448 | |
| 2449 | return *data.path_cache; |
| 2450 | } |
| 2451 | |
| 2452 | bool Node::is_in_group(const StringName &p_identifier) const { |
| 2453 | ERR_THREAD_GUARD_V(false); |
no test coverage detected