Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Hide GDScript internal functions from method selectors #92802

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -324,8 +331,10 @@ List<MethodInfo> ConnectDialog::_filter_method_list(const List<MethodInfo> &p_me
continue;
}
}

ret.push_back(mi);
}

return ret;
}

Expand Down
17 changes: 15 additions & 2 deletions editor/property_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading