summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2021-08-23 09:46:19 -0300
committerGitHub <noreply@github.com>2021-08-23 09:46:19 -0300
commita0ef77eaee427cf077ac884a8d3a956137ee615a (patch)
tree40bf21e1beae1a6883770d2ac0473222ff41ae65
parent2d446771d6701bb77432b6df5a768e53c9a6c95d (diff)
parent5cecdfa8afb91a60305b429f5b738e27dadbc83f (diff)
Merge pull request #51983 from reduz/remove-bind-vmethod
Entirely removes BIND_VMETHOD in favor of GDVIRTUAL
-rw-r--r--core/input/input_event.cpp9
-rw-r--r--core/input/input_event.h3
-rw-r--r--core/input/shortcut.cpp (renamed from scene/gui/shortcut.cpp)0
-rw-r--r--core/input/shortcut.h (renamed from scene/gui/shortcut.h)0
-rw-r--r--core/object/class_db.h11
-rw-r--r--core/register_core_types.cpp3
-rw-r--r--doc/classes/CollisionObject2D.xml2
-rw-r--r--doc/classes/CollisionObject3D.xml2
-rw-r--r--doc/classes/GraphEdit.xml2
-rw-r--r--doc/classes/InputEventShortcut.xml17
-rw-r--r--doc/classes/Node.xml12
-rw-r--r--doc/classes/Viewport.xml32
-rw-r--r--editor/animation_bezier_editor.cpp4
-rw-r--r--editor/animation_bezier_editor.h2
-rw-r--r--editor/animation_track_editor.cpp10
-rw-r--r--editor/animation_track_editor.h4
-rw-r--r--editor/animation_track_editor_plugins.cpp4
-rw-r--r--editor/animation_track_editor_plugins.h2
-rw-r--r--editor/code_editor.cpp7
-rw-r--r--editor/code_editor.h4
-rw-r--r--editor/create_dialog.cpp2
-rw-r--r--editor/editor_audio_buses.cpp4
-rw-r--r--editor/editor_audio_buses.h2
-rw-r--r--editor/editor_command_palette.cpp6
-rw-r--r--editor/editor_command_palette.h2
-rw-r--r--editor/editor_file_dialog.cpp4
-rw-r--r--editor/editor_file_dialog.h2
-rw-r--r--editor/editor_help.cpp4
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/editor_help_search.cpp2
-rw-r--r--editor/editor_inspector.cpp7
-rw-r--r--editor/editor_inspector.h4
-rw-r--r--editor/editor_node.cpp3
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_properties.cpp3
-rw-r--r--editor/editor_settings.h2
-rw-r--r--editor/editor_spin_slider.cpp4
-rw-r--r--editor/editor_spin_slider.h2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp3
-rw-r--r--editor/plugins/animation_player_editor_plugin.h2
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp4
-rw-r--r--editor/plugins/asset_library_editor_plugin.h2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h2
-rw-r--r--editor/plugins/curve_editor_plugin.cpp6
-rw-r--r--editor/plugins/curve_editor_plugin.h4
-rw-r--r--editor/plugins/mesh_editor_plugin.cpp6
-rw-r--r--editor/plugins/mesh_editor_plugin.h3
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp15
-rw-r--r--editor/plugins/node_3d_editor_plugin.h8
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.h2
-rw-r--r--editor/plugins/script_editor_plugin.cpp6
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.cpp2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h2
-rw-r--r--editor/plugins/texture_3d_editor_plugin.cpp4
-rw-r--r--editor/plugins/texture_3d_editor_plugin.h1
-rw-r--r--editor/plugins/texture_layered_editor_plugin.cpp3
-rw-r--r--editor/plugins/texture_layered_editor_plugin.h2
-rw-r--r--editor/plugins/tiles/tile_atlas_view.cpp6
-rw-r--r--editor/plugins/tiles/tile_atlas_view.h2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
-rw-r--r--editor/project_manager.cpp3
-rw-r--r--editor/project_manager.h2
-rw-r--r--editor/property_selector.cpp2
-rw-r--r--editor/quick_open.cpp2
-rw-r--r--editor/scene_tree_dock.cpp7
-rw-r--r--editor/scene_tree_dock.h4
-rw-r--r--editor/settings_config_dialog.cpp3
-rw-r--r--editor/settings_config_dialog.h2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--modules/visual_script/visual_script.cpp20
-rw-r--r--modules/visual_script/visual_script_editor.cpp4
-rw-r--r--modules/visual_script/visual_script_editor.h2
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp2
-rw-r--r--scene/2d/collision_object_2d.cpp8
-rw-r--r--scene/2d/collision_object_2d.h4
-rw-r--r--scene/2d/touch_screen_button.cpp8
-rw-r--r--scene/2d/touch_screen_button.h2
-rw-r--r--scene/3d/collision_object_3d.cpp8
-rw-r--r--scene/3d/collision_object_3d.h4
-rw-r--r--scene/gui/base_button.cpp6
-rw-r--r--scene/gui/base_button.h4
-rw-r--r--scene/gui/code_edit.cpp6
-rw-r--r--scene/gui/code_edit.h2
-rw-r--r--scene/gui/control.cpp26
-rw-r--r--scene/gui/control.h28
-rw-r--r--scene/gui/file_dialog.cpp4
-rw-r--r--scene/gui/file_dialog.h2
-rw-r--r--scene/gui/gradient_edit.cpp3
-rw-r--r--scene/gui/gradient_edit.h2
-rw-r--r--scene/gui/graph_edit.cpp16
-rw-r--r--scene/gui/graph_edit.h8
-rw-r--r--scene/gui/graph_node.cpp4
-rw-r--r--scene/gui/graph_node.h2
-rw-r--r--scene/gui/item_list.cpp4
-rw-r--r--scene/gui/item_list.h3
-rw-r--r--scene/gui/line_edit.cpp3
-rw-r--r--scene/gui/line_edit.h2
-rw-r--r--scene/gui/menu_button.cpp6
-rw-r--r--scene/gui/menu_button.h4
-rw-r--r--scene/gui/popup_menu.cpp6
-rw-r--r--scene/gui/popup_menu.h4
-rw-r--r--scene/gui/rich_text_label.cpp3
-rw-r--r--scene/gui/rich_text_label.h2
-rw-r--r--scene/gui/scroll_bar.cpp3
-rw-r--r--scene/gui/scroll_bar.h2
-rw-r--r--scene/gui/scroll_container.cpp3
-rw-r--r--scene/gui/scroll_container.h2
-rw-r--r--scene/gui/slider.cpp3
-rw-r--r--scene/gui/slider.h2
-rw-r--r--scene/gui/spin_box.cpp4
-rw-r--r--scene/gui/spin_box.h2
-rw-r--r--scene/gui/split_container.cpp4
-rw-r--r--scene/gui/split_container.h2
-rw-r--r--scene/gui/subviewport_container.cpp10
-rw-r--r--scene/gui/subviewport_container.h4
-rw-r--r--scene/gui/tab_container.cpp3
-rw-r--r--scene/gui/tab_container.h2
-rw-r--r--scene/gui/tabs.cpp3
-rw-r--r--scene/gui/tabs.h2
-rw-r--r--scene/gui/text_edit.cpp4
-rw-r--r--scene/gui/text_edit.h2
-rw-r--r--scene/gui/tree.cpp4
-rw-r--r--scene/gui/tree.h3
-rw-r--r--scene/main/node.cpp56
-rw-r--r--scene/main/node.h15
-rw-r--r--scene/main/scene_tree.cpp23
-rw-r--r--scene/main/scene_tree.h8
-rw-r--r--scene/main/viewport.cpp59
-rw-r--r--scene/main/viewport.h6
-rw-r--r--scene/main/window.cpp6
-rw-r--r--scene/register_scene_types.cpp1
134 files changed, 355 insertions, 406 deletions
diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp
index 325cdf2127..50b2099236 100644
--- a/core/input/input_event.cpp
+++ b/core/input/input_event.cpp
@@ -31,8 +31,8 @@
#include "input_event.h"
#include "core/input/input_map.h"
+#include "core/input/shortcut.h"
#include "core/os/keyboard.h"
-#include "scene/gui/shortcut.h"
const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
const int InputEvent::DEVICE_ID_INTERNAL = -2;
@@ -1545,6 +1545,13 @@ Ref<Shortcut> InputEventShortcut::get_shortcut() {
return shortcut;
}
+void InputEventShortcut::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_shortcut", "shortcut"), &InputEventShortcut::set_shortcut);
+ ClassDB::bind_method(D_METHOD("get_shortcut"), &InputEventShortcut::get_shortcut);
+
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "Shortcut"), "set_shortcut", "get_shortcut");
+}
+
bool InputEventShortcut::is_pressed() const {
return true;
}
diff --git a/core/input/input_event.h b/core/input/input_event.h
index 517d63eb40..3fc8078a09 100644
--- a/core/input/input_event.h
+++ b/core/input/input_event.h
@@ -548,6 +548,9 @@ class InputEventShortcut : public InputEvent {
Ref<Shortcut> shortcut;
+protected:
+ static void _bind_methods();
+
public:
void set_shortcut(Ref<Shortcut> p_shortcut);
Ref<Shortcut> get_shortcut();
diff --git a/scene/gui/shortcut.cpp b/core/input/shortcut.cpp
index d0cb08724e..d0cb08724e 100644
--- a/scene/gui/shortcut.cpp
+++ b/core/input/shortcut.cpp
diff --git a/scene/gui/shortcut.h b/core/input/shortcut.h
index 249dd1971f..249dd1971f 100644
--- a/scene/gui/shortcut.h
+++ b/core/input/shortcut.h
diff --git a/core/object/class_db.h b/core/object/class_db.h
index 39e523da27..45572517be 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -425,17 +425,6 @@ public:
#endif
-#ifdef TOOLS_ENABLED
-
-#define BIND_VMETHOD(m_method) \
- ::ClassDB::add_virtual_method(get_class_static(), m_method);
-
-#else
-
-#define BIND_VMETHOD(m_method)
-
-#endif
-
#define GDREGISTER_CLASS(m_class) \
if (!GD_IS_DEFINED(ClassDB_Disable_##m_class)) { \
::ClassDB::register_class<m_class>(); \
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index e2a097f883..35f4532abb 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -41,6 +41,7 @@
#include "core/extension/native_extension_manager.h"
#include "core/input/input.h"
#include "core/input/input_map.h"
+#include "core/input/shortcut.h"
#include "core/io/config_file.h"
#include "core/io/dtls_server.h"
#include "core/io/http_client.h"
@@ -145,10 +146,12 @@ void register_core_types() {
GDREGISTER_CLASS(Resource);
GDREGISTER_CLASS(Image);
+ GDREGISTER_CLASS(Shortcut);
GDREGISTER_VIRTUAL_CLASS(InputEvent);
GDREGISTER_VIRTUAL_CLASS(InputEventWithModifiers);
GDREGISTER_VIRTUAL_CLASS(InputEventFromWindow);
GDREGISTER_CLASS(InputEventKey);
+ GDREGISTER_CLASS(InputEventShortcut);
GDREGISTER_VIRTUAL_CLASS(InputEventMouse);
GDREGISTER_CLASS(InputEventMouseButton);
GDREGISTER_CLASS(InputEventMouseMotion);
diff --git a/doc/classes/CollisionObject2D.xml b/doc/classes/CollisionObject2D.xml
index 7129c72e7c..ba1ee3909d 100644
--- a/doc/classes/CollisionObject2D.xml
+++ b/doc/classes/CollisionObject2D.xml
@@ -11,7 +11,7 @@
<methods>
<method name="_input_event" qualifiers="virtual">
<return type="void" />
- <argument index="0" name="viewport" type="Object" />
+ <argument index="0" name="viewport" type="Viewport" />
<argument index="1" name="event" type="InputEvent" />
<argument index="2" name="shape_idx" type="int" />
<description>
diff --git a/doc/classes/CollisionObject3D.xml b/doc/classes/CollisionObject3D.xml
index f9151a2c2f..19bcdcbb27 100644
--- a/doc/classes/CollisionObject3D.xml
+++ b/doc/classes/CollisionObject3D.xml
@@ -11,7 +11,7 @@
<methods>
<method name="_input_event" qualifiers="virtual">
<return type="void" />
- <argument index="0" name="camera" type="Object" />
+ <argument index="0" name="camera" type="Camera3D" />
<argument index="1" name="event" type="InputEvent" />
<argument index="2" name="position" type="Vector3" />
<argument index="3" name="normal" type="Vector3" />
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index a3759a51dd..c870026d58 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -10,7 +10,7 @@
<tutorials>
</tutorials>
<methods>
- <method name="_get_connection_line" qualifiers="virtual">
+ <method name="_get_connection_line" qualifiers="virtual const">
<return type="PackedVector2Array" />
<argument index="0" name="from" type="Vector2" />
<argument index="1" name="to" type="Vector2" />
diff --git a/doc/classes/InputEventShortcut.xml b/doc/classes/InputEventShortcut.xml
new file mode 100644
index 0000000000..35cca02cf7
--- /dev/null
+++ b/doc/classes/InputEventShortcut.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="InputEventShortcut" inherits="InputEvent" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ </methods>
+ <members>
+ <member name="shortcut" type="Shortcut" setter="set_shortcut" getter="get_shortcut">
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 97e6c71ef9..932deb6e88 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -43,14 +43,6 @@
Call [method update_configuration_warnings] when the warnings need to be updated for this node.
</description>
</method>
- <method name="_get_configuration_warnings" qualifiers="virtual">
- <return type="String[]" />
- <description>
- The elements in the array returned from this method are displayed as warnings in the Scene Dock if the script that overrides it is a [code]tool[/code] script.
- Returning an empty array produces no warnings.
- Call [method update_configuration_warnings] when the warnings need to be updated for this node.
- </description>
- </method>
<method name="_input" qualifiers="virtual">
<return type="void" />
<argument index="0" name="event" type="InputEvent" />
@@ -104,9 +96,9 @@
</method>
<method name="_unhandled_key_input" qualifiers="virtual">
<return type="void" />
- <argument index="0" name="event" type="InputEventKey" />
+ <argument index="0" name="event" type="InputEvent" />
<description>
- Called when an [InputEventKey] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it.
+ Called when an [InputEventKey] or [InputEventShortcut] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it.
It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input].
To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first.
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 4a62d3ec7b..2478b71b6a 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -113,26 +113,33 @@
Returns [code]true[/code] if the viewport is currently performing a drag operation.
</description>
</method>
- <method name="input">
+ <method name="is_embedding_subwindows" qualifiers="const">
+ <return type="bool" />
+ <description>
+ </description>
+ </method>
+ <method name="is_input_handled" qualifiers="const">
+ <return type="bool" />
+ <description>
+ </description>
+ </method>
+ <method name="push_input">
<return type="void" />
<argument index="0" name="event" type="InputEvent" />
<argument index="1" name="in_local_coords" type="bool" default="false" />
<description>
</description>
</method>
- <method name="input_text">
+ <method name="push_text_input">
<return type="void" />
<argument index="0" name="text" type="String" />
<description>
</description>
</method>
- <method name="is_embedding_subwindows" qualifiers="const">
- <return type="bool" />
- <description>
- </description>
- </method>
- <method name="is_input_handled" qualifiers="const">
- <return type="bool" />
+ <method name="push_unhandled_input">
+ <return type="void" />
+ <argument index="0" name="event" type="InputEvent" />
+ <argument index="1" name="in_local_coords" type="bool" default="false" />
<description>
</description>
</method>
@@ -150,13 +157,6 @@
Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible.
</description>
</method>
- <method name="unhandled_input">
- <return type="void" />
- <argument index="0" name="event" type="InputEvent" />
- <argument index="1" name="in_local_coords" type="bool" default="false" />
- <description>
- </description>
- </method>
<method name="warp_mouse">
<return type="void" />
<argument index="0" name="to_position" type="Vector2" />
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index ea2ae53e82..bf7d808d50 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -606,7 +606,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int
update();
}
-void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
+void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) {
@@ -1131,8 +1131,6 @@ void AnimationBezierTrackEdit::set_block_animation_update_ptr(bool *p_block_ptr)
}
void AnimationBezierTrackEdit::_bind_methods() {
- ClassDB::bind_method("_gui_input", &AnimationBezierTrackEdit::_gui_input);
-
ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection);
ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim);
ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_select_at_anim);
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
index b082cae3ea..a4a662ebcb 100644
--- a/editor/animation_bezier_editor.h
+++ b/editor/animation_bezier_editor.h
@@ -77,7 +77,7 @@ class AnimationBezierTrackEdit : public Control {
void _zoom_changed();
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _menu_selected(int p_index);
bool *block_animation_update_ptr; //used to block all tracks re-gen (speed up)
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index ff2818f027..324237ff82 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1642,7 +1642,7 @@ void AnimationTimelineEdit::_play_position_draw() {
}
}
-void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
+void AnimationTimelineEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventMouseButton> mb = p_event;
@@ -1754,8 +1754,6 @@ void AnimationTimelineEdit::_track_added(int p_track) {
}
void AnimationTimelineEdit::_bind_methods() {
- ClassDB::bind_method("_gui_input", &AnimationTimelineEdit::_gui_input);
-
ADD_SIGNAL(MethodInfo("zoom_changed"));
ADD_SIGNAL(MethodInfo("name_limit_changed"));
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag")));
@@ -2551,7 +2549,7 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
return Control::get_tooltip(p_pos);
}
-void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
+void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) {
@@ -2965,8 +2963,6 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselect
}
void AnimationTrackEdit::_bind_methods() {
- ClassDB::bind_method("_gui_input", &AnimationTrackEdit::_gui_input);
-
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track")));
ADD_SIGNAL(MethodInfo("dropped", PropertyInfo(Variant::INT, "from_track"), PropertyInfo(Variant::INT, "to_track")));
@@ -5761,7 +5757,7 @@ void AnimationTrackEditor::_pick_track_filter_input(const Ref<InputEvent> &p_ie)
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- pick_track->get_scene_tree()->get_scene_tree()->call("_gui_input", k);
+ pick_track->get_scene_tree()->get_scene_tree()->gui_input(k);
pick_track->get_filter_line_edit()->accept_event();
} break;
default:
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 6d977e5a3f..4da708dd1c 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -89,7 +89,7 @@ class AnimationTimelineEdit : public Range {
float dragging_hsize_from;
float dragging_hsize_at;
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _track_added(int p_track);
protected:
@@ -195,7 +195,7 @@ protected:
static void _bind_methods();
void _notification(int p_what);
- virtual void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
public:
virtual Variant get_drag_data(const Point2 &p_point) override;
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index 0caed1e8e3..4ee8b991e4 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -1035,7 +1035,7 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant
AnimationTrackEdit::drop_data(p_point, p_data);
}
-void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
+void AnimationTrackEditTypeAudio::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event;
@@ -1132,7 +1132,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
return;
}
- AnimationTrackEdit::_gui_input(p_event);
+ AnimationTrackEdit::gui_input(p_event);
}
////////////////////
diff --git a/editor/animation_track_editor_plugins.h b/editor/animation_track_editor_plugins.h
index 66229c3012..a362422c2b 100644
--- a/editor/animation_track_editor_plugins.h
+++ b/editor/animation_track_editor_plugins.h
@@ -124,7 +124,7 @@ protected:
static void _bind_methods();
public:
- virtual void _gui_input(const Ref<InputEvent> &p_event) override;
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
virtual bool can_drop_data(const Point2 &p_point, const Variant &p_data) const override;
virtual void drop_data(const Point2 &p_point, const Variant &p_data) override;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 39095c42a4..89c2e49814 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -114,7 +114,7 @@ void FindReplaceBar::_notification(int p_what) {
}
}
-void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
+void FindReplaceBar::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -611,7 +611,6 @@ void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) {
}
void FindReplaceBar::_bind_methods() {
- ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input);
ClassDB::bind_method("_search_current", &FindReplaceBar::search_current);
ADD_SIGNAL(MethodInfo("search"));
@@ -712,7 +711,7 @@ FindReplaceBar::FindReplaceBar() {
// This function should be used to handle shortcuts that could otherwise
// be handled too late if they weren't handled here.
-void CodeTextEditor::_input(const Ref<InputEvent> &event) {
+void CodeTextEditor::input(const Ref<InputEvent> &event) {
ERR_FAIL_COND(event.is_null());
const Ref<InputEventKey> key_event = event;
@@ -1753,8 +1752,6 @@ void CodeTextEditor::remove_all_bookmarks() {
}
void CodeTextEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input);
-
ADD_SIGNAL(MethodInfo("validate_script"));
ADD_SIGNAL(MethodInfo("load_theme_settings"));
ADD_SIGNAL(MethodInfo("show_errors_panel"));
diff --git a/editor/code_editor.h b/editor/code_editor.h
index ee8f4366dd..dfe6561f13 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -105,7 +105,7 @@ class FindReplaceBar : public HBoxContainer {
protected:
void _notification(int p_what);
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
bool _search(uint32_t p_flags, int p_from_line, int p_from_col);
@@ -173,7 +173,7 @@ class CodeTextEditor : public VBoxContainer {
void _font_resize_timeout();
bool _add_font_size(int p_delta);
- void _input(const Ref<InputEvent> &event);
+ virtual void input(const Ref<InputEvent> &event) override;
void _text_editor_gui_input(const Ref<InputEvent> &p_event);
void _zoom_in();
void _zoom_out();
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index eeab0fc2f5..f0b27702e7 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -356,7 +356,7 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
} break;
default:
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 5209ee06c6..88087664d7 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -530,7 +530,7 @@ void EditorAudioBus::_effect_add(int p_which) {
ur->commit_action();
}
-void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
+void EditorAudioBus::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event;
@@ -744,7 +744,7 @@ void EditorAudioBus::_effect_rmb(const Vector2 &p_pos) {
void EditorAudioBus::_bind_methods() {
ClassDB::bind_method("update_bus", &EditorAudioBus::update_bus);
ClassDB::bind_method("update_send", &EditorAudioBus::update_send);
- ClassDB::bind_method("_gui_input", &EditorAudioBus::_gui_input);
+
ClassDB::bind_method("_get_drag_data_fw", &EditorAudioBus::get_drag_data_fw);
ClassDB::bind_method("_can_drop_data_fw", &EditorAudioBus::can_drop_data_fw);
ClassDB::bind_method("_drop_data_fw", &EditorAudioBus::drop_data_fw);
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 0fbda8ece9..e1aaa060c6 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -90,7 +90,7 @@ class EditorAudioBus : public PanelContainer {
bool is_master;
mutable bool hovering_drop;
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _effects_gui_input(Ref<InputEvent> p_event);
void _bus_popup_pressed(int p_option);
diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp
index cf6ede2277..25250e231e 100644
--- a/editor/editor_command_palette.cpp
+++ b/editor/editor_command_palette.cpp
@@ -149,7 +149,7 @@ void EditorCommandPalette::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
} break;
default:
break;
@@ -226,7 +226,7 @@ void EditorCommandPalette::register_shortcuts_as_command() {
ev.instantiate();
ev->set_shortcut(shortcut);
String shortcut_text = String(shortcut->get_as_text());
- add_command(command_name, *key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::unhandled_input), varray(ev, false), shortcut_text);
+ add_command(command_name, *key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_unhandled_input), varray(ev, false), shortcut_text);
key = unregistered_shortcuts.next(key);
}
unregistered_shortcuts.clear();
@@ -238,7 +238,7 @@ Ref<Shortcut> EditorCommandPalette::add_shortcut_command(const String &p_command
ev.instantiate();
ev->set_shortcut(p_shortcut);
String shortcut_text = String(p_shortcut->get_as_text());
- add_command(p_command, p_key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::unhandled_input), varray(ev, false), shortcut_text);
+ add_command(p_command, p_key, callable_mp(EditorNode::get_singleton()->get_viewport(), &Viewport::push_unhandled_input), varray(ev, false), shortcut_text);
} else {
const String key_name = String(p_key);
const String command_name = String(p_command);
diff --git a/editor/editor_command_palette.h b/editor/editor_command_palette.h
index cfd8b964c8..093f4b797d 100644
--- a/editor/editor_command_palette.h
+++ b/editor/editor_command_palette.h
@@ -31,9 +31,9 @@
#ifndef EDITOR_COMMAND_PALETTE_H
#define EDITOR_COMMAND_PALETTE_H
+#include "core/input/shortcut.h"
#include "core/os/thread_safe.h"
#include "scene/gui/dialogs.h"
-#include "scene/gui/shortcut.h"
#include "scene/gui/tree.h"
class EditorCommandPalette : public ConfirmationDialog {
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 8f94bb296d..1e9d579708 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -124,7 +124,7 @@ void EditorFileDialog::_notification(int p_what) {
}
}
-void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
+void EditorFileDialog::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -1355,8 +1355,6 @@ EditorFileDialog::DisplayMode EditorFileDialog::get_display_mode() const {
}
void EditorFileDialog::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorFileDialog::_unhandled_input);
-
ClassDB::bind_method(D_METHOD("_cancel_pressed"), &EditorFileDialog::_cancel_pressed);
ClassDB::bind_method(D_METHOD("clear_filters"), &EditorFileDialog::clear_filters);
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index d789956a3e..ed427dc76e 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -193,7 +193,7 @@ private:
void _thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata);
void _request_single_thumbnail(const String &p_path);
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
bool _is_open_should_be_disabled();
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index f92b9ac8ba..7df5f15a81 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1825,8 +1825,6 @@ void FindBar::_notification(int p_what) {
}
void FindBar::_bind_methods() {
- ClassDB::bind_method("_unhandled_input", &FindBar::_unhandled_input);
-
ADD_SIGNAL(MethodInfo("search"));
}
@@ -1902,7 +1900,7 @@ void FindBar::_hide_bar() {
hide();
}
-void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) {
+void FindBar::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 69bb72c52d..0b0821a7f4 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -70,7 +70,7 @@ class FindBar : public HBoxContainer {
protected:
void _notification(int p_what);
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
bool _search(bool p_search_previous = false);
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index 2b5eee4c1f..e56b10720d 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -71,7 +71,7 @@ void EditorHelpSearch::_search_box_gui_input(const Ref<InputEvent> &p_event) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- results_tree->call("_gui_input", key);
+ results_tree->gui_input(key);
search_box->accept_event();
} break;
default:
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 8d2edd3000..97cb9b6f85 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -692,7 +692,7 @@ bool EditorProperty::is_selected() const {
return selected;
}
-void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
+void EditorProperty::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (property == StringName()) {
@@ -920,8 +920,6 @@ void EditorProperty::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_edited_property"), &EditorProperty::get_edited_property);
ClassDB::bind_method(D_METHOD("get_edited_object"), &EditorProperty::get_edited_object);
- ClassDB::bind_method(D_METHOD("_gui_input"), &EditorProperty::_gui_input);
-
ClassDB::bind_method(D_METHOD("get_tooltip_text"), &EditorProperty::get_tooltip_text);
ClassDB::bind_method(D_METHOD("update_property"), &EditorProperty::update_property);
@@ -1319,7 +1317,7 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
}
}
-void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
+void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!foldable) {
@@ -1378,7 +1376,6 @@ void EditorInspectorSection::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_vbox"), &EditorInspectorSection::get_vbox);
ClassDB::bind_method(D_METHOD("unfold"), &EditorInspectorSection::unfold);
ClassDB::bind_method(D_METHOD("fold"), &EditorInspectorSection::fold);
- ClassDB::bind_method(D_METHOD("_gui_input"), &EditorInspectorSection::_gui_input);
}
EditorInspectorSection::EditorInspectorSection() {
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 8cb4f1fbef..71e31dd711 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -107,7 +107,7 @@ protected:
void _notification(int p_what);
static void _bind_methods();
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
public:
void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false);
@@ -252,7 +252,7 @@ class EditorInspectorSection : public Container {
protected:
void _notification(int p_what);
static void _bind_methods();
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
public:
virtual Size2 get_minimum_size() const override;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 08585030de..1c2b449449 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -403,7 +403,7 @@ void EditorNode::_update_title() {
DisplayServer::get_singleton()->window_set_title(title);
}
-void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
+void EditorNode::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -5588,7 +5588,6 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("_editor_select", &EditorNode::_editor_select);
ClassDB::bind_method("_node_renamed", &EditorNode::_node_renamed);
ClassDB::bind_method("edit_node", &EditorNode::edit_node);
- ClassDB::bind_method("_unhandled_input", &EditorNode::_unhandled_input);
ClassDB::bind_method(D_METHOD("push_item", "object", "property", "inspector_only"), &EditorNode::push_item, DEFVAL(""), DEFVAL(false));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 911139f470..5ff28f322a 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -530,7 +530,7 @@ private:
bool convert_old;
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
static void _load_error_notify(void *p_ud, const String &p_text);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 99619cfc40..cb7fffe592 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -735,7 +735,7 @@ public:
return String();
}
- void _gui_input(const Ref<InputEvent> &p_ev) {
+ void gui_input(const Ref<InputEvent> &p_ev) override {
const Ref<InputEventMouseMotion> mm = p_ev;
if (mm.is_valid()) {
bool expand_was_hovered = expand_hovered;
@@ -931,7 +931,6 @@ public:
}
static void _bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &EditorPropertyLayersGrid::_gui_input);
ADD_SIGNAL(MethodInfo("flag_changed", PropertyInfo(Variant::INT, "flag")));
}
};
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 6d28b26623..86e15f5ff5 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -31,13 +31,13 @@
#ifndef EDITOR_SETTINGS_H
#define EDITOR_SETTINGS_H
+#include "core/input/shortcut.h"
#include "core/io/config_file.h"
#include "core/io/resource.h"
#include "core/object/class_db.h"
#include "core/os/thread_safe.h"
#include "core/string/translation.h"
#include "editor/editor_paths.h"
-#include "scene/gui/shortcut.h"
class EditorPlugin;
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 91f00deeaa..3f65b101f7 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -52,7 +52,7 @@ String EditorSpinSlider::get_text_value() const {
return TS->format_number(String::num(get_value(), Math::range_step_decimals(get_step())));
}
-void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
+void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (read_only) {
@@ -564,8 +564,6 @@ void EditorSpinSlider::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_flat", "flat"), &EditorSpinSlider::set_flat);
ClassDB::bind_method(D_METHOD("is_flat"), &EditorSpinSlider::is_flat);
- ClassDB::bind_method(D_METHOD("_gui_input"), &EditorSpinSlider::_gui_input);
-
ADD_PROPERTY(PropertyInfo(Variant::STRING, "label"), "set_label", "get_label");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "suffix"), "set_suffix", "get_suffix");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "read_only"), "set_read_only", "is_read_only");
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index c09d084e88..1bf8e8eef9 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -85,7 +85,7 @@ class EditorSpinSlider : public Range {
protected:
void _notification(int p_what);
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods();
void _grabber_mouse_entered();
void _grabber_mouse_exited();
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index b4e9f468de..6612e4ac91 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1220,7 +1220,7 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
}
}
-void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
+void AnimationPlayerEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev;
@@ -1497,7 +1497,6 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed);
ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed);
ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate);
- ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &AnimationPlayerEditor::_unhandled_key_input);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_1"), &AnimationPlayerEditor::_prepare_onion_layers_1);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2);
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 5c2348f86b..ddc167d9b2 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -200,7 +200,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_key_editor_seek(float p_pos, bool p_drag, bool p_timeline_only = false);
void _animation_key_editor_anim_len_changed(float p_len);
- void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_ev) override;
void _animation_tool_menu(int p_option);
void _onion_skinning_menu(int p_option);
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 785bab42cf..5405723d10 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -614,7 +614,7 @@ void EditorAssetLibrary::_update_repository_options() {
}
}
-void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) {
+void EditorAssetLibrary::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventKey> key = p_event;
@@ -1322,8 +1322,6 @@ void EditorAssetLibrary::disable_community_support() {
}
void EditorAssetLibrary::_bind_methods() {
- ClassDB::bind_method("_unhandled_key_input", &EditorAssetLibrary::_unhandled_key_input);
-
ADD_SIGNAL(MethodInfo("install_asset", PropertyInfo(Variant::STRING, "zip_path"), PropertyInfo(Variant::STRING, "name")));
}
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index c6ca1ecd4f..286546f962 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -299,7 +299,7 @@ class EditorAssetLibrary : public PanelContainer {
protected:
static void _bind_methods();
void _notification(int p_what);
- void _unhandled_key_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
public:
void disable_community_support();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 477e066e87..506e5dbc38 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -472,7 +472,7 @@ real_t CanvasItemEditor::snap_angle(real_t p_target, real_t p_start) const {
}
}
-void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
+void CanvasItemEditor::unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev;
@@ -4918,7 +4918,7 @@ void CanvasItemEditor::_focus_selection(int p_op) {
void CanvasItemEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_update_override_camera_button", "game_running"), &CanvasItemEditor::_update_override_camera_button);
ClassDB::bind_method("_get_editor_data", &CanvasItemEditor::_get_editor_data);
- ClassDB::bind_method("_unhandled_key_input", &CanvasItemEditor::_unhandled_key_input);
+
ClassDB::bind_method(D_METHOD("set_state"), &CanvasItemEditor::set_state);
ClassDB::bind_method(D_METHOD("update_viewport"), &CanvasItemEditor::update_viewport);
ClassDB::bind_method(D_METHOD("_zoom_on_position"), &CanvasItemEditor::_zoom_on_position);
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index bff580315e..1965efbf30 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -455,7 +455,7 @@ private:
void _keying_changed();
- void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_ev) override;
void _draw_text_at_position(Point2 p_position, String p_string, Side p_side);
void _draw_margin_at_position(int p_value, Point2 p_position, Side p_side);
diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp
index 07ff0eb346..4a22dc5b62 100644
--- a/editor/plugins/curve_editor_plugin.cpp
+++ b/editor/plugins/curve_editor_plugin.cpp
@@ -101,7 +101,7 @@ void CurveEditor::_notification(int p_what) {
}
}
-void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
+void CurveEditor::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb_ref = p_event;
if (mb_ref.is_valid()) {
const InputEventMouseButton &mb = **mb_ref;
@@ -757,10 +757,6 @@ void CurveEditor::_draw() {
}
}
-void CurveEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &CurveEditor::on_gui_input);
-}
-
//---------------
bool EditorInspectorPluginCurve::can_handle(Object *p_object) {
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index 2e8dd43d7e..c351f6ebe9 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -74,10 +74,8 @@ public:
protected:
void _notification(int p_what);
- static void _bind_methods();
-
private:
- void on_gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void on_preset_item_selected(int preset_id);
void _curve_changed();
void on_context_menu_item_selected(int action_id);
diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp
index 39ab3215ff..768f29e15a 100644
--- a/editor/plugins/mesh_editor_plugin.cpp
+++ b/editor/plugins/mesh_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "editor/editor_scale.h"
-void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
+void MeshEditor::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event;
@@ -103,10 +103,6 @@ void MeshEditor::_button_pressed(Node *p_button) {
}
}
-void MeshEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &MeshEditor::_gui_input);
-}
-
MeshEditor::MeshEditor() {
viewport = memnew(SubViewport);
Ref<World3D> world_3d;
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 455fcb5fe9..1e88b70202 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -64,8 +64,7 @@ class MeshEditor : public SubViewportContainer {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
- static void _bind_methods();
+ void gui_input(const Ref<InputEvent> &p_event) override;
public:
void edit(Ref<Mesh> p_mesh);
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 4300a56ef0..d3821f2f81 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -181,7 +181,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
r_axis.sort_custom<Axis2DCompare>();
}
-void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) {
+void ViewportRotationControl::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventMouseButton> mb = p_event;
@@ -252,10 +252,6 @@ void ViewportRotationControl::set_viewport(Node3DEditorViewport *p_viewport) {
viewport = p_viewport;
}
-void ViewportRotationControl::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &ViewportRotationControl::_gui_input);
-}
-
void Node3DEditorViewport::_update_camera(real_t p_interp_delta) {
bool is_orthogonal = camera->get_projection() == Camera3D::PROJECTION_ORTHOGONAL;
@@ -4428,7 +4424,7 @@ Node3DEditorViewport::~Node3DEditorViewport() {
//////////////////////////////////////////////////////////////
-void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) {
+void Node3DEditorViewportContainer::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event;
@@ -4720,10 +4716,6 @@ Node3DEditorViewportContainer::View Node3DEditorViewportContainer::get_view() {
return view;
}
-void Node3DEditorViewportContainer::_bind_methods() {
- ClassDB::bind_method("_gui_input", &Node3DEditorViewportContainer::_gui_input);
-}
-
Node3DEditorViewportContainer::Node3DEditorViewportContainer() {
set_clip_contents(true);
view = VIEW_USE_1_VIEWPORT;
@@ -6512,7 +6504,7 @@ void Node3DEditor::snap_selected_nodes_to_floor() {
}
}
-void Node3DEditor::_unhandled_key_input(Ref<InputEvent> p_event) {
+void Node3DEditor::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_visible_in_tree()) {
@@ -6890,7 +6882,6 @@ void Node3DEditor::_register_all_gizmos() {
}
void Node3DEditor::_bind_methods() {
- ClassDB::bind_method("_unhandled_key_input", &Node3DEditor::_unhandled_key_input);
ClassDB::bind_method("_get_editor_data", &Node3DEditor::_get_editor_data);
ClassDB::bind_method("_request_gizmo", &Node3DEditor::_request_gizmo);
ClassDB::bind_method("_clear_subgizmo_selection", &Node3DEditor::_clear_subgizmo_selection);
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index 868b834993..59f3ec6fcd 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -74,9 +74,8 @@ class ViewportRotationControl : public Control {
const float AXIS_CIRCLE_RADIUS = 8.0f * EDSCALE;
protected:
- static void _bind_methods();
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _draw();
void _draw_axis(const Axis2D &p_axis);
void _get_sorted_axis(Vector<Axis2D> &r_axis);
@@ -470,11 +469,10 @@ private:
Vector2 drag_begin_pos;
Vector2 drag_begin_ratio;
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
protected:
void _notification(int p_what);
- static void _bind_methods();
public:
void set_view(View p_view);
@@ -744,7 +742,7 @@ private:
protected:
void _notification(int p_what);
//void _gui_input(InputEvent p_event);
- void _unhandled_key_input(Ref<InputEvent> p_event);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods();
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index cbea2405b8..eae6916a92 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -35,9 +35,6 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
-}
-
void ResourcePreloaderEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
load->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
@@ -335,7 +332,6 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant
}
void ResourcePreloaderEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &ResourcePreloaderEditor::_gui_input);
ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library);
ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource);
diff --git a/editor/plugins/resource_preloader_editor_plugin.h b/editor/plugins/resource_preloader_editor_plugin.h
index bc10b48a16..04ab458eb5 100644
--- a/editor/plugins/resource_preloader_editor_plugin.h
+++ b/editor/plugins/resource_preloader_editor_plugin.h
@@ -75,7 +75,7 @@ class ResourcePreloaderEditor : public PanelContainer {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
+
static void _bind_methods();
public:
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 567cd33305..3d2b3f4478 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -316,7 +316,7 @@ void ScriptEditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
k->get_keycode() == KEY_DOWN ||
k->get_keycode() == KEY_PAGEUP ||
k->get_keycode() == KEY_PAGEDOWN)) {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
}
}
@@ -2728,7 +2728,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
}
}
-void ScriptEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) {
+void ScriptEditor::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) {
@@ -3272,7 +3272,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections);
ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
- ClassDB::bind_method("_unhandled_key_input", &ScriptEditor::_unhandled_key_input);
+
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index a1474c5f66..a57aeea5c0 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -411,7 +411,7 @@ class ScriptEditor : public PanelContainer {
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
- void _unhandled_key_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
void _script_list_gui_input(const Ref<InputEvent> &ev);
void _make_script_list_context_menu();
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp
index 2883dbbc81..400f9f560f 100644
--- a/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -40,7 +40,7 @@
#include "scene/gui/margin_container.h"
#include "scene/gui/panel_container.h"
-void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
+void SpriteFramesEditor::gui_input(const Ref<InputEvent> &p_event) {
}
void SpriteFramesEditor::_open_sprite_sheet() {
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index e6c59e3533..17e30f0cab 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -147,7 +147,7 @@ class SpriteFramesEditor : public HSplitContainer {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods();
public:
diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp
index 3987cdd6a0..3bdf97647a 100644
--- a/editor/plugins/texture_3d_editor_plugin.cpp
+++ b/editor/plugins/texture_3d_editor_plugin.cpp
@@ -34,9 +34,6 @@
#include "core/io/resource_loader.h"
#include "editor/editor_settings.h"
-void Texture3DEditor::_gui_input(Ref<InputEvent> p_event) {
-}
-
void Texture3DEditor::_texture_rect_draw() {
texture_rect->draw_rect(Rect2(Point2(), texture_rect->get_size()), Color(1, 1, 1, 1));
}
@@ -145,7 +142,6 @@ void Texture3DEditor::edit(Ref<Texture3D> p_texture) {
}
void Texture3DEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &Texture3DEditor::_gui_input);
ClassDB::bind_method(D_METHOD("_layer_changed"), &Texture3DEditor::_layer_changed);
}
diff --git a/editor/plugins/texture_3d_editor_plugin.h b/editor/plugins/texture_3d_editor_plugin.h
index 9d90d3653f..855194e644 100644
--- a/editor/plugins/texture_3d_editor_plugin.h
+++ b/editor/plugins/texture_3d_editor_plugin.h
@@ -65,7 +65,6 @@ class Texture3DEditor : public Control {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
static void _bind_methods();
diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp
index 80359452ac..4180eb73d9 100644
--- a/editor/plugins/texture_layered_editor_plugin.cpp
+++ b/editor/plugins/texture_layered_editor_plugin.cpp
@@ -34,7 +34,7 @@
#include "core/io/resource_loader.h"
#include "editor/editor_settings.h"
-void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) {
+void TextureLayeredEditor::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event;
@@ -214,7 +214,6 @@ void TextureLayeredEditor::edit(Ref<TextureLayered> p_texture) {
}
void TextureLayeredEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &TextureLayeredEditor::_gui_input);
ClassDB::bind_method(D_METHOD("_layer_changed"), &TextureLayeredEditor::_layer_changed);
}
diff --git a/editor/plugins/texture_layered_editor_plugin.h b/editor/plugins/texture_layered_editor_plugin.h
index c4ced62fb9..a7fe4b94e9 100644
--- a/editor/plugins/texture_layered_editor_plugin.h
+++ b/editor/plugins/texture_layered_editor_plugin.h
@@ -67,7 +67,7 @@ class TextureLayeredEditor : public Control {
protected:
void _notification(int p_what);
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods();
public:
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp
index 13f04cb804..0add83f64d 100644
--- a/editor/plugins/tiles/tile_atlas_view.cpp
+++ b/editor/plugins/tiles/tile_atlas_view.cpp
@@ -41,7 +41,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
-void TileAtlasView::_gui_input(const Ref<InputEvent> &p_event) {
+void TileAtlasView::gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
drag_type = DRAG_TYPE_NONE;
@@ -548,8 +548,6 @@ void TileAtlasView::_notification(int p_what) {
}
void TileAtlasView::_bind_methods() {
- ClassDB::bind_method("_gui_input", &TileAtlasView::_gui_input);
-
ADD_SIGNAL(MethodInfo("transform_changed", PropertyInfo(Variant::FLOAT, "zoom"), PropertyInfo(Variant::VECTOR2, "scroll")));
}
@@ -582,7 +580,7 @@ TileAtlasView::TileAtlasView() {
center_container = memnew(CenterContainer);
center_container->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
center_container->set_anchors_preset(Control::PRESET_CENTER);
- center_container->connect("gui_input", callable_mp(this, &TileAtlasView::_gui_input));
+ center_container->connect("gui_input", callable_mp(this, &TileAtlasView::gui_input));
panel->add_child(center_container);
missing_source_label = memnew(Label);
diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h
index b2046f4322..5b0df366ae 100644
--- a/editor/plugins/tiles/tile_atlas_view.h
+++ b/editor/plugins/tiles/tile_atlas_view.h
@@ -62,7 +62,7 @@ private:
void _update_zoom_and_panning(bool p_zoom_on_mouse_pos = false);
void _zoom_widget_changed();
void _center_view();
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
Map<Vector2, Map<int, Rect2i>> alternative_tiles_rect_cache;
void _update_alternative_tiles_rect_cache();
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 4ed9f712c1..5b1da11f12 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -3171,7 +3171,7 @@ void VisualShaderEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
ie->get_keycode() == KEY_DOWN ||
ie->get_keycode() == KEY_ENTER ||
ie->get_keycode() == KEY_KP_ENTER)) {
- members->call("_gui_input", ie);
+ members->gui_input(ie);
node_filter->accept_event();
}
}
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 8d425a1e51..05cf3791f4 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1887,7 +1887,7 @@ void ProjectManager::_update_project_buttons() {
erase_missing_btn->set_disabled(!_project_list->is_any_project_missing());
}
-void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
+void ProjectManager::unhandled_key_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventKey> k = p_ev;
@@ -2364,7 +2364,6 @@ void ProjectManager::_on_search_term_changed(const String &p_term) {
}
void ProjectManager::_bind_methods() {
- ClassDB::bind_method("_unhandled_key_input", &ProjectManager::_unhandled_key_input);
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
ClassDB::bind_method("_version_button_pressed", &ProjectManager::_version_button_pressed);
}
diff --git a/editor/project_manager.h b/editor/project_manager.h
index 0fc69bd313..f45d34d461 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -121,7 +121,7 @@ class ProjectManager : public Control {
void _install_project(const String &p_zip_path, const String &p_title);
void _dim_window();
- void _unhandled_key_input(const Ref<InputEvent> &p_ev);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_ev) override;
void _files_dropped(PackedStringArray p_files, int p_screen);
void _version_button_pressed();
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index 1272d064a0..f167ded4e7 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -48,7 +48,7 @@ void PropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
TreeItem *root = search_options->get_root();
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index f8af3e8f36..f835245328 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -170,7 +170,7 @@ void EditorQuickOpen::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
if (allow_multi_select) {
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 0b228c2695..2ec4a088a2 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -62,7 +62,7 @@ void SceneTreeDock::_quick_open() {
instantiate_scenes(quick_open->get_selected_files(), scene_tree->get_selected());
}
-void SceneTreeDock::_input(Ref<InputEvent> p_event) {
+void SceneTreeDock::input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event;
@@ -72,7 +72,7 @@ void SceneTreeDock::_input(Ref<InputEvent> p_event) {
}
}
-void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) {
+void SceneTreeDock::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (get_focus_owner() && get_focus_owner()->is_text_field()) {
@@ -3163,8 +3163,7 @@ void SceneTreeDock::_create_remap_for_resource(RES p_resource, Map<RES, RES> &r_
void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_owners"), &SceneTreeDock::_set_owners);
- ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &SceneTreeDock::_unhandled_key_input);
- ClassDB::bind_method(D_METHOD("_input"), &SceneTreeDock::_input);
+
ClassDB::bind_method(D_METHOD("_update_script_button"), &SceneTreeDock::_update_script_button);
ClassDB::bind_method(D_METHOD("instantiate"), &SceneTreeDock::instantiate);
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index ccdc0a3786..387a35acbb 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -210,8 +210,8 @@ class SceneTreeDock : public VBoxContainer {
void _node_prerenamed(Node *p_node, const String &p_new_name);
void _nodes_drag_begin();
- void _input(Ref<InputEvent> p_event);
- void _unhandled_key_input(Ref<InputEvent> p_event);
+ virtual void input(const Ref<InputEvent> &p_event) override;
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
void _import_subscene();
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 71802d1737..649caf5373 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -138,7 +138,7 @@ void EditorSettingsDialog::_notification(int p_what) {
}
}
-void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
+void EditorSettingsDialog::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
const Ref<InputEventKey> k = p_event;
@@ -542,7 +542,6 @@ void EditorSettingsDialog::_editor_restart_close() {
}
void EditorSettingsDialog::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_unhandled_input"), &EditorSettingsDialog::_unhandled_input);
ClassDB::bind_method(D_METHOD("_update_shortcuts"), &EditorSettingsDialog::_update_shortcuts);
ClassDB::bind_method(D_METHOD("_settings_changed"), &EditorSettingsDialog::_settings_changed);
}
diff --git a/editor/settings_config_dialog.h b/editor/settings_config_dialog.h
index c38fceedf1..2b6c9b3e1d 100644
--- a/editor/settings_config_dialog.h
+++ b/editor/settings_config_dialog.h
@@ -83,7 +83,7 @@ class EditorSettingsDialog : public AcceptDialog {
void _settings_property_edited(const String &p_name);
void _settings_save();
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
void _update_icons();
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index f101c43e89..2331a12d0f 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -790,7 +790,7 @@ void GridMapEditor::_sbox_input(const Ref<InputEvent> &p_ie) {
if (k.is_valid() && (k->get_keycode() == KEY_UP || k->get_keycode() == KEY_DOWN || k->get_keycode() == KEY_PAGEUP || k->get_keycode() == KEY_PAGEDOWN)) {
// Forward the key input to the ItemList so it can be scrolled
- mesh_library_palette->call("_gui_input", k);
+ mesh_library_palette->gui_input(k);
search_box->accept_event();
}
}
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 86793af77f..142419f90a 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1845,26 +1845,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
max_input_args = 0;
max_output_args = 0;
- if (Object::cast_to<Node>(p_owner)) {
- // Turn on these if they exist and base is a node.
- Node *node = Object::cast_to<Node>(p_owner);
- if (p_script->functions.has("_process")) {
- node->set_process(true);
- }
- if (p_script->functions.has("_physics_process")) {
- node->set_physics_process(true);
- }
- if (p_script->functions.has("_input")) {
- node->set_process_input(true);
- }
- if (p_script->functions.has("_unhandled_input")) {
- node->set_process_unhandled_input(true);
- }
- if (p_script->functions.has("_unhandled_key_input")) {
- node->set_process_unhandled_key_input(true);
- }
- }
-
// Setup variables.
{
List<StringName> keys;
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 9d813e3d77..ded716cf18 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -1816,7 +1816,7 @@ void VisualScriptEditor::_generic_search(String p_base_type, Vector2 pos, bool n
}
}
-void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
+void VisualScriptEditor::input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
// GUI input for VS Editor Plugin
@@ -4246,8 +4246,6 @@ void VisualScriptEditor::_bind_methods() {
ClassDB::bind_method("_can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw);
ClassDB::bind_method("_drop_data_fw", &VisualScriptEditor::drop_data_fw);
- ClassDB::bind_method("_input", &VisualScriptEditor::_input);
-
ClassDB::bind_method("_update_graph_connections", &VisualScriptEditor::_update_graph_connections);
ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members);
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 0c4ea880c8..4fa8ffca67 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -234,7 +234,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _generic_search(String p_base_type = "", Vector2 pos = Vector2(), bool node_centered = false);
- void _input(const Ref<InputEvent> &p_event);
+ virtual void input(const Ref<InputEvent> &p_event) override;
void _graph_gui_input(const Ref<InputEvent> &p_event);
void _members_gui_input(const Ref<InputEvent> &p_event);
void _fn_name_box_input(const Ref<InputEvent> &p_event);
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index bacb1947be..d8b88d6cd3 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -55,7 +55,7 @@ void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN:
case KEY_PAGEUP:
case KEY_PAGEDOWN: {
- search_options->call("_gui_input", k);
+ search_options->gui_input(k);
search_box->accept_event();
TreeItem *root = search_options->get_root();
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp
index 60f29ca163..5d3a538f60 100644
--- a/scene/2d/collision_object_2d.cpp
+++ b/scene/2d/collision_object_2d.cpp
@@ -481,10 +481,8 @@ bool CollisionObject2D::is_pickable() const {
return pickable;
}
-void CollisionObject2D::_input_event(Node *p_viewport, const Ref<InputEvent> &p_input_event, int p_shape) {
- if (get_script_instance()) {
- get_script_instance()->call(SceneStringNames::get_singleton()->_input_event, p_viewport, p_input_event, p_shape);
- }
+void CollisionObject2D::_input_event_call(Viewport *p_viewport, const Ref<InputEvent> &p_input_event, int p_shape) {
+ GDVIRTUAL_CALL(_input_event, p_viewport, p_input_event, p_shape);
emit_signal(SceneStringNames::get_singleton()->input_event, p_viewport, p_input_event, p_shape);
}
@@ -597,7 +595,7 @@ void CollisionObject2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("shape_owner_clear_shapes", "owner_id"), &CollisionObject2D::shape_owner_clear_shapes);
ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject2D::shape_find_owner);
- BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "viewport"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx")));
+ GDVIRTUAL_BIND(_input_event, "viewport", "event", "shape_idx");
ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index 11e11d1382..19abacb201 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -32,6 +32,7 @@
#define COLLISION_OBJECT_2D_H
#include "scene/2d/node_2d.h"
+#include "scene/main/viewport.h"
#include "scene/resources/shape_2d.h"
#include "servers/physics_server_2d.h"
@@ -88,7 +89,7 @@ protected:
void _update_pickable();
friend class Viewport;
- void _input_event(Node *p_viewport, const Ref<InputEvent> &p_input_event, int p_shape);
+ void _input_event_call(Viewport *p_viewport, const Ref<InputEvent> &p_input_event, int p_shape);
void _mouse_enter();
void _mouse_exit();
@@ -100,6 +101,7 @@ protected:
void set_body_mode(PhysicsServer2D::BodyMode p_mode);
+ GDVIRTUAL3(_input_event, Viewport *, Ref<InputEvent>, int)
public:
void set_collision_layer(uint32_t p_layer);
uint32_t get_collision_layer() const;
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp
index 00e4e1dc62..8bd7b696f2 100644
--- a/scene/2d/touch_screen_button.cpp
+++ b/scene/2d/touch_screen_button.cpp
@@ -185,7 +185,7 @@ String TouchScreenButton::get_action() const {
return action;
}
-void TouchScreenButton::_input(const Ref<InputEvent> &p_event) {
+void TouchScreenButton::input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!get_tree()) {
@@ -288,7 +288,7 @@ void TouchScreenButton::_press(int p_finger_pressed) {
iea.instantiate();
iea->set_action(action);
iea->set_pressed(true);
- get_viewport()->input(iea, true);
+ get_viewport()->push_input(iea, true);
}
emit_signal(SNAME("pressed"));
@@ -305,7 +305,7 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
iea.instantiate();
iea->set_action(action);
iea->set_pressed(false);
- get_viewport()->input(iea, true);
+ get_viewport()->push_input(iea, true);
}
}
@@ -384,8 +384,6 @@ void TouchScreenButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_pressed"), &TouchScreenButton::is_pressed);
- ClassDB::bind_method(D_METHOD("_input"), &TouchScreenButton::_input);
-
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "normal", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture", "get_texture");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "pressed", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_texture_pressed", "get_texture_pressed");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "bitmask", PROPERTY_HINT_RESOURCE_TYPE, "BitMap"), "set_bitmask", "get_bitmask");
diff --git a/scene/2d/touch_screen_button.h b/scene/2d/touch_screen_button.h
index 10820ad059..1c515149d4 100644
--- a/scene/2d/touch_screen_button.h
+++ b/scene/2d/touch_screen_button.h
@@ -61,7 +61,7 @@ private:
VisibilityMode visibility = VISIBILITY_ALWAYS;
- void _input(const Ref<InputEvent> &p_event);
+ virtual void input(const Ref<InputEvent> &p_event) override;
bool _is_point_inside(const Point2 &p_point);
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 36d9bfba82..e2f953974a 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -254,10 +254,8 @@ void CollisionObject3D::_apply_enabled() {
}
}
-void CollisionObject3D::_input_event(Node *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) {
- if (get_script_instance()) {
- get_script_instance()->call(SceneStringNames::get_singleton()->_input_event, p_camera, p_input_event, p_pos, p_normal, p_shape);
- }
+void CollisionObject3D::_input_event_call(Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) {
+ GDVIRTUAL_CALL(_input_event, p_camera, p_input_event, p_pos, p_normal, p_shape);
emit_signal(SceneStringNames::get_singleton()->input_event, p_camera, p_input_event, p_pos, p_normal, p_shape);
}
@@ -453,7 +451,7 @@ void CollisionObject3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("shape_owner_clear_shapes", "owner_id"), &CollisionObject3D::shape_owner_clear_shapes);
ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject3D::shape_find_owner);
- BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "position"), PropertyInfo(Variant::VECTOR3, "normal"), PropertyInfo(Variant::INT, "shape_idx")));
+ GDVIRTUAL_BIND(_input_event, "camera", "event", "position", "normal", "shape_idx");
ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "position"), PropertyInfo(Variant::VECTOR3, "normal"), PropertyInfo(Variant::INT, "shape_idx")));
ADD_SIGNAL(MethodInfo("mouse_entered"));
diff --git a/scene/3d/collision_object_3d.h b/scene/3d/collision_object_3d.h
index c066960eb4..1c7e205888 100644
--- a/scene/3d/collision_object_3d.h
+++ b/scene/3d/collision_object_3d.h
@@ -31,6 +31,7 @@
#ifndef COLLISION_OBJECT_3D_H
#define COLLISION_OBJECT_3D_H
+#include "scene/3d/camera_3d.h"
#include "scene/3d/node_3d.h"
class CollisionObject3D : public Node3D {
@@ -101,7 +102,7 @@ protected:
void _on_transform_changed();
friend class Viewport;
- virtual void _input_event(Node *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape);
+ virtual void _input_event_call(Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape);
virtual void _mouse_enter();
virtual void _mouse_exit();
@@ -110,6 +111,7 @@ protected:
void set_only_update_transform_changes(bool p_enable);
bool is_only_update_transform_changes_enabled() const;
+ GDVIRTUAL5(_input_event, Camera3D *, Ref<InputEvent>, Vector3, Vector3, int)
public:
void set_collision_layer(uint32_t p_layer);
uint32_t get_collision_layer() const;
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 03c75b25f4..bef1011364 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -52,7 +52,7 @@ void BaseButton::_unpress_group() {
}
}
-void BaseButton::_gui_input(Ref<InputEvent> p_event) {
+void BaseButton::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (status.disabled) { // no interaction with disabled button
@@ -338,7 +338,7 @@ Ref<Shortcut> BaseButton::get_shortcut() const {
return shortcut;
}
-void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) {
+void BaseButton::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!_is_focus_owner_in_shorcut_context()) {
@@ -407,8 +407,6 @@ bool BaseButton::_is_focus_owner_in_shorcut_context() const {
}
void BaseButton::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &BaseButton::_gui_input);
- ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &BaseButton::_unhandled_key_input);
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &BaseButton::set_pressed);
ClassDB::bind_method(D_METHOD("is_pressed"), &BaseButton::is_pressed);
ClassDB::bind_method(D_METHOD("set_pressed_no_signal", "pressed"), &BaseButton::set_pressed_no_signal);
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index cf1904344b..cd6e78464f 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -75,8 +75,8 @@ protected:
virtual void pressed();
virtual void toggled(bool p_pressed);
static void _bind_methods();
- virtual void _gui_input(Ref<InputEvent> p_event);
- virtual void _unhandled_key_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
bool _is_focus_owner_in_shorcut_context() const;
diff --git a/scene/gui/code_edit.cpp b/scene/gui/code_edit.cpp
index 7cc2352353..27cac73aef 100644
--- a/scene/gui/code_edit.cpp
+++ b/scene/gui/code_edit.cpp
@@ -248,7 +248,7 @@ void CodeEdit::_notification(int p_what) {
}
}
-void CodeEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
+void CodeEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
Ref<InputEventMouseButton> mb = p_gui_input;
if (mb.is_valid()) {
@@ -354,7 +354,7 @@ void CodeEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
Ref<InputEventKey> k = p_gui_input;
bool update_code_completion = false;
if (!k.is_valid()) {
- TextEdit::_gui_input(p_gui_input);
+ TextEdit::gui_input(p_gui_input);
return;
}
@@ -519,7 +519,7 @@ void CodeEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
set_code_hint("");
}
- TextEdit::_gui_input(p_gui_input);
+ TextEdit::gui_input(p_gui_input);
if (update_code_completion) {
_filter_code_completion_candidates_impl();
diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h
index aa62cbdf3c..4fbb5194e6 100644
--- a/scene/gui/code_edit.h
+++ b/scene/gui/code_edit.h
@@ -248,7 +248,7 @@ private:
void _text_changed();
protected:
- void _gui_input(const Ref<InputEvent> &p_gui_input) override;
+ void gui_input(const Ref<InputEvent> &p_gui_input) override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 6dba23d3c7..4ac6a58d36 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -780,6 +780,20 @@ void Control::set_drag_preview(Control *p_control) {
get_viewport()->_gui_set_drag_preview(this, p_control);
}
+void Control::_call_gui_input(const Ref<InputEvent> &p_event) {
+ emit_signal(SceneStringNames::get_singleton()->gui_input, p_event); //signal should be first, so it's possible to override an event (and then accept it)
+ if (!is_inside_tree() || get_viewport()->is_input_handled()) {
+ return; //input was handled, abort
+ }
+ GDVIRTUAL_CALL(_gui_input, p_event);
+ if (!is_inside_tree() || get_viewport()->is_input_handled()) {
+ return; //input was handled, abort
+ }
+ gui_input(p_event);
+}
+void Control::gui_input(const Ref<InputEvent> &p_event) {
+}
+
Size2 Control::get_minimum_size() const {
Vector2 ms;
if (GDVIRTUAL_CALL(_get_minimum_size, ms)) {
@@ -2798,8 +2812,6 @@ void Control::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_auto_translate", "enable"), &Control::set_auto_translate);
ClassDB::bind_method(D_METHOD("is_auto_translating"), &Control::is_auto_translating);
- BIND_VMETHOD(MethodInfo("_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
-
ADD_GROUP("Anchor", "anchor_");
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_left", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_LEFT);
ADD_PROPERTYI(PropertyInfo(Variant::FLOAT, "anchor_top", PROPERTY_HINT_RANGE, "0,1,0.001,or_lesser,or_greater"), "_set_anchor", "get_anchor", SIDE_TOP);
@@ -2960,8 +2972,10 @@ void Control::_bind_methods() {
GDVIRTUAL_BIND(_structured_text_parser, "args", "text");
GDVIRTUAL_BIND(_get_minimum_size);
- GDVIRTUAL_BIND(_get_drag_data, "at_position")
- GDVIRTUAL_BIND(_can_drop_data, "at_position", "data")
- GDVIRTUAL_BIND(_drop_data, "at_position", "data")
- GDVIRTUAL_BIND(_make_custom_tooltip, "for_text")
+ GDVIRTUAL_BIND(_get_drag_data, "at_position");
+ GDVIRTUAL_BIND(_can_drop_data, "at_position", "data");
+ GDVIRTUAL_BIND(_drop_data, "at_position", "data");
+ GDVIRTUAL_BIND(_make_custom_tooltip, "for_text");
+
+ GDVIRTUAL_BIND(_gui_input, "event");
}
diff --git a/scene/gui/control.h b/scene/gui/control.h
index 0d7a3b8de0..0faa617f8d 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -31,10 +31,10 @@
#ifndef CONTROL_H
#define CONTROL_H
+#include "core/input/shortcut.h"
#include "core/math/transform_2d.h"
#include "core/object/gdvirtual.gen.inc"
#include "core/templates/rid.h"
-#include "scene/gui/shortcut.h"
#include "scene/main/canvas_item.h"
#include "scene/main/node.h"
#include "scene/main/timer.h"
@@ -263,6 +263,8 @@ private:
friend class Viewport;
+ void _call_gui_input(const Ref<InputEvent> &p_event);
+
void _update_minimum_size_cache();
friend class Window;
static void _propagate_theme_changed(Node *p_at, Control *p_owner, Window *p_owner_window, bool p_assign = true);
@@ -272,17 +274,6 @@ private:
static bool has_theme_item_in_types(Control *p_theme_owner, Window *p_theme_owner_window, Theme::DataType p_data_type, const StringName &p_name, List<StringName> p_theme_types);
_FORCE_INLINE_ void _get_theme_type_dependencies(const StringName &p_theme_type, List<StringName> *p_list) const;
- GDVIRTUAL1RC(bool, _has_point, Vector2)
- GDVIRTUAL2RC(Array, _structured_text_parser, Array, String)
- GDVIRTUAL0RC(Vector2, _get_minimum_size)
-
- GDVIRTUAL1RC(Variant, _get_drag_data, Vector2)
- GDVIRTUAL2RC(bool, _can_drop_data, Vector2, Variant)
- GDVIRTUAL2(_drop_data, Vector2, Variant)
- GDVIRTUAL1RC(Object *, _make_custom_tooltip, String)
-
- //GDVIRTUAL1(_gui_input, Ref<InputEvent>)
-
protected:
virtual void add_child_notify(Node *p_child) override;
virtual void remove_child_notify(Node *p_child) override;
@@ -301,6 +292,17 @@ protected:
//bind helpers
+ GDVIRTUAL1RC(bool, _has_point, Vector2)
+ GDVIRTUAL2RC(Array, _structured_text_parser, Array, String)
+ GDVIRTUAL0RC(Vector2, _get_minimum_size)
+
+ GDVIRTUAL1RC(Variant, _get_drag_data, Vector2)
+ GDVIRTUAL2RC(bool, _can_drop_data, Vector2, Variant)
+ GDVIRTUAL2(_drop_data, Vector2, Variant)
+ GDVIRTUAL1RC(Object *, _make_custom_tooltip, String)
+
+ GDVIRTUAL1(_gui_input, Ref<InputEvent>)
+
public:
enum {
/* NOTIFICATION_DRAW=30,
@@ -343,6 +345,8 @@ public:
virtual Size2 _edit_get_minimum_size() const override;
#endif
+ virtual void gui_input(const Ref<InputEvent> &p_event);
+
void accept_event();
virtual Size2 get_minimum_size() const;
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 2e4204e171..2512b24623 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -95,7 +95,7 @@ void FileDialog::_notification(int p_what) {
}
}
-void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) {
+void FileDialog::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -854,8 +854,6 @@ void FileDialog::_update_drives() {
bool FileDialog::default_show_hidden_files = false;
void FileDialog::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_unhandled_input"), &FileDialog::_unhandled_input);
-
ClassDB::bind_method(D_METHOD("_cancel_pressed"), &FileDialog::_cancel_pressed);
ClassDB::bind_method(D_METHOD("clear_filters"), &FileDialog::clear_filters);
diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h
index 7fbafc4bb4..b5190bdab1 100644
--- a/scene/gui/file_dialog.h
+++ b/scene/gui/file_dialog.h
@@ -132,7 +132,7 @@ private:
void _update_drives();
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
bool _is_open_should_be_disabled();
diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp
index 635f3c51b9..bbab3008e2 100644
--- a/scene/gui/gradient_edit.cpp
+++ b/scene/gui/gradient_edit.cpp
@@ -88,7 +88,7 @@ void GradientEdit::_show_color_picker() {
GradientEdit::~GradientEdit() {
}
-void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) {
+void GradientEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -458,6 +458,5 @@ Vector<Gradient::Point> &GradientEdit::get_points() {
}
void GradientEdit::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &GradientEdit::_gui_input);
ADD_SIGNAL(MethodInfo("ramp_changed"));
}
diff --git a/scene/gui/gradient_edit.h b/scene/gui/gradient_edit.h
index b0ee2c4abb..a173631963 100644
--- a/scene/gui/gradient_edit.h
+++ b/scene/gui/gradient_edit.h
@@ -52,7 +52,7 @@ class GradientEdit : public Control {
void _show_color_picker();
protected:
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index cdb73e3698..0281bc7efb 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -51,10 +51,6 @@ GraphEditFilter::GraphEditFilter(GraphEdit *p_edit) {
ge = p_edit;
}
-void GraphEditMinimap::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &GraphEditMinimap::_gui_input);
-}
-
GraphEditMinimap::GraphEditMinimap(GraphEdit *p_edit) {
ge = p_edit;
@@ -148,7 +144,7 @@ Vector2 GraphEditMinimap::_convert_to_graph_position(const Vector2 &p_position)
return graph_position;
}
-void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
+void GraphEditMinimap::gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
if (!ge->is_minimap_enabled()) {
@@ -806,8 +802,9 @@ bool GraphEdit::is_in_hot_zone(const Vector2 &pos, const Vector2 &p_mouse_pos, c
}
PackedVector2Array GraphEdit::get_connection_line(const Vector2 &p_from, const Vector2 &p_to) {
- if (get_script_instance() && get_script_instance()->get_script().is_valid() && get_script_instance()->has_method("_get_connection_line")) {
- return get_script_instance()->call("_get_connection_line", p_from, p_to);
+ Vector<Vector2> ret;
+ if (GDVIRTUAL_CALL(_get_connection_line, p_from, p_to, ret)) {
+ return ret;
}
Curve2D curve;
@@ -1047,7 +1044,7 @@ void GraphEdit::set_selected(Node *p_child) {
}
}
-void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
+void GraphEdit::gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventMouseMotion> mm = p_ev;
@@ -2191,7 +2188,6 @@ void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_right_disconnects", "enable"), &GraphEdit::set_right_disconnects);
ClassDB::bind_method(D_METHOD("is_right_disconnects_enabled"), &GraphEdit::is_right_disconnects_enabled);
- ClassDB::bind_method(D_METHOD("_gui_input"), &GraphEdit::_gui_input);
ClassDB::bind_method(D_METHOD("_update_scroll_offset"), &GraphEdit::_update_scroll_offset);
ClassDB::bind_method(D_METHOD("get_zoom_hbox"), &GraphEdit::get_zoom_hbox);
@@ -2200,7 +2196,7 @@ void GraphEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_selected", "node"), &GraphEdit::set_selected);
- BIND_VMETHOD(MethodInfo(Variant::PACKED_VECTOR2_ARRAY, "_get_connection_line", PropertyInfo(Variant::VECTOR2, "from"), PropertyInfo(Variant::VECTOR2, "to")));
+ GDVIRTUAL_BIND(_get_connection_line, "from", "to")
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "right_disconnects"), "set_right_disconnects", "is_right_disconnects_enabled");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "scroll_offset"), "set_scroll_ofs", "get_scroll_ofs");
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 7a9286be0f..44e50aa3c2 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -62,8 +62,6 @@ class GraphEditMinimap : public Control {
GraphEdit *ge;
protected:
- static void _bind_methods();
-
public:
GraphEditMinimap(GraphEdit *p_edit);
@@ -88,7 +86,7 @@ private:
Vector2 _convert_from_graph_position(const Vector2 &p_position);
Vector2 _convert_to_graph_position(const Vector2 &p_position);
- void _gui_input(const Ref<InputEvent> &p_ev);
+ virtual void gui_input(const Ref<InputEvent> &p_ev) override;
void _adjust_graph_scroll(const Vector2 &p_offset);
};
@@ -178,7 +176,7 @@ private:
void _update_scroll();
void _scroll_moved(double);
- void _gui_input(const Ref<InputEvent> &p_ev);
+ virtual void gui_input(const Ref<InputEvent> &p_ev) override;
Control *connections_layer;
GraphEditFilter *top_layer;
@@ -255,6 +253,8 @@ protected:
virtual void remove_child_notify(Node *p_child) override;
void _notification(int p_what);
+ GDVIRTUAL2RC(Vector<Vector2>, _get_connection_line, Vector2, Vector2)
+
public:
Error connect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port);
bool is_node_connected(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port);
diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp
index e85cefcb7b..08c8c60d7a 100644
--- a/scene/gui/graph_node.cpp
+++ b/scene/gui/graph_node.cpp
@@ -863,7 +863,7 @@ Color GraphNode::get_connection_output_color(int p_idx) {
return conn_output_cache[p_idx].color;
}
-void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
+void GraphNode::gui_input(const Ref<InputEvent> &p_ev) {
ERR_FAIL_COND(p_ev.is_null());
Ref<InputEventMouseButton> mb = p_ev;
@@ -946,8 +946,6 @@ void GraphNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_language", "language"), &GraphNode::set_language);
ClassDB::bind_method(D_METHOD("get_language"), &GraphNode::get_language);
- ClassDB::bind_method(D_METHOD("_gui_input"), &GraphNode::_gui_input);
-
ClassDB::bind_method(D_METHOD("set_slot", "idx", "enable_left", "type_left", "color_left", "enable_right", "type_right", "color_right", "custom_left", "custom_right"), &GraphNode::set_slot, DEFVAL(Ref<Texture2D>()), DEFVAL(Ref<Texture2D>()));
ClassDB::bind_method(D_METHOD("clear_slot", "idx"), &GraphNode::clear_slot);
ClassDB::bind_method(D_METHOD("clear_all_slots"), &GraphNode::clear_all_slots);
diff --git a/scene/gui/graph_node.h b/scene/gui/graph_node.h
index c70f616b47..c7c7006bfc 100644
--- a/scene/gui/graph_node.h
+++ b/scene/gui/graph_node.h
@@ -99,7 +99,7 @@ private:
Overlay overlay = OVERLAY_DISABLED;
protected:
- void _gui_input(const Ref<InputEvent> &p_ev);
+ virtual void gui_input(const Ref<InputEvent> &p_ev) override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp
index c0e6e069cd..8297de9f30 100644
--- a/scene/gui/item_list.cpp
+++ b/scene/gui/item_list.cpp
@@ -537,7 +537,7 @@ Size2 ItemList::Item::get_icon_size() const {
return size_result;
}
-void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
+void ItemList::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
double prev_scroll = scroll_bar->get_value();
@@ -1614,8 +1614,6 @@ void ItemList::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_v_scroll"), &ItemList::get_v_scroll);
- ClassDB::bind_method(D_METHOD("_gui_input"), &ItemList::_gui_input);
-
ClassDB::bind_method(D_METHOD("_set_items"), &ItemList::_set_items);
ClassDB::bind_method(D_METHOD("_get_items"), &ItemList::_get_items);
diff --git a/scene/gui/item_list.h b/scene/gui/item_list.h
index 8a234398c3..148fa7ba9f 100644
--- a/scene/gui/item_list.h
+++ b/scene/gui/item_list.h
@@ -123,7 +123,6 @@ private:
void _set_items(const Array &p_items);
void _scroll_changed(double);
- void _gui_input(const Ref<InputEvent> &p_event);
void _shape(int p_idx);
protected:
@@ -131,6 +130,8 @@ protected:
static void _bind_methods();
public:
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
+
int add_item(const String &p_item, const Ref<Texture2D> &p_texture = Ref<Texture2D>(), bool p_selectable = true);
int add_icon_item(const Ref<Texture2D> &p_item, bool p_selectable = true);
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 11e08b231e..5e9c2d891f 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -216,7 +216,7 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) {
}
}
-void LineEdit::_gui_input(Ref<InputEvent> p_event) {
+void LineEdit::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> b = p_event;
@@ -2084,7 +2084,6 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_align", "align"), &LineEdit::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &LineEdit::get_align);
- ClassDB::bind_method(D_METHOD("_gui_input"), &LineEdit::_gui_input);
ClassDB::bind_method(D_METHOD("clear"), &LineEdit::clear);
ClassDB::bind_method(D_METHOD("select", "from", "to"), &LineEdit::select, DEFVAL(0), DEFVAL(-1));
ClassDB::bind_method(D_METHOD("select_all"), &LineEdit::select_all);
diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h
index 0e9c032e88..e364a79c83 100644
--- a/scene/gui/line_edit.h
+++ b/scene/gui/line_edit.h
@@ -202,7 +202,7 @@ private:
protected:
void _notification(int p_what);
static void _bind_methods();
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index dc6c7fec28..e312aaed57 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -33,7 +33,7 @@
#include "core/os/keyboard.h"
#include "scene/main/window.h"
-void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) {
+void MenuButton::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!_is_focus_owner_in_shorcut_context()) {
@@ -100,8 +100,8 @@ void MenuButton::pressed() {
popup->popup();
}
-void MenuButton::_gui_input(Ref<InputEvent> p_event) {
- BaseButton::_gui_input(p_event);
+void MenuButton::gui_input(const Ref<InputEvent> &p_event) {
+ BaseButton::gui_input(p_event);
}
PopupMenu *MenuButton::get_popup() const {
diff --git a/scene/gui/menu_button.h b/scene/gui/menu_button.h
index cc2ca117c4..730495b65d 100644
--- a/scene/gui/menu_button.h
+++ b/scene/gui/menu_button.h
@@ -47,14 +47,14 @@ class MenuButton : public Button {
Array _get_items() const;
void _set_items(const Array &p_items);
- void _gui_input(Ref<InputEvent> p_event) override;
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _popup_visibility_changed(bool p_visible);
protected:
void _notification(int p_what);
static void _bind_methods();
- virtual void _unhandled_key_input(Ref<InputEvent> p_event) override;
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
public:
virtual void pressed() override;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index aff367e398..f75d6755a8 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -251,7 +251,7 @@ void PopupMenu::_submenu_timeout() {
submenu_over = -1;
}
-void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
+void PopupMenu::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_action("ui_down") && p_event->is_pressed()) {
@@ -1581,8 +1581,6 @@ void PopupMenu::take_mouse_focus() {
}
void PopupMenu::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &PopupMenu::_gui_input);
-
ClassDB::bind_method(D_METHOD("add_item", "label", "id", "accel"), &PopupMenu::add_item, DEFVAL(-1), DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_icon_item", "texture", "label", "id", "accel"), &PopupMenu::add_icon_item, DEFVAL(-1), DEFVAL(0));
ClassDB::bind_method(D_METHOD("add_check_item", "label", "id", "accel"), &PopupMenu::add_check_item, DEFVAL(-1), DEFVAL(0));
@@ -1708,7 +1706,7 @@ PopupMenu::PopupMenu() {
scroll_container->add_child(control);
control->connect("draw", callable_mp(this, &PopupMenu::_draw_items));
- connect("window_input", callable_mp(this, &PopupMenu::_gui_input));
+ connect("window_input", callable_mp(this, &PopupMenu::gui_input));
submenu_timer = memnew(Timer);
submenu_timer->set_wait_time(0.3);
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h
index aedc5d0155..5c427e43bc 100644
--- a/scene/gui/popup_menu.h
+++ b/scene/gui/popup_menu.h
@@ -31,10 +31,10 @@
#ifndef POPUP_MENU_H
#define POPUP_MENU_H
+#include "core/input/shortcut.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/popup.h"
#include "scene/gui/scroll_container.h"
-#include "scene/gui/shortcut.h"
#include "scene/resources/text_line.h"
class PopupMenu : public Popup {
@@ -107,7 +107,7 @@ class PopupMenu : public Popup {
void _shape_item(int p_item);
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event);
void _activate_submenu(int p_over);
void _submenu_timeout();
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 75c2da7ef9..9707129ba8 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1477,7 +1477,7 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const
return CURSOR_ARROW;
}
-void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
+void RichTextLabel::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> b = p_event;
@@ -3993,7 +3993,6 @@ void RichTextLabel::_validate_property(PropertyInfo &property) const {
}
void RichTextLabel::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &RichTextLabel::_gui_input);
ClassDB::bind_method(D_METHOD("get_text"), &RichTextLabel::get_text);
ClassDB::bind_method(D_METHOD("add_text", "text"), &RichTextLabel::add_text);
ClassDB::bind_method(D_METHOD("set_text", "text"), &RichTextLabel::set_text);
diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h
index 28dfe74b08..ae04a7e684 100644
--- a/scene/gui/rich_text_label.h
+++ b/scene/gui/rich_text_label.h
@@ -443,7 +443,7 @@ private:
void _update_fx(ItemFrame *p_frame, double p_delta_time);
void _scroll_changed(double);
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
Item *_get_next_item(Item *p_item, bool p_free = false) const;
Item *_get_prev_item(Item *p_item, bool p_free = false) const;
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index ce04a0204b..08bcb0bdda 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -41,7 +41,7 @@ void ScrollBar::set_can_focus_by_default(bool p_can_focus) {
focus_by_default = p_can_focus;
}
-void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
+void ScrollBar::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> m = p_event;
@@ -597,7 +597,6 @@ bool ScrollBar::is_smooth_scroll_enabled() const {
}
void ScrollBar::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &ScrollBar::_gui_input);
ClassDB::bind_method(D_METHOD("set_custom_step", "step"), &ScrollBar::set_custom_step);
ClassDB::bind_method(D_METHOD("get_custom_step"), &ScrollBar::get_custom_step);
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 24b3b33e82..fbc035397f 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -86,7 +86,7 @@ class ScrollBar : public Range {
void _drag_node_exit();
void _drag_node_input(const Ref<InputEvent> &p_input);
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
protected:
void _notification(int p_what);
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index eb5fc924da..b5daa8b3f1 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -83,7 +83,7 @@ void ScrollContainer::_cancel_drag() {
}
}
-void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
+void ScrollContainer::gui_input(const Ref<InputEvent> &p_gui_input) {
ERR_FAIL_COND(p_gui_input.is_null());
double prev_v_scroll = v_scroll->get_value();
@@ -568,7 +568,6 @@ VScrollBar *ScrollContainer::get_v_scrollbar() {
}
void ScrollContainer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &ScrollContainer::_gui_input);
ClassDB::bind_method(D_METHOD("_update_scrollbar_position"), &ScrollContainer::_update_scrollbar_position);
ClassDB::bind_method(D_METHOD("set_h_scroll", "value"), &ScrollContainer::set_h_scroll);
diff --git a/scene/gui/scroll_container.h b/scene/gui/scroll_container.h
index 4733fdabca..9f4ec558dc 100644
--- a/scene/gui/scroll_container.h
+++ b/scene/gui/scroll_container.h
@@ -68,7 +68,7 @@ class ScrollContainer : public Container {
protected:
Size2 get_minimum_size() const override;
- void _gui_input(const Ref<InputEvent> &p_gui_input);
+ virtual void gui_input(const Ref<InputEvent> &p_gui_input) override;
void _gui_focus_changed(Control *p_control);
void _update_dimensions();
void _notification(int p_what);
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index 61b5325175..352f87954e 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -45,7 +45,7 @@ Size2 Slider::get_minimum_size() const {
}
}
-void Slider::_gui_input(Ref<InputEvent> p_event) {
+void Slider::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!editable) {
@@ -253,7 +253,6 @@ bool Slider::is_scrollable() const {
}
void Slider::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &Slider::_gui_input);
ClassDB::bind_method(D_METHOD("set_ticks", "count"), &Slider::set_ticks);
ClassDB::bind_method(D_METHOD("get_ticks"), &Slider::get_ticks);
diff --git a/scene/gui/slider.h b/scene/gui/slider.h
index 65a4036cd1..46fa08bbf0 100644
--- a/scene/gui/slider.h
+++ b/scene/gui/slider.h
@@ -50,7 +50,7 @@ class Slider : public Range {
bool scrollable = true;
protected:
- void _gui_input(Ref<InputEvent> p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
static void _bind_methods();
bool ticks_on_borders = false;
diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp
index 3f0368a4e2..65a3eb3adf 100644
--- a/scene/gui/spin_box.cpp
+++ b/scene/gui/spin_box.cpp
@@ -99,7 +99,7 @@ void SpinBox::_release_mouse() {
}
}
-void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
+void SpinBox::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (!is_editable()) {
@@ -258,7 +258,7 @@ void SpinBox::apply() {
void SpinBox::_bind_methods() {
//ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed);
- ClassDB::bind_method(D_METHOD("_gui_input"), &SpinBox::_gui_input);
+
ClassDB::bind_method(D_METHOD("set_align", "align"), &SpinBox::set_align);
ClassDB::bind_method(D_METHOD("get_align"), &SpinBox::get_align);
ClassDB::bind_method(D_METHOD("set_suffix", "suffix"), &SpinBox::set_suffix);
diff --git a/scene/gui/spin_box.h b/scene/gui/spin_box.h
index fb10379296..9ec3885f1f 100644
--- a/scene/gui/spin_box.h
+++ b/scene/gui/spin_box.h
@@ -65,7 +65,7 @@ class SpinBox : public Range {
inline void _adjust_width_for_icon(const Ref<Texture2D> &icon);
protected:
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 3114e5b7c0..4736a1ad37 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -206,7 +206,7 @@ void SplitContainer::_notification(int p_what) {
}
}
-void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
+void SplitContainer::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) {
@@ -337,8 +337,6 @@ bool SplitContainer::is_collapsed() const {
}
void SplitContainer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &SplitContainer::_gui_input);
-
ClassDB::bind_method(D_METHOD("set_split_offset", "offset"), &SplitContainer::set_split_offset);
ClassDB::bind_method(D_METHOD("get_split_offset"), &SplitContainer::get_split_offset);
ClassDB::bind_method(D_METHOD("clamp_split_offset"), &SplitContainer::clamp_split_offset);
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index 6cb94d6ecf..47fd30a122 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -60,7 +60,7 @@ private:
void _resort();
protected:
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp
index bfc7e29f9c..53ea32e1b7 100644
--- a/scene/gui/subviewport_container.cpp
+++ b/scene/gui/subviewport_container.cpp
@@ -139,7 +139,7 @@ void SubViewportContainer::_notification(int p_what) {
}
}
-void SubViewportContainer::_input(const Ref<InputEvent> &p_event) {
+void SubViewportContainer::input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (Engine::get_singleton()->is_editor_hint()) {
@@ -162,11 +162,11 @@ void SubViewportContainer::_input(const Ref<InputEvent> &p_event) {
continue;
}
- c->input(ev);
+ c->push_input(ev);
}
}
-void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
+void SubViewportContainer::unhandled_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (Engine::get_singleton()->is_editor_hint()) {
@@ -189,13 +189,11 @@ void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) {
continue;
}
- c->unhandled_input(ev);
+ c->push_unhandled_input(ev);
}
}
void SubViewportContainer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_unhandled_input", "event"), &SubViewportContainer::_unhandled_input);
- ClassDB::bind_method(D_METHOD("_input", "event"), &SubViewportContainer::_input);
ClassDB::bind_method(D_METHOD("set_stretch", "enable"), &SubViewportContainer::set_stretch);
ClassDB::bind_method(D_METHOD("is_stretch_enabled"), &SubViewportContainer::is_stretch_enabled);
diff --git a/scene/gui/subviewport_container.h b/scene/gui/subviewport_container.h
index 77cf4c16b3..7853f1590e 100644
--- a/scene/gui/subviewport_container.h
+++ b/scene/gui/subviewport_container.h
@@ -47,8 +47,8 @@ public:
void set_stretch(bool p_enable);
bool is_stretch_enabled() const;
- void _input(const Ref<InputEvent> &p_event);
- void _unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void input(const Ref<InputEvent> &p_event) override;
+ virtual void unhandled_input(const Ref<InputEvent> &p_event) override;
void set_stretch_shrink(int p_shrink);
int get_stretch_shrink() const;
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index 53a2fe4d93..5884d2a854 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -71,7 +71,7 @@ int TabContainer::_get_top_margin() const {
return tab_height + content_height;
}
-void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
+void TabContainer::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseButton> mb = p_event;
@@ -1193,7 +1193,6 @@ bool TabContainer::get_use_hidden_tabs_for_min_size() const {
}
void TabContainer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &TabContainer::_gui_input);
ClassDB::bind_method(D_METHOD("get_tab_count"), &TabContainer::get_tab_count);
ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &TabContainer::set_current_tab);
ClassDB::bind_method(D_METHOD("get_current_tab"), &TabContainer::get_current_tab);
diff --git a/scene/gui/tab_container.h b/scene/gui/tab_container.h
index 35f18eff8e..fe96df25e8 100644
--- a/scene/gui/tab_container.h
+++ b/scene/gui/tab_container.h
@@ -76,7 +76,7 @@ private:
protected:
void _child_renamed_callback();
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
virtual void add_child_notify(Node *p_child) override;
virtual void move_child_notify(Node *p_child) override;
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 103860ad78..3ca2d1c1e9 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -90,7 +90,7 @@ Size2 Tabs::get_minimum_size() const {
return ms;
}
-void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
+void Tabs::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventMouseMotion> mm = p_event;
@@ -1107,7 +1107,6 @@ bool Tabs::get_select_with_rmb() const {
}
void Tabs::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &Tabs::_gui_input);
ClassDB::bind_method(D_METHOD("_update_hover"), &Tabs::_update_hover);
ClassDB::bind_method(D_METHOD("get_tab_count"), &Tabs::get_tab_count);
ClassDB::bind_method(D_METHOD("set_current_tab", "tab_idx"), &Tabs::set_current_tab);
diff --git a/scene/gui/tabs.h b/scene/gui/tabs.h
index 61c9a5d96a..b044453803 100644
--- a/scene/gui/tabs.h
+++ b/scene/gui/tabs.h
@@ -112,7 +112,7 @@ private:
void _shape(int p_tab);
protected:
- void _gui_input(const Ref<InputEvent> &p_event);
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _notification(int p_what);
static void _bind_methods();
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index a65abd5f49..a8d78ba97f 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1305,7 +1305,7 @@ void TextEdit::_notification(int p_what) {
}
}
-void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
+void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) {
ERR_FAIL_COND(p_gui_input.is_null());
double prev_v_scroll = v_scroll->get_value();
@@ -4367,7 +4367,7 @@ bool TextEdit::is_drawing_spaces() const {
void TextEdit::_bind_methods() {
/*Internal. */
- ClassDB::bind_method(D_METHOD("_gui_input"), &TextEdit::_gui_input);
+
ClassDB::bind_method(D_METHOD("_text_changed_emit"), &TextEdit::_text_changed_emit);
/* Text */
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 7d00ce14af..ced03e19d0 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -528,7 +528,7 @@ private:
protected:
void _notification(int p_what);
- virtual void _gui_input(const Ref<InputEvent> &p_gui_input);
+ virtual void gui_input(const Ref<InputEvent> &p_gui_input) override;
static void _bind_methods();
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index d9892b53fc..5f07f5216a 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -2768,7 +2768,7 @@ void Tree::_go_down() {
accept_event();
}
-void Tree::_gui_input(Ref<InputEvent> p_event) {
+void Tree::gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -4650,8 +4650,6 @@ bool Tree::get_allow_reselect() const {
}
void Tree::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_gui_input"), &Tree::_gui_input);
-
ClassDB::bind_method(D_METHOD("clear"), &Tree::clear);
ClassDB::bind_method(D_METHOD("create_item", "parent", "idx"), &Tree::_create_item, DEFVAL(Variant()), DEFVAL(-1));
diff --git a/scene/gui/tree.h b/scene/gui/tree.h
index c207737cc0..cce8b527db 100644
--- a/scene/gui/tree.h
+++ b/scene/gui/tree.h
@@ -462,7 +462,6 @@ private:
void popup_select(int p_option);
- void _gui_input(Ref<InputEvent> p_event);
void _notification(int p_what);
void item_edited(int p_column, TreeItem *p_item, bool p_lmb = true);
@@ -626,6 +625,8 @@ protected:
}
public:
+ virtual void gui_input(const Ref<InputEvent> &p_event) override;
+
virtual String get_tooltip(const Point2 &p_pos) const override;
TreeItem *get_item_at_position(const Point2 &p_pos) const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 1d617d1ff7..4ea4579bf9 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -123,15 +123,15 @@ void Node::_notification(int p_notification) {
} break;
case NOTIFICATION_READY: {
if (get_script_instance()) {
- if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_input)) {
+ if (GDVIRTUAL_IS_OVERRIDEN(_input)) {
set_process_input(true);
}
- if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_unhandled_input)) {
+ if (GDVIRTUAL_IS_OVERRIDEN(_unhandled_input)) {
set_process_unhandled_input(true);
}
- if (get_script_instance()->has_method(SceneStringNames::get_singleton()->_unhandled_key_input)) {
+ if (GDVIRTUAL_IS_OVERRIDEN(_unhandled_key_input)) {
set_process_unhandled_key_input(true);
}
@@ -2487,9 +2487,14 @@ void Node::clear_internal_tree_resource_paths() {
}
TypedArray<String> Node::get_configuration_warnings() const {
- if (get_script_instance() && get_script_instance()->get_script().is_valid() &&
- get_script_instance()->get_script()->is_tool() && get_script_instance()->has_method("_get_configuration_warnings")) {
- return get_script_instance()->call("_get_configuration_warnings");
+ Vector<String> warnings;
+ if (GDVIRTUAL_CALL(_get_configuration_warnings, warnings)) {
+ TypedArray<String> ret;
+ ret.resize(warnings.size());
+ for (int i = 0; i < warnings.size(); i++) {
+ ret[i] = warnings[i];
+ }
+ return ret;
}
return Array();
}
@@ -2535,6 +2540,37 @@ void Node::request_ready() {
data.ready_first = true;
}
+void Node::_call_input(const Ref<InputEvent> &p_event) {
+ GDVIRTUAL_CALL(_input, p_event);
+ if (!is_inside_tree() || !get_viewport() || get_viewport()->is_input_handled()) {
+ return;
+ }
+ input(p_event);
+}
+void Node::_call_unhandled_input(const Ref<InputEvent> &p_event) {
+ GDVIRTUAL_CALL(_unhandled_input, p_event);
+ if (!is_inside_tree() || !get_viewport() || get_viewport()->is_input_handled()) {
+ return;
+ }
+ unhandled_input(p_event);
+}
+void Node::_call_unhandled_key_input(const Ref<InputEvent> &p_event) {
+ GDVIRTUAL_CALL(_unhandled_key_input, p_event);
+ if (!is_inside_tree() || !get_viewport() || get_viewport()->is_input_handled()) {
+ return;
+ }
+ unhandled_key_input(p_event);
+}
+
+void Node::input(const Ref<InputEvent> &p_event) {
+}
+
+void Node::unhandled_input(const Ref<InputEvent> &p_event) {
+}
+
+void Node::unhandled_key_input(const Ref<InputEvent> &p_key_event) {
+}
+
void Node::_bind_methods() {
GLOBAL_DEF("editor/node_naming/name_num_separator", 0);
ProjectSettings::get_singleton()->set_custom_property_info("editor/node_naming/name_num_separator", PropertyInfo(Variant::INT, "editor/node_naming/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"));
@@ -2734,11 +2770,9 @@ void Node::_bind_methods() {
GDVIRTUAL_BIND(_exit_tree);
GDVIRTUAL_BIND(_ready);
GDVIRTUAL_BIND(_get_configuration_warnings);
-
- BIND_VMETHOD(MethodInfo("_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- BIND_VMETHOD(MethodInfo("_unhandled_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- BIND_VMETHOD(MethodInfo("_unhandled_key_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEventKey")));
- BIND_VMETHOD(MethodInfo(PropertyInfo(Variant::ARRAY, "", PROPERTY_HINT_ARRAY_TYPE, "String"), "_get_configuration_warnings"));
+ GDVIRTUAL_BIND(_input, "event");
+ GDVIRTUAL_BIND(_unhandled_input, "event");
+ GDVIRTUAL_BIND(_unhandled_key_input, "event");
}
String Node::_get_name_num_separator() {
diff --git a/scene/main/node.h b/scene/main/node.h
index 8aa56aa97f..a07accba2f 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -208,12 +208,27 @@ protected:
void _set_owner_nocheck(Node *p_owner);
void _set_name_nocheck(const StringName &p_name);
+ //call from SceneTree
+ void _call_input(const Ref<InputEvent> &p_event);
+ void _call_unhandled_input(const Ref<InputEvent> &p_event);
+ void _call_unhandled_key_input(const Ref<InputEvent> &p_event);
+
+protected:
+ virtual void input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_input(const Ref<InputEvent> &p_event);
+ virtual void unhandled_key_input(const Ref<InputEvent> &p_key_event);
+
GDVIRTUAL1(_process, double)
GDVIRTUAL1(_physics_process, double)
GDVIRTUAL0(_enter_tree)
GDVIRTUAL0(_exit_tree)
GDVIRTUAL0(_ready)
GDVIRTUAL0RC(Vector<String>, _get_configuration_warnings)
+
+ GDVIRTUAL1(_input, Ref<InputEvent>)
+ GDVIRTUAL1(_unhandled_input, Ref<InputEvent>)
+ GDVIRTUAL1(_unhandled_key_input, Ref<InputEvent>)
+
public:
enum {
// you can make your own, but don't use the same numbers as other notifications in other nodes
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 5b707498a7..8260d0dff5 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -867,7 +867,7 @@ void SceneMainLoop::_update_listener_2d() {
*/
-void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p_method, const Ref<InputEvent> &p_input, Viewport *p_viewport) {
+void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_call_type, const Ref<InputEvent> &p_input, Viewport *p_viewport) {
Map<StringName, Group>::Element *E = group_map.find(p_group);
if (!E) {
return;
@@ -886,9 +886,6 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
int node_count = nodes_copy.size();
Node **nodes = nodes_copy.ptrw();
- Variant arg = p_input;
- const Variant *v[1] = { &arg };
-
call_lock++;
for (int i = node_count - 1; i >= 0; i--) {
@@ -905,14 +902,16 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
continue;
}
- 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);
- }
- MethodBind *method = ClassDB::get_method(n->get_class_name(), p_method);
- if (method) {
- method->call(n, (const Variant **)v, 1, err);
+ switch (p_call_type) {
+ case CALL_INPUT_TYPE_INPUT:
+ n->_call_input(p_input);
+ break;
+ case CALL_INPUT_TYPE_UNHANDLED_INPUT:
+ n->_call_unhandled_input(p_input);
+ break;
+ case CALL_INPUT_TYPE_UNHANDLED_KEY_INPUT:
+ n->_call_unhandled_key_input(p_input);
+ break;
}
}
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index cfb95bd6b5..b1b94ae910 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -204,8 +204,14 @@ private:
void _main_window_close();
void _main_window_go_back();
+ enum CallInputType {
+ CALL_INPUT_TYPE_INPUT,
+ CALL_INPUT_TYPE_UNHANDLED_INPUT,
+ CALL_INPUT_TYPE_UNHANDLED_KEY_INPUT,
+ };
+
//used by viewport
- void _call_input_pause(const StringName &p_group, const StringName &p_method, const Ref<InputEvent> &p_input, Viewport *p_viewport);
+ void _call_input_pause(const StringName &p_group, CallInputType p_call_type, const Ref<InputEvent> &p_input, Viewport *p_viewport);
protected:
void _notification(int p_notification);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 78fa0985a9..ea2323c651 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -32,6 +32,7 @@
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
+#include "core/object/message_queue.h"
#include "core/string/translation.h"
#include "core/templates/pair.h"
#include "scene/2d/camera_2d.h"
@@ -662,7 +663,7 @@ void Viewport::_process_picking() {
}
if (send_event) {
- co->_input_event(this, ev, res[i].shape);
+ co->_input_event_call(this, ev, res[i].shape);
}
}
}
@@ -1234,27 +1235,7 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu
Control *control = Object::cast_to<Control>(ci);
if (control) {
if (control->data.mouse_filter != Control::MOUSE_FILTER_IGNORE) {
- control->emit_signal(SceneStringNames::get_singleton()->gui_input, ev); //signal should be first, so it's possible to override an event (and then accept it)
- }
- if (gui.key_event_accepted) {
- break;
- }
- if (!control->is_inside_tree()) {
- break;
- }
-
- if (control->data.mouse_filter != Control::MOUSE_FILTER_IGNORE) {
- // 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);
- }
+ control->_call_gui_input(ev);
}
if (!control->is_inside_tree() || control->is_set_as_top_level()) {
@@ -1982,10 +1963,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.key_focus) {
gui.key_event_accepted = false;
if (gui.key_focus->can_process()) {
- gui.key_focus->call(SceneStringNames::get_singleton()->_gui_input, p_event);
- if (gui.key_focus) { //maybe lost it
- gui.key_focus->emit_signal(SceneStringNames::get_singleton()->gui_input, p_event);
- }
+ gui.key_focus->_call_gui_input(p_event);
}
if (gui.key_event_accepted) {
@@ -2205,7 +2183,7 @@ void Viewport::_drop_mouse_focus() {
mb->set_global_position(c->get_local_mouse_position());
mb->set_button_index(MouseButton(i + 1));
mb->set_pressed(false);
- c->call(SceneStringNames::get_singleton()->_gui_input, mb);
+ c->_call_gui_input(mb);
}
}
}
@@ -2317,7 +2295,7 @@ void Viewport::_post_gui_grab_click_focus() {
mb->set_position(click);
mb->set_button_index(MouseButton(i + 1));
mb->set_pressed(false);
- gui.mouse_focus->call(SceneStringNames::get_singleton()->_gui_input, mb);
+ gui.mouse_focus->_call_gui_input(mb);
}
}
@@ -2335,7 +2313,7 @@ void Viewport::_post_gui_grab_click_focus() {
mb->set_position(click);
mb->set_button_index(MouseButton(i + 1));
mb->set_pressed(true);
- gui.mouse_focus->call_deferred(SceneStringNames::get_singleton()->_gui_input, mb);
+ MessageQueue::get_singleton()->push_callable(callable_mp(gui.mouse_focus, &Control::_call_gui_input), mb);
}
}
}
@@ -2343,9 +2321,9 @@ void Viewport::_post_gui_grab_click_focus() {
///////////////////////////////
-void Viewport::input_text(const String &p_text) {
+void Viewport::push_text_input(const String &p_text) {
if (gui.subwindow_focused) {
- gui.subwindow_focused->input_text(p_text);
+ gui.subwindow_focused->push_text_input(p_text);
return;
}
@@ -2665,7 +2643,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
return true;
}
-void Viewport::input(const Ref<InputEvent> &p_event, bool p_local_coords) {
+void Viewport::push_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
ERR_FAIL_COND(!is_inside_tree());
if (disable_input) {
@@ -2695,7 +2673,7 @@ void Viewport::input(const Ref<InputEvent> &p_event, bool p_local_coords) {
}
if (!is_input_handled()) {
- get_tree()->_call_input_pause(input_group, "_input", ev, this); //not a bug, must happen before GUI, order is _input -> gui input -> _unhandled input
+ get_tree()->_call_input_pause(input_group, SceneTree::CALL_INPUT_TYPE_INPUT, ev, this); //not a bug, must happen before GUI, order is _input -> gui input -> _unhandled input
}
if (!is_input_handled()) {
@@ -2703,10 +2681,9 @@ void Viewport::input(const Ref<InputEvent> &p_event, bool p_local_coords) {
}
event_count++;
- //get_tree()->call_group(SceneTree::GROUP_CALL_REVERSE|SceneTree::GROUP_CALL_REALTIME|SceneTree::GROUP_CALL_MULIILEVEL,gui_input_group,"_gui_input",ev); //special one for GUI, as controls use their own process check
}
-void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
+void Viewport::push_unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords) {
ERR_FAIL_COND(p_event.is_null());
ERR_FAIL_COND(!is_inside_tree());
local_input_handled = false;
@@ -2727,11 +2704,11 @@ void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coor
}
// Unhandled Input
- get_tree()->_call_input_pause(unhandled_input_group, "_unhandled_input", ev, this);
+ get_tree()->_call_input_pause(unhandled_input_group, SceneTree::CALL_INPUT_TYPE_UNHANDLED_INPUT, ev, this);
// Unhandled key Input - used for performance reasons - This is called a lot less than _unhandled_input since it ignores MouseMotion, etc
if (!is_input_handled() && (Object::cast_to<InputEventKey>(*ev) != nullptr || Object::cast_to<InputEventShortcut>(*ev) != nullptr)) {
- get_tree()->_call_input_pause(unhandled_key_input_group, "_unhandled_key_input", ev, this);
+ get_tree()->_call_input_pause(unhandled_key_input_group, SceneTree::CALL_INPUT_TYPE_UNHANDLED_KEY_INPUT, ev, this);
}
if (physics_object_picking && !is_input_handled()) {
@@ -3159,7 +3136,7 @@ void Viewport::_collision_object_3d_input_event(CollisionObject3D *p_object, Cam
return; //discarded
}
}
- p_object->_input_event(camera_3d, p_input_event, p_pos, p_normal, p_shape);
+ p_object->_input_event_call(camera_3d, p_input_event, p_pos, p_normal, p_shape);
physics_last_object_transform = object_transform;
physics_last_camera_transform = camera_transform;
physics_last_id = id;
@@ -3515,9 +3492,9 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_physics_object_picking"), &Viewport::get_physics_object_picking);
ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid);
- ClassDB::bind_method(D_METHOD("input_text", "text"), &Viewport::input_text);
- ClassDB::bind_method(D_METHOD("input", "event", "in_local_coords"), &Viewport::input, DEFVAL(false));
- ClassDB::bind_method(D_METHOD("unhandled_input", "event", "in_local_coords"), &Viewport::unhandled_input, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("push_text_input", "text"), &Viewport::push_text_input);
+ ClassDB::bind_method(D_METHOD("push_input", "event", "in_local_coords"), &Viewport::push_input, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("push_unhandled_input", "event", "in_local_coords"), &Viewport::push_unhandled_input, DEFVAL(false));
ClassDB::bind_method(D_METHOD("get_camera_2d"), &Viewport::get_camera_2d);
ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 9c51f404d7..b24de77e6b 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -508,9 +508,9 @@ public:
Vector2 get_camera_coords(const Vector2 &p_viewport_coords) const;
Vector2 get_camera_rect_size() const;
- void input_text(const String &p_text);
- void input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
- void unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
+ void push_text_input(const String &p_text);
+ void push_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
+ void push_unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
void set_disable_input(bool p_disable);
bool is_input_disabled() const;
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 73eec73d75..b9c0ae5a4a 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -916,14 +916,14 @@ void Window::_window_input(const Ref<InputEvent> &p_ev) {
emit_signal(SceneStringNames::get_singleton()->window_input, p_ev);
- input(p_ev);
+ push_input(p_ev);
if (!is_input_handled()) {
- unhandled_input(p_ev);
+ push_unhandled_input(p_ev);
}
}
void Window::_window_input_text(const String &p_text) {
- input_text(p_text);
+ push_text_input(p_text);
}
void Window::_window_drop_files(const Vector<String> &p_files) {
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 6f8091c03f..2cea3c2337 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -320,7 +320,6 @@ void register_scene_types() {
OS::get_singleton()->yield(); //may take time to init
- GDREGISTER_CLASS(Shortcut);
GDREGISTER_CLASS(Control);
GDREGISTER_CLASS(Button);
GDREGISTER_CLASS(Label);