1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Include more attributes in the global class names cache

This commit is contained in:
Pedro J. Estébanez
2025-01-08 13:21:47 +01:00
parent aca5cfc913
commit 318af42020
16 changed files with 174 additions and 133 deletions

View File

@@ -315,18 +315,14 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const StringN
r_item->set_metadata(0, p_type);
r_item->set_text(0, p_type);
String script_path = ScriptServer::get_global_class_path(p_type);
Ref<Script> scr = ResourceLoader::load(script_path, "Script");
ERR_FAIL_COND(scr.is_null());
is_abstract = scr->is_abstract();
is_abstract = ScriptServer::is_global_class_abstract(p_type);
String tooltip = TTR("Script path: %s");
bool is_tool = scr->is_tool();
bool is_tool = ScriptServer::is_global_class_tool(p_type);
if (is_tool) {
tooltip = TTR("The script will run in the editor.") + "\n" + tooltip;
}
r_item->add_button(0, get_editor_theme_icon(SNAME("Script")), 1, false, vformat(tooltip, script_path));
r_item->add_button(0, get_editor_theme_icon(SNAME("Script")), 1, false, vformat(tooltip, ScriptServer::get_global_class_path(p_type)));
if (is_tool) {
int button_index = r_item->get_button_count(0) - 1;
r_item->set_button_color(0, button_index, get_theme_color(SNAME("accent_color"), EditorStringName(Editor)));