|
@@ -49,7 +49,7 @@
|
|
|
|
|
|
EditorFileSystem *EditorFileSystem::singleton = nullptr;
|
|
|
//the name is the version, to keep compatibility with different versions of Godot
|
|
|
-#define CACHE_FILE_NAME "filesystem_cache8"
|
|
|
+#define CACHE_FILE_NAME "filesystem_cache10"
|
|
|
|
|
|
int EditorFileSystemDirectory::find_file_index(const String &p_file) const {
|
|
|
for (int i = 0; i < files.size(); i++) {
|
|
@@ -166,19 +166,19 @@ uint64_t EditorFileSystemDirectory::get_file_import_modified_time(int p_idx) con
|
|
|
}
|
|
|
|
|
|
String EditorFileSystemDirectory::get_file_script_class_name(int p_idx) const {
|
|
|
- return files[p_idx]->script_class_name;
|
|
|
+ return files[p_idx]->class_info.name;
|
|
|
}
|
|
|
|
|
|
String EditorFileSystemDirectory::get_file_script_class_extends(int p_idx) const {
|
|
|
- return files[p_idx]->script_class_extends;
|
|
|
+ return files[p_idx]->class_info.extends;
|
|
|
}
|
|
|
|
|
|
String EditorFileSystemDirectory::get_file_script_class_icon_path(int p_idx) const {
|
|
|
- return files[p_idx]->script_class_icon_path;
|
|
|
+ return files[p_idx]->class_info.icon_path;
|
|
|
}
|
|
|
|
|
|
String EditorFileSystemDirectory::get_file_icon_path(int p_idx) const {
|
|
|
- return files[p_idx]->icon_path;
|
|
|
+ return files[p_idx]->class_info.icon_path;
|
|
|
}
|
|
|
|
|
|
StringName EditorFileSystemDirectory::get_file_type(int p_idx) const {
|
|
@@ -303,13 +303,13 @@ void EditorFileSystem::_first_scan_process_scripts(const ScannedDirectory *p_sca
|
|
|
const String type = ResourceLoader::get_resource_type(path);
|
|
|
|
|
|
if (ClassDB::is_parent_class(type, SNAME("Script"))) {
|
|
|
- String script_class_extends;
|
|
|
- String script_class_icon_path;
|
|
|
- String script_class_name = _get_global_script_class(type, path, &script_class_extends, &script_class_icon_path);
|
|
|
- _register_global_class_script(path, path, type, script_class_name, script_class_extends, script_class_icon_path);
|
|
|
+ const ScriptClassInfo &info = _get_global_script_class(type, path);
|
|
|
+ ScriptClassInfoUpdate update(info);
|
|
|
+ update.type = type;
|
|
|
+ _register_global_class_script(path, path, update);
|
|
|
|
|
|
- if (!script_class_name.is_empty()) {
|
|
|
- p_existing_class_names.insert(script_class_name);
|
|
|
+ if (!info.name.is_empty()) {
|
|
|
+ p_existing_class_names.insert(info.name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -392,12 +392,14 @@ void EditorFileSystem::_scan_filesystem() {
|
|
|
fc.import_group_file = split[6].strip_edges();
|
|
|
{
|
|
|
const Vector<String> &slices = split[7].split("<>");
|
|
|
- ERR_CONTINUE(slices.size() < 5);
|
|
|
- fc.script_class_name = slices[0];
|
|
|
- fc.script_class_extends = slices[1];
|
|
|
- fc.script_class_icon_path = slices[2];
|
|
|
- fc.import_md5 = slices[3];
|
|
|
- fc.import_dest_paths = slices[4].split("<*>");
|
|
|
+ ERR_CONTINUE(slices.size() < 7);
|
|
|
+ fc.class_info.name = slices[0];
|
|
|
+ fc.class_info.extends = slices[1];
|
|
|
+ fc.class_info.icon_path = slices[2];
|
|
|
+ fc.class_info.is_abstract = slices[3].to_int();
|
|
|
+ fc.class_info.is_tool = slices[4].to_int();
|
|
|
+ fc.import_md5 = slices[5];
|
|
|
+ fc.import_dest_paths = slices[6].split("<*>");
|
|
|
}
|
|
|
fc.deps = split[8].strip_edges().split("<>");
|
|
|
|
|
@@ -849,7 +851,7 @@ bool EditorFileSystem::_update_scan_actions() {
|
|
|
}
|
|
|
|
|
|
if (ClassDB::is_parent_class(ia.new_file->type, SNAME("Script"))) {
|
|
|
- _queue_update_script_class(new_file_path, ia.new_file->type, ia.new_file->script_class_name, ia.new_file->script_class_extends, ia.new_file->script_class_icon_path);
|
|
|
+ _queue_update_script_class(new_file_path, ScriptClassInfoUpdate::from_file_info(ia.new_file));
|
|
|
}
|
|
|
if (ia.new_file->type == SNAME("PackedScene")) {
|
|
|
_queue_update_scene_groups(new_file_path);
|
|
@@ -860,9 +862,9 @@ bool EditorFileSystem::_update_scan_actions() {
|
|
|
int idx = ia.dir->find_file_index(ia.file);
|
|
|
ERR_CONTINUE(idx == -1);
|
|
|
|
|
|
- String script_class_name = ia.dir->files[idx]->script_class_name;
|
|
|
+ String class_name = ia.dir->files[idx]->class_info.name;
|
|
|
if (ClassDB::is_parent_class(ia.dir->files[idx]->type, SNAME("Script"))) {
|
|
|
- _queue_update_script_class(ia.dir->get_file_path(idx), "", "", "", "");
|
|
|
+ _queue_update_script_class(ia.dir->get_file_path(idx), ScriptClassInfoUpdate());
|
|
|
}
|
|
|
if (ia.dir->files[idx]->type == SNAME("PackedScene")) {
|
|
|
_queue_update_scene_groups(ia.dir->get_file_path(idx));
|
|
@@ -873,11 +875,11 @@ bool EditorFileSystem::_update_scan_actions() {
|
|
|
ia.dir->files.remove_at(idx);
|
|
|
|
|
|
// Restore another script with the same global class name if it exists.
|
|
|
- if (!script_class_name.is_empty()) {
|
|
|
+ if (!class_name.is_empty()) {
|
|
|
EditorFileSystemDirectory::FileInfo *old_fi = nullptr;
|
|
|
- String old_file = _get_file_by_class_name(filesystem, script_class_name, old_fi);
|
|
|
+ String old_file = _get_file_by_class_name(filesystem, class_name, old_fi);
|
|
|
if (!old_file.is_empty() && old_fi) {
|
|
|
- _queue_update_script_class(old_file, old_fi->type, old_fi->script_class_name, old_fi->script_class_extends, old_fi->script_class_icon_path);
|
|
|
+ _queue_update_script_class(old_file, ScriptClassInfoUpdate::from_file_info(old_fi));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1151,10 +1153,8 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
|
|
fi->import_md5 = fc->import_md5;
|
|
|
fi->import_dest_paths = fc->import_dest_paths;
|
|
|
fi->import_valid = fc->import_valid;
|
|
|
- fi->script_class_name = fc->script_class_name;
|
|
|
fi->import_group_file = fc->import_group_file;
|
|
|
- fi->script_class_extends = fc->script_class_extends;
|
|
|
- fi->script_class_icon_path = fc->script_class_icon_path;
|
|
|
+ fi->class_info = fc->class_info;
|
|
|
|
|
|
// Ensures backward compatibility when the project is loaded for the first time with the added import_md5
|
|
|
// and import_dest_paths properties in the file cache.
|
|
@@ -1192,7 +1192,7 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
|
|
} else {
|
|
|
// Using get_resource_import_info() to prevent calling 3 times ResourceFormatImporter::_get_path_and_type.
|
|
|
ResourceFormatImporter::get_singleton()->get_resource_import_info(path, fi->type, fi->uid, fi->import_group_file);
|
|
|
- fi->script_class_name = _get_global_script_class(fi->type, path, &fi->script_class_extends, &fi->script_class_icon_path);
|
|
|
+ fi->class_info = _get_global_script_class(fi->type, path);
|
|
|
fi->modified_time = 0;
|
|
|
fi->import_modified_time = 0;
|
|
|
fi->import_md5 = "";
|
|
@@ -1217,22 +1217,20 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
|
|
fi->import_md5 = "";
|
|
|
fi->import_dest_paths = Vector<String>();
|
|
|
fi->import_valid = true;
|
|
|
- fi->script_class_name = fc->script_class_name;
|
|
|
- fi->script_class_extends = fc->script_class_extends;
|
|
|
- fi->script_class_icon_path = fc->script_class_icon_path;
|
|
|
+ fi->class_info = fc->class_info;
|
|
|
|
|
|
if (first_scan && ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
|
|
|
bool update_script = false;
|
|
|
- String old_class_name = fi->script_class_name;
|
|
|
- fi->script_class_name = _get_global_script_class(fi->type, path, &fi->script_class_extends, &fi->script_class_icon_path);
|
|
|
- if (old_class_name != fi->script_class_name) {
|
|
|
+ String old_class_name = fi->class_info.name;
|
|
|
+ fi->class_info = _get_global_script_class(fi->type, path);
|
|
|
+ if (old_class_name != fi->class_info.name) {
|
|
|
update_script = true;
|
|
|
- } else if (!fi->script_class_name.is_empty() && (!ScriptServer::is_global_class(fi->script_class_name) || ScriptServer::get_global_class_path(fi->script_class_name) != path)) {
|
|
|
+ } else if (!fi->class_info.name.is_empty() && (!ScriptServer::is_global_class(fi->class_info.name) || ScriptServer::get_global_class_path(fi->class_info.name) != path)) {
|
|
|
// This script has a class name but is not in the global class names or the path of the class has changed.
|
|
|
update_script = true;
|
|
|
}
|
|
|
if (update_script) {
|
|
|
- _queue_update_script_class(path, fi->type, fi->script_class_name, fi->script_class_extends, fi->script_class_icon_path);
|
|
|
+ _queue_update_script_class(path, ScriptClassInfoUpdate::from_file_info(fi));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -1246,7 +1244,7 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
|
|
fi->type = "OtherFile";
|
|
|
}
|
|
|
fi->uid = ResourceLoader::get_resource_uid(path);
|
|
|
- fi->script_class_name = _get_global_script_class(fi->type, path, &fi->script_class_extends, &fi->script_class_icon_path);
|
|
|
+ fi->class_info = _get_global_script_class(fi->type, path);
|
|
|
fi->deps = _get_dependencies(path);
|
|
|
fi->modified_time = mt;
|
|
|
fi->import_modified_time = 0;
|
|
@@ -1257,7 +1255,7 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir,
|
|
|
// Files in dep_update_list are forced for rescan to update dependencies. They don't need other updates.
|
|
|
if (!dep_update_list.has(path)) {
|
|
|
if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
|
|
|
- _queue_update_script_class(path, fi->type, fi->script_class_name, fi->script_class_extends, fi->script_class_icon_path);
|
|
|
+ _queue_update_script_class(path, ScriptClassInfoUpdate::from_file_info(fi));
|
|
|
}
|
|
|
if (fi->type == SNAME("PackedScene")) {
|
|
|
_queue_update_scene_groups(path);
|
|
@@ -1418,7 +1416,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, ScanPr
|
|
|
if (fi->type == "" && other_file_extensions.has(ext)) {
|
|
|
fi->type = "OtherFile";
|
|
|
}
|
|
|
- fi->script_class_name = _get_global_script_class(fi->type, path, &fi->script_class_extends, &fi->script_class_icon_path);
|
|
|
+ fi->class_info = _get_global_script_class(fi->type, path);
|
|
|
fi->import_valid = (fi->type == "TextFile" || fi->type == "OtherFile") ? true : ResourceLoader::is_import_valid(path);
|
|
|
fi->import_group_file = ResourceLoader::get_import_group_file(path);
|
|
|
|
|
@@ -1577,7 +1575,7 @@ void EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String>
|
|
|
|
|
|
String EditorFileSystem::_get_file_by_class_name(EditorFileSystemDirectory *p_dir, const String &p_class_name, EditorFileSystemDirectory::FileInfo *&r_file_info) {
|
|
|
for (EditorFileSystemDirectory::FileInfo *fi : p_dir->files) {
|
|
|
- if (fi->script_class_name == p_class_name) {
|
|
|
+ if (fi->class_info.name == p_class_name) {
|
|
|
r_file_info = fi;
|
|
|
return p_dir->get_path().path_join(fi->file);
|
|
|
}
|
|
@@ -1758,7 +1756,7 @@ void EditorFileSystem::_save_filesystem_cache(EditorFileSystemDirectory *p_dir,
|
|
|
cache_string.append(itos(file_info->import_modified_time));
|
|
|
cache_string.append(itos(file_info->import_valid));
|
|
|
cache_string.append(file_info->import_group_file);
|
|
|
- cache_string.append(String("<>").join({ file_info->script_class_name, file_info->script_class_extends, file_info->script_class_icon_path, file_info->import_md5, String("<*>").join(file_info->import_dest_paths) }));
|
|
|
+ cache_string.append(String("<>").join({ file_info->class_info.name, file_info->class_info.extends, file_info->class_info.icon_path, itos(file_info->class_info.is_abstract), itos(file_info->class_info.is_tool), file_info->import_md5, String("<*>").join(file_info->import_dest_paths) }));
|
|
|
cache_string.append(String("<>").join(file_info->deps));
|
|
|
|
|
|
p_file->store_line(String("::").join(cache_string));
|
|
@@ -1970,29 +1968,21 @@ Vector<String> EditorFileSystem::_get_dependencies(const String &p_path) {
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-String EditorFileSystem::_get_global_script_class(const String &p_type, const String &p_path, String *r_extends, String *r_icon_path) const {
|
|
|
+EditorFileSystem::ScriptClassInfo EditorFileSystem::_get_global_script_class(const String &p_type, const String &p_path) const {
|
|
|
+ ScriptClassInfo info;
|
|
|
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
|
|
if (ScriptServer::get_language(i)->handles_global_class_type(p_type)) {
|
|
|
- String global_name;
|
|
|
- String extends;
|
|
|
- String icon_path;
|
|
|
-
|
|
|
- global_name = ScriptServer::get_language(i)->get_global_class_name(p_path, &extends, &icon_path);
|
|
|
- *r_extends = extends;
|
|
|
- *r_icon_path = icon_path;
|
|
|
- return global_name;
|
|
|
+ info.name = ScriptServer::get_language(i)->get_global_class_name(p_path, &info.extends, &info.icon_path, &info.is_abstract, &info.is_tool);
|
|
|
}
|
|
|
}
|
|
|
- *r_extends = String();
|
|
|
- *r_icon_path = String();
|
|
|
- return String();
|
|
|
+ return info;
|
|
|
}
|
|
|
|
|
|
void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInfo *file_info) {
|
|
|
String icon_path;
|
|
|
if (file_info->resource_script_class != StringName()) {
|
|
|
icon_path = EditorNode::get_editor_data().script_class_get_icon_path(file_info->resource_script_class);
|
|
|
- } else if (file_info->script_class_icon_path.is_empty() && !file_info->deps.is_empty()) {
|
|
|
+ } else if (file_info->class_info.icon_path.is_empty() && !file_info->deps.is_empty()) {
|
|
|
const String &script_dep = file_info->deps[0]; // Assuming the first dependency is a script.
|
|
|
const String &script_path = script_dep.contains("::") ? script_dep.get_slice("::", 2) : script_dep;
|
|
|
if (!script_path.is_empty()) {
|
|
@@ -2004,7 +1994,7 @@ void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInf
|
|
|
int script_file;
|
|
|
EditorFileSystemDirectory *efsd = find_file(script_path, &script_file);
|
|
|
if (efsd) {
|
|
|
- icon_path = efsd->files[script_file]->script_class_icon_path;
|
|
|
+ icon_path = efsd->files[script_file]->class_info.icon_path;
|
|
|
}
|
|
|
}
|
|
|
file_icon_cache.insert(script_path, icon_path);
|
|
@@ -2019,7 +2009,7 @@ void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInf
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- file_info->icon_path = icon_path;
|
|
|
+ file_info->class_info.icon_path = icon_path;
|
|
|
}
|
|
|
|
|
|
void EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory *edp) {
|
|
@@ -2058,10 +2048,10 @@ void EditorFileSystem::_update_script_classes() {
|
|
|
}
|
|
|
|
|
|
int step_count = 0;
|
|
|
- for (const KeyValue<String, ScriptInfo> &E : update_script_paths) {
|
|
|
- _register_global_class_script(E.key, E.key, E.value.type, E.value.script_class_name, E.value.script_class_extends, E.value.script_class_icon_path);
|
|
|
+ for (const KeyValue<String, ScriptClassInfoUpdate> &E : update_script_paths) {
|
|
|
+ _register_global_class_script(E.key, E.key, E.value);
|
|
|
if (ep) {
|
|
|
- ep->step(E.value.script_class_name, step_count++, false);
|
|
|
+ ep->step(E.value.name, step_count++, false);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2171,16 +2161,10 @@ void EditorFileSystem::_process_update_pending() {
|
|
|
_update_pending_scene_groups();
|
|
|
}
|
|
|
|
|
|
-void EditorFileSystem::_queue_update_script_class(const String &p_path, const String &p_type, const String &p_script_class_name, const String &p_script_class_extends, const String &p_script_class_icon_path) {
|
|
|
+void EditorFileSystem::_queue_update_script_class(const String &p_path, const ScriptClassInfoUpdate &p_script_update) {
|
|
|
MutexLock update_script_lock(update_script_mutex);
|
|
|
|
|
|
- ScriptInfo si;
|
|
|
- si.type = p_type;
|
|
|
- si.script_class_name = p_script_class_name;
|
|
|
- si.script_class_extends = p_script_class_extends;
|
|
|
- si.script_class_icon_path = p_script_class_icon_path;
|
|
|
- update_script_paths.insert(p_path, si);
|
|
|
-
|
|
|
+ update_script_paths.insert(p_path, p_script_update);
|
|
|
update_script_paths_documentation.insert(p_path);
|
|
|
}
|
|
|
|
|
@@ -2281,8 +2265,10 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
|
|
|
}
|
|
|
}
|
|
|
if (ClassDB::is_parent_class(fs->files[cpos]->type, SNAME("Script"))) {
|
|
|
- _queue_update_script_class(file, fs->files[cpos]->type, "", "", "");
|
|
|
- if (!fs->files[cpos]->script_class_icon_path.is_empty()) {
|
|
|
+ ScriptClassInfoUpdate update;
|
|
|
+ update.type = fs->files[cpos]->type;
|
|
|
+ _queue_update_script_class(file, update);
|
|
|
+ if (!fs->files[cpos]->class_info.icon_path.is_empty()) {
|
|
|
update_files_icon_cache = true;
|
|
|
}
|
|
|
}
|
|
@@ -2339,16 +2325,16 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
|
|
|
}
|
|
|
|
|
|
EditorFileSystemDirectory::FileInfo *fi = fs->files[cpos];
|
|
|
- const String old_script_class_icon_path = fi->script_class_icon_path;
|
|
|
- const String old_class_name = fi->script_class_name;
|
|
|
+ const String old_script_class_icon_path = fi->class_info.icon_path;
|
|
|
+ const String old_class_name = fi->class_info.name;
|
|
|
fi->type = type;
|
|
|
fi->resource_script_class = script_class;
|
|
|
fi->uid = uid;
|
|
|
- fi->script_class_name = _get_global_script_class(type, file, &fi->script_class_extends, &fi->script_class_icon_path);
|
|
|
+ fi->class_info = _get_global_script_class(type, file);
|
|
|
fi->import_group_file = ResourceLoader::get_import_group_file(file);
|
|
|
fi->modified_time = FileAccess::get_modified_time(file);
|
|
|
fi->deps = _get_dependencies(file);
|
|
|
- fi->import_valid = type == "TextFile" || type == "OtherFile" || ResourceLoader::is_import_valid(file);
|
|
|
+ fi->import_valid = (type == "TextFile" || type == "OtherFile") ? true : ResourceLoader::is_import_valid(file);
|
|
|
|
|
|
if (uid != ResourceUID::INVALID_ID) {
|
|
|
if (ResourceUID::get_singleton()->has_id(uid)) {
|
|
@@ -2374,7 +2360,7 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
|
|
|
EditorResourcePreview::get_singleton()->check_for_invalidation(file);
|
|
|
|
|
|
if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
|
|
|
- _queue_update_script_class(file, fi->type, fi->script_class_name, fi->script_class_extends, fi->script_class_icon_path);
|
|
|
+ _queue_update_script_class(file, ScriptClassInfoUpdate::from_file_info(fi));
|
|
|
}
|
|
|
if (fi->type == SNAME("PackedScene")) {
|
|
|
_queue_update_scene_groups(file);
|
|
@@ -2382,16 +2368,16 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
|
|
|
|
|
|
if (ClassDB::is_parent_class(fi->type, SNAME("Resource"))) {
|
|
|
files_to_update_icon_path.push_back(fi);
|
|
|
- } else if (old_script_class_icon_path != fi->script_class_icon_path) {
|
|
|
+ } else if (old_script_class_icon_path != fi->class_info.icon_path) {
|
|
|
update_files_icon_cache = true;
|
|
|
}
|
|
|
|
|
|
// Restore another script as the global class name if multiple scripts had the same old class name.
|
|
|
- if (!old_class_name.is_empty() && fi->script_class_name != old_class_name && ClassDB::is_parent_class(type, SNAME("Script"))) {
|
|
|
+ if (!old_class_name.is_empty() && fi->class_info.name != old_class_name && ClassDB::is_parent_class(type, SNAME("Script"))) {
|
|
|
EditorFileSystemDirectory::FileInfo *old_fi = nullptr;
|
|
|
String old_file = _get_file_by_class_name(filesystem, old_class_name, old_fi);
|
|
|
if (!old_file.is_empty() && old_fi) {
|
|
|
- _queue_update_script_class(old_file, old_fi->type, old_fi->script_class_name, old_fi->script_class_extends, old_fi->script_class_icon_path);
|
|
|
+ _queue_update_script_class(old_file, ScriptClassInfoUpdate::from_file_info(old_fi));
|
|
|
}
|
|
|
}
|
|
|
updated = true;
|
|
@@ -2425,16 +2411,16 @@ HashSet<String> EditorFileSystem::get_valid_extensions() const {
|
|
|
return valid_extensions;
|
|
|
}
|
|
|
|
|
|
-void EditorFileSystem::_register_global_class_script(const String &p_search_path, const String &p_target_path, const String &p_type, const String &p_script_class_name, const String &p_script_class_extends, const String &p_script_class_icon_path) {
|
|
|
+void EditorFileSystem::_register_global_class_script(const String &p_search_path, const String &p_target_path, const ScriptClassInfoUpdate &p_script_update) {
|
|
|
ScriptServer::remove_global_class_by_path(p_search_path); // First remove, just in case it changed
|
|
|
|
|
|
- if (p_script_class_name.is_empty()) {
|
|
|
+ if (p_script_update.name.is_empty()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
String lang;
|
|
|
for (int j = 0; j < ScriptServer::get_language_count(); j++) {
|
|
|
- if (ScriptServer::get_language(j)->handles_global_class_type(p_type)) {
|
|
|
+ if (ScriptServer::get_language(j)->handles_global_class_type(p_script_update.type)) {
|
|
|
lang = ScriptServer::get_language(j)->get_name();
|
|
|
break;
|
|
|
}
|
|
@@ -2443,9 +2429,9 @@ void EditorFileSystem::_register_global_class_script(const String &p_search_path
|
|
|
return; // No lang found that can handle this global class
|
|
|
}
|
|
|
|
|
|
- ScriptServer::add_global_class(p_script_class_name, p_script_class_extends, lang, p_target_path);
|
|
|
- EditorNode::get_editor_data().script_class_set_icon_path(p_script_class_name, p_script_class_icon_path);
|
|
|
- EditorNode::get_editor_data().script_class_set_name(p_target_path, p_script_class_name);
|
|
|
+ ScriptServer::add_global_class(p_script_update.name, p_script_update.extends, lang, p_target_path, p_script_update.is_abstract, p_script_update.is_tool);
|
|
|
+ EditorNode::get_editor_data().script_class_set_icon_path(p_script_update.name, p_script_update.icon_path);
|
|
|
+ EditorNode::get_editor_data().script_class_set_name(p_target_path, p_script_update.name);
|
|
|
}
|
|
|
|
|
|
void EditorFileSystem::register_global_class_script(const String &p_search_path, const String &p_target_path) {
|
|
@@ -2453,7 +2439,7 @@ void EditorFileSystem::register_global_class_script(const String &p_search_path,
|
|
|
EditorFileSystemDirectory *efsd = find_file(p_search_path, &index_file);
|
|
|
if (efsd) {
|
|
|
const EditorFileSystemDirectory::FileInfo *fi = efsd->files[index_file];
|
|
|
- EditorFileSystem::get_singleton()->_register_global_class_script(p_search_path, p_target_path, fi->type, fi->script_class_name, fi->script_class_extends, fi->script_class_icon_path);
|
|
|
+ EditorFileSystem::get_singleton()->_register_global_class_script(p_search_path, p_target_path, ScriptClassInfoUpdate::from_file_info(fi));
|
|
|
} else {
|
|
|
ScriptServer::remove_global_class_by_path(p_search_path);
|
|
|
}
|