diff options
author | George Marques <george@gmarqu.es> | 2020-07-27 15:15:37 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-07-27 15:23:57 -0300 |
commit | 5cbd032309c50cb697e8d345318e9f7589b7475d (patch) | |
tree | 41b147fe3fd6121ef06518d4da611ba5bf11fd37 /scene | |
parent | 303515981b06a2afd86cfcac53aaebe6c176698c (diff) |
Fix input after removing multilevel calls
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/scene_tree.cpp | 8 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 14 |
2 files changed, 17 insertions, 5 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 75b3d7a73d..2449b3bd35 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 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()) { |