You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Optimize enumeration of global classes in create dialog and autocomplete
This commit is contained in:
@@ -257,14 +257,9 @@ void CreateDialog::_add_type(const StringName &p_type, TypeCategory p_type_categ
|
||||
inherits = ClassDB::get_parent_class(p_type);
|
||||
inherited_type = TypeCategory::CPP_TYPE;
|
||||
} else {
|
||||
if (p_type_category == TypeCategory::PATH_TYPE || ScriptServer::is_global_class(p_type)) {
|
||||
Ref<Script> scr;
|
||||
if (p_type_category == TypeCategory::PATH_TYPE) {
|
||||
ERR_FAIL_COND(!ResourceLoader::exists(p_type, "Script"));
|
||||
scr = ResourceLoader::load(p_type, "Script");
|
||||
} else {
|
||||
scr = EditorNode::get_editor_data().script_class_load_script(p_type);
|
||||
}
|
||||
if (p_type_category == TypeCategory::PATH_TYPE) {
|
||||
ERR_FAIL_COND(!ResourceLoader::exists(p_type, "Script"));
|
||||
Ref<Script> scr = ResourceLoader::load(p_type, "Script");
|
||||
ERR_FAIL_COND(scr.is_null());
|
||||
|
||||
Ref<Script> base = scr->get_base_script();
|
||||
@@ -286,6 +281,10 @@ void CreateDialog::_add_type(const StringName &p_type, TypeCategory p_type_categ
|
||||
inherited_type = TypeCategory::PATH_TYPE;
|
||||
}
|
||||
}
|
||||
} else if (ScriptServer::is_global_class(p_type)) {
|
||||
inherits = ScriptServer::get_global_class_base(p_type);
|
||||
bool is_native_class = ClassDB::class_exists(inherits);
|
||||
inherited_type = is_native_class ? TypeCategory::CPP_TYPE : TypeCategory::OTHER_TYPE;
|
||||
} else {
|
||||
inherits = custom_type_parents[p_type];
|
||||
if (ClassDB::class_exists(inherits)) {
|
||||
|
||||
Reference in New Issue
Block a user