diff options
Diffstat (limited to 'scene/main/viewport.cpp')
-rw-r--r-- | scene/main/viewport.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 16d0325881..d962171555 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<InputEvent> &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<InputEvent> &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<InputEventKey>(*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()) { |