Fix input after removing multilevel calls

This commit is contained in:
George Marques 2020-07-27 15:15:37 -03:00
parent 303515981b
commit 5cbd032309
No known key found for this signature in database
GPG Key ID: 046BD46A3201E43D
2 changed files with 17 additions and 5 deletions

View File

@ -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--;

View File

@ -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()) {