Blackboard: Add erase_var()
This commit is contained in:
parent
6ae7ea8e40
commit
fa098fec09
|
@ -31,6 +31,10 @@ bool Blackboard::has_var(const Variant &p_key) const {
|
|||
return data.has(p_key) || (parent.is_valid() && parent->has_var(p_key));
|
||||
}
|
||||
|
||||
void Blackboard::erase_var(const Variant &p_key) {
|
||||
data.erase(p_key);
|
||||
}
|
||||
|
||||
void Blackboard::prefetch_nodepath_vars(Node *p_node) {
|
||||
ERR_FAIL_COND(p_node == nullptr);
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
@ -52,6 +56,7 @@ void Blackboard::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("has_var", "p_key"), &Blackboard::has_var);
|
||||
ClassDB::bind_method(D_METHOD("set_parent_scope", "p_blackboard"), &Blackboard::set_parent_scope);
|
||||
ClassDB::bind_method(D_METHOD("get_parent_scope"), &Blackboard::get_parent_scope);
|
||||
ClassDB::bind_method(D_METHOD("erase_var"), &Blackboard::erase_var);
|
||||
ClassDB::bind_method(D_METHOD("prefetch_nodepath_vars", "p_node"), &Blackboard::prefetch_nodepath_vars);
|
||||
ClassDB::bind_method(D_METHOD("top"), &Blackboard::top);
|
||||
}
|
|
@ -31,6 +31,8 @@ public:
|
|||
Variant get_var(const Variant &p_key, const Variant &p_default) const;
|
||||
void set_var(const Variant &p_key, const Variant &p_value);
|
||||
bool has_var(const Variant &p_key) const;
|
||||
void erase_var(const Variant &p_key);
|
||||
|
||||
void prefetch_nodepath_vars(Node *p_node);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue