Blackboard: Refactor prefetching
This commit is contained in:
parent
9abf8a084f
commit
1fb92ca412
|
@ -47,12 +47,13 @@ void Blackboard::erase_var(const Variant &p_key) {
|
||||||
|
|
||||||
void Blackboard::prefetch_nodepath_vars(Node *p_node) {
|
void Blackboard::prefetch_nodepath_vars(Node *p_node) {
|
||||||
ERR_FAIL_COND(p_node == nullptr);
|
ERR_FAIL_COND(p_node == nullptr);
|
||||||
for (int i = 0; i < data.size(); i++) {
|
Array keys = data.keys();
|
||||||
Variant value = data.get_value_at_index(i);
|
Array values = data.values();
|
||||||
if (value.get_type() == Variant::NODE_PATH) {
|
for (int i = 0; i < keys.size(); i++) {
|
||||||
Node *fetched_node = p_node->get_node_or_null(value);
|
if (values[i].get_type() == Variant::NODE_PATH) {
|
||||||
|
Node *fetched_node = p_node->get_node_or_null(values[i]);
|
||||||
if (fetched_node != nullptr) {
|
if (fetched_node != nullptr) {
|
||||||
data[data.get_key_at_index(i)] = fetched_node;
|
data[keys[i]] = fetched_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue