1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Use RequiredParam and RequiredResult in a handful of places in order to test

This commit is contained in:
David Snopek
2025-10-08 16:37:43 -05:00
parent d95d49ee12
commit 090a4540b7
10 changed files with 68 additions and 68 deletions

View File

@@ -1696,11 +1696,11 @@ void Node::_add_child_nocheck(Node *p_child, const StringName &p_name, InternalM
emit_signal(SNAME("child_order_changed"));
}
void Node::add_child(Node *p_child, bool p_force_readable_name, InternalMode p_internal) {
void Node::add_child(RequiredParam<Node> rp_child, bool p_force_readable_name, InternalMode p_internal) {
ERR_FAIL_COND_MSG(data.tree && !Thread::is_main_thread(), "Adding children to a node inside the SceneTree is only allowed from the main thread. Use call_deferred(\"add_child\",node).");
ERR_THREAD_GUARD
ERR_FAIL_NULL(p_child);
EXTRACT_PARAM_OR_FAIL(p_child, rp_child);
ERR_FAIL_COND_MSG(p_child == this, vformat("Can't add child '%s' to itself.", p_child->get_name())); // adding to itself!
ERR_FAIL_COND_MSG(p_child->data.parent, vformat("Can't add child '%s' to '%s', already has a parent '%s'.", p_child->get_name(), get_name(), p_child->data.parent->get_name())); //Fail if node has a parent
#ifdef DEBUG_ENABLED
@@ -2635,7 +2635,7 @@ void Node::_propagate_replace_owner(Node *p_owner, Node *p_by_owner) {
data.blocked--;
}
Ref<Tween> Node::create_tween() {
RequiredResult<Tween> Node::create_tween() {
ERR_THREAD_GUARD_V(Ref<Tween>());
SceneTree *tree = data.tree;