Merge pull request #111126 from HolonProduction/gotta-get-path

Optimize initial `Node::get_path` call by avoiding `Vector::reverse`
This commit is contained in:
Thaddeus Crews
2025-10-02 15:12:01 -05:00

View File

@ -2416,14 +2416,14 @@ NodePath Node::get_path() const {
const Node *n = this;
Vector<StringName> path;
path.resize(data.depth);
StringName *ptrw = path.ptrw();
while (n) {
path.push_back(n->get_name());
ptrw[n->data.depth - 1] = n->get_name();
n = n->data.parent;
}
path.reverse();
data.path_cache = memnew(NodePath(path, true));
return *data.path_cache;