diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 9031fa1ace8..81940fb769b 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -460,6 +460,15 @@ void ScriptServer::get_inheriters_list(const StringName &p_base_type, List *r_classes) { + List direct_inheritors; + get_inheriters_list(p_base_type, &direct_inheritors); + for (const StringName &inheritor : direct_inheritors) { + r_classes->push_back(inheritor); + get_indirect_inheriters_list(inheritor, r_classes); + } +} + void ScriptServer::remove_global_class_by_path(const String &p_path) { for (const KeyValue &kv : global_classes) { if (kv.value.path == p_path) { diff --git a/core/object/script_language.h b/core/object/script_language.h index d7bcfc73b3b..9b2612a3322 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -100,6 +100,7 @@ public: static bool is_global_class_tool(const String &p_class); static void get_global_class_list(LocalVector &r_global_classes); static void get_inheriters_list(const StringName &p_base_type, List *r_classes); + static void get_indirect_inheriters_list(const StringName &p_base_type, List *r_classes); static void save_global_classes(); static Vector> capture_script_backtraces(bool p_include_variables = false); diff --git a/editor/script/editor_script_plugin.cpp b/editor/script/editor_script_plugin.cpp index 4696a97c6ca..98711826e80 100644 --- a/editor/script/editor_script_plugin.cpp +++ b/editor/script/editor_script_plugin.cpp @@ -53,7 +53,7 @@ void EditorScriptPlugin::command_palette_about_to_popup() { EditorInterface::get_singleton()->get_command_palette()->remove_command("editor_scripts/" + command); } commands.clear(); - ScriptServer::get_inheriters_list(SNAME("EditorScript"), &commands); + ScriptServer::get_indirect_inheriters_list(SNAME("EditorScript"), &commands); for (const StringName &command : commands) { EditorInterface::get_singleton()->get_command_palette()->add_command(String(command).capitalize(), "editor_scripts/" + command, callable_mp(this, &EditorScriptPlugin::run_command), varray(command), nullptr); }