Description
Godot version
4.2.1
godot-cpp version
4.2
System information
Windows 11
Issue description
Control::gui_input
is not exposed and Control::_gui_input
is not its GDExtension counterpart, not allowing sending events to other Control
nodes with specific behaviours.
The use case is trying to reproduce the behaviour of Godot visual shader editor add node dialogue, where you can filter the options with a LineEdit
on focus, while also being able to go up and down with the keyboard among the filtered member options in the Tree
.
This is the code you want to be able to call to sent events to Tree *member
(from https://github.com/godotengine/godot/blob/master/editor/plugins/visual_shader_editor_plugin.cpp)...
void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> ie = p_ie;
if (ie.is_valid() && (ie->get_keycode() == Key::UP || ie->get_keycode() == Key::DOWN || ie->get_keycode() == Key::ENTER || ie->get_keycode() == Key::KP_ENTER)) {
members->gui_input(ie);
node_filter->accept_event();
}
}
...but changing members->gui_input(ie);
to members->_gui_input(ie);
has not the same results, as _gui_input()
in GDExtension has only overriding purposes as of now.
I'll quote a comment by @Zylann from https://github.com/Zylann/godot_voxel/blob/master/editor/graph/voxel_graph_node_dialog.cpp as it seems he found the same issue:
// TODO GDX:
Control::gui_input()
is not exposed to GDExtension, can't forward events.
// This is whatVisualShaderEditor::_sbox_input
does.
//_gui_input
is exposed, but that's only for user implementation, not for calling directly...
// Alsogui_input
is a name already taken in GDScript, so if it gets exposed some day, it will need a
// different name.
//
// _tree->gui_input(key_event);
Will it be exposed correctly in the future?
Steps to reproduce
As explained in the description, try to use _gui_input()
on any Control
child class.
Minimal reproduction project
No minimal reproduction project needed.