mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Optimize initial Node::get_path
call by avoiding Vector::reverse
This commit is contained in:
parent
8d8041bd4d
commit
b50ce590b4
1 changed files with 3 additions and 3 deletions
|
@ -2396,14 +2396,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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue