diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 75b3d7a73dc..2449b3bd35a 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -875,8 +875,12 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p continue; } - n->call(p_method, (const Variant **)v, 1); - //ERR_FAIL_COND(node_count != g.nodes.size()); + Callable::CallError err; + // Call both script and native method. + if (n->get_script_instance()) { + n->get_script_instance()->call(p_method, (const Variant **)v, 1, err); + } + n->call(p_method, (const Variant **)v, 1, err); } call_lock--; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 16d03258812..d962171555f 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1607,7 +1607,17 @@ void Viewport::_gui_call_input(Control *p_control, const Ref &p_inpu } if (control->data.mouse_filter != Control::MOUSE_FILTER_IGNORE) { - control->call(SceneStringNames::get_singleton()->_gui_input, ev); + // Call both script and native methods. + Callable::CallError error; + Variant event = ev; + const Variant *args[1] = { &event }; + if (control->get_script_instance()) { + control->get_script_instance()->call(SceneStringNames::get_singleton()->_gui_input, args, 1, error); + } + MethodBind *method = ClassDB::get_method(control->get_class_name(), SceneStringNames::get_singleton()->_gui_input); + if (method) { + method->call(control, args, 1, error); + } } if (!control->is_inside_tree() || control->is_set_as_toplevel()) { @@ -2989,10 +2999,8 @@ void Viewport::unhandled_input(const Ref &p_event, bool p_local_coor } get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this); - //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_input","_unhandled_input",ev); if (!is_input_handled() && Object::cast_to(*ev) != nullptr) { get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this); - //call_group(GROUP_CALL_REVERSE|GROUP_CALL_REALTIME|GROUP_CALL_MULIILEVEL,"unhandled_key_input","_unhandled_key_input",ev); } if (physics_object_picking && !is_input_handled()) {