Merge pull request #66145 from lawnjelly/object_get_name

This commit is contained in:
Rémi Verschelde 2022-09-21 12:04:19 +02:00 committed by GitHub
commit 4207983ce9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -1477,7 +1477,9 @@ Error Object::connect(const StringName &p_signal, Object *p_to_object, const Str
s->slot_map[target].reference_count++;
return OK;
} else {
ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, "Signal '" + p_signal + "' is already connected to given method '" + p_to_method + "' in that object.");
ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER,
vformat("Signal \"%s\" from \"%s\" is already connected to given method \"%s\" in \"%s\".",
p_signal, to_string(), p_to_method, p_to_object->to_string()));
}
}

View file

@ -2126,6 +2126,8 @@ void Node::get_storable_properties(Set<StringName> &r_storable_properties) const
}
String Node::to_string() {
// This code doesn't print the script's name, it calls to_string() if you override it in a Node's script,
// which you only do if you specifically want to customize how the node should be represented by print().
if (get_script_instance()) {
bool valid;
String ret = get_script_instance()->to_string(&valid);