diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-07 23:30:27 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-07 23:30:27 +0200 |
commit | 31b55e7da13013f1d8096bed86da5300b3bdcee1 (patch) | |
tree | c98c82ed3153336c3ed76fb632f2dd8d3d71b5ef | |
parent | 747e0f5ef0ec46dca9e02c0c203262128f8d7992 (diff) | |
parent | ae737d8cd946178c48a518e7342d031dccb23b62 (diff) | |
download | redot-engine-31b55e7da13013f1d8096bed86da5300b3bdcee1.tar.gz |
Merge pull request #92802 from dalexeev/editor-hide-gdscript-internal-funcs
Editor: Hide GDScript internal functions from method selectors
-rw-r--r-- | editor/connections_dialog.cpp | 9 | ||||
-rw-r--r-- | editor/property_selector.cpp | 17 |
2 files changed, 24 insertions, 2 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 1145a10f71..cede2c0ab6 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -294,6 +294,13 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me } for (const MethodInfo &mi : p_methods) { + if (mi.name.begins_with("@")) { + // GH-92782. GDScript inline setters/getters are historically present in `get_method_list()` + // and can be called using `Object.call()`. However, these functions are meant to be internal + // and their names are not valid identifiers, so let's hide them from the user. + continue; + } + if (!p_search_string.is_empty() && !mi.name.containsn(p_search_string)) { continue; } @@ -324,8 +331,10 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me continue; } } + ret.push_back(mi); } + return ret; } diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp index d123d8ef59..a5157bd394 100644 --- a/editor/property_selector.cpp +++ b/editor/property_selector.cpp @@ -225,11 +225,24 @@ void PropertySelector::_update_search() { } else { Ref<Script> script_ref = Object::cast_to<Script>(ObjectDB::get_instance(script)); if (script_ref.is_valid()) { - methods.push_back(MethodInfo("*Script Methods")); if (script_ref->is_built_in()) { script_ref->reload(true); } - script_ref->get_script_method_list(&methods); + + List<MethodInfo> script_methods; + script_ref->get_script_method_list(&script_methods); + + methods.push_back(MethodInfo("*Script Methods")); // TODO: Split by inheritance. + + for (const MethodInfo &mi : script_methods) { + if (mi.name.begins_with("@")) { + // GH-92782. GDScript inline setters/getters are historically present in `get_method_list()` + // and can be called using `Object.call()`. However, these functions are meant to be internal + // and their names are not valid identifiers, so let's hide them from the user. + continue; + } + methods.push_back(mi); + } } StringName base = base_type; |