Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print error on invalid call_group() calls #97240

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scene/main/scene_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,15 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro
continue;
}

Node *node = gr_nodes[i];
if (!(p_call_flags & GROUP_CALL_DEFERRED)) {
Callable::CallError ce;
gr_nodes[i]->callp(p_function, p_args, p_argcount, ce);
node->callp(p_function, p_args, p_argcount, ce);
if (unlikely(ce.error != Callable::CallError::CALL_OK && ce.error != Callable::CallError::CALL_ERROR_INVALID_METHOD)) {
ERR_PRINT(vformat("Error calling group method on node \"%s\": %s.", node->get_name(), Variant::get_callable_error_text(Callable(node, p_function), p_args, p_argcount, ce)));
}
} else {
MessageQueue::get_singleton()->push_callp(gr_nodes[i], p_function, p_args, p_argcount);
MessageQueue::get_singleton()->push_callp(node, p_function, p_args, p_argcount);
}
}

Expand All @@ -316,11 +320,15 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro
continue;
}

Node *node = gr_nodes[i];
if (!(p_call_flags & GROUP_CALL_DEFERRED)) {
Callable::CallError ce;
gr_nodes[i]->callp(p_function, p_args, p_argcount, ce);
node->callp(p_function, p_args, p_argcount, ce);
if (unlikely(ce.error != Callable::CallError::CALL_OK && ce.error != Callable::CallError::CALL_ERROR_INVALID_METHOD)) {
ERR_PRINT(vformat("Error calling group method on node \"%s\": %s.", node->get_name(), Variant::get_callable_error_text(Callable(node, p_function), p_args, p_argcount, ce)));
}
} else {
MessageQueue::get_singleton()->push_callp(gr_nodes[i], p_function, p_args, p_argcount);
MessageQueue::get_singleton()->push_callp(node, p_function, p_args, p_argcount);
}
}
}
Expand Down
Loading