Entirely removes BIND_VMETHOD in favor of GDVIRTUAL

* `_gui_input`, `_input`, `_unhandled_input` and `_unhandled_key_input` are now regular C++ virutal functions.
* Everything else converted to GDVIRTUAL
* BIND_VMETHOD is gone, always use the new syntax from now on.

Creating `_gui_input` method and using the binder to register events will no longer work, simply override the virtual function now.
This commit is contained in:
reduz
2021-08-22 12:37:22 -03:00
parent bcf12edc68
commit 399f322fbf
4 changed files with 3 additions and 25 deletions

View File

@@ -1845,26 +1845,6 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o
max_input_args = 0; max_input_args = 0;
max_output_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. // Setup variables.
{ {
List<StringName> keys; List<StringName> keys;

View File

@@ -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()); ERR_FAIL_COND(p_event.is_null());
// GUI input for VS Editor Plugin // 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("_can_drop_data_fw", &VisualScriptEditor::can_drop_data_fw);
ClassDB::bind_method("_drop_data_fw", &VisualScriptEditor::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_graph_connections", &VisualScriptEditor::_update_graph_connections);
ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members); ClassDB::bind_method("_update_members", &VisualScriptEditor::_update_members);

View File

@@ -234,7 +234,7 @@ class VisualScriptEditor : public ScriptEditorBase {
void _generic_search(String p_base_type = "", Vector2 pos = Vector2(), bool node_centered = false); 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 _graph_gui_input(const Ref<InputEvent> &p_event);
void _members_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); void _fn_name_box_input(const Ref<InputEvent> &p_event);

View File

@@ -55,7 +55,7 @@ void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
case KEY_DOWN: case KEY_DOWN:
case KEY_PAGEUP: case KEY_PAGEUP:
case KEY_PAGEDOWN: { case KEY_PAGEDOWN: {
search_options->call("_gui_input", k); search_options->gui_input(k);
search_box->accept_event(); search_box->accept_event();
TreeItem *root = search_options->get_root(); TreeItem *root = search_options->get_root();