2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_file_system.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#ifndef EDITOR_FILE_SYSTEM_H
|
|
|
|
#define EDITOR_FILE_SYSTEM_H
|
|
|
|
|
2021-06-11 14:51:48 +02:00
|
|
|
#include "core/io/dir_access.h"
|
2024-06-02 01:52:28 +02:00
|
|
|
#include "core/io/resource_importer.h"
|
|
|
|
#include "core/io/resource_loader.h"
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/os/thread.h"
|
|
|
|
#include "core/os/thread_safe.h"
|
2022-05-19 17:00:06 +02:00
|
|
|
#include "core/templates/hash_set.h"
|
2021-02-10 19:22:13 +01:00
|
|
|
#include "core/templates/safe_refcount.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/main/node.h"
|
2021-03-25 00:44:13 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class FileAccess;
|
|
|
|
|
2016-05-04 22:41:58 +02:00
|
|
|
struct EditorProgressBG;
|
2014-02-10 02:10:30 +01:00
|
|
|
class EditorFileSystemDirectory : public Object {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(EditorFileSystemDirectory, Object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
String name;
|
2016-01-05 14:36:24 +01:00
|
|
|
uint64_t modified_time;
|
2022-02-15 15:56:58 +01:00
|
|
|
bool verified = false; //used for checking changes
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
EditorFileSystemDirectory *parent = nullptr;
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<EditorFileSystemDirectory *> subdirs;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
struct FileInfo {
|
|
|
|
String file;
|
2015-08-24 01:15:56 +02:00
|
|
|
StringName type;
|
2023-01-19 19:12:25 +01:00
|
|
|
StringName resource_script_class; // If any resource has script with a global class name, its found here.
|
2021-07-23 21:01:18 +02:00
|
|
|
ResourceUID::ID uid = ResourceUID::INVALID_ID;
|
2020-11-24 10:12:55 +01:00
|
|
|
uint64_t modified_time = 0;
|
|
|
|
uint64_t import_modified_time = 0;
|
|
|
|
bool import_valid = false;
|
2019-04-19 20:54:33 +02:00
|
|
|
String import_group_file;
|
2017-02-01 13:45:45 +01:00
|
|
|
Vector<String> deps;
|
2020-11-24 10:12:55 +01:00
|
|
|
bool verified = false; //used for checking changes
|
2023-01-19 19:12:25 +01:00
|
|
|
// These are for script resources only.
|
2018-07-16 00:29:00 +02:00
|
|
|
String script_class_name;
|
|
|
|
String script_class_extends;
|
2018-07-29 05:36:43 +02:00
|
|
|
String script_class_icon_path;
|
2024-06-14 06:13:45 +02:00
|
|
|
String icon_path;
|
2016-01-05 14:36:24 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<FileInfo *> files;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
friend class EditorFileSystem;
|
2014-11-12 15:23:23 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
public:
|
|
|
|
String get_name();
|
|
|
|
String get_path() const;
|
|
|
|
|
|
|
|
int get_subdir_count() const;
|
|
|
|
EditorFileSystemDirectory *get_subdir(int p_idx);
|
|
|
|
int get_file_count() const;
|
|
|
|
String get_file(int p_idx) const;
|
|
|
|
String get_file_path(int p_idx) const;
|
2015-08-24 01:15:56 +02:00
|
|
|
StringName get_file_type(int p_idx) const;
|
2023-01-19 19:12:25 +01:00
|
|
|
StringName get_file_resource_script_class(int p_idx) const;
|
2015-08-24 01:15:56 +02:00
|
|
|
Vector<String> get_file_deps(int p_idx) const;
|
2017-08-30 01:17:34 +02:00
|
|
|
bool get_file_import_is_valid(int p_idx) const;
|
2020-10-22 23:38:41 +02:00
|
|
|
uint64_t get_file_modified_time(int p_idx) const;
|
2023-11-16 14:53:09 +01:00
|
|
|
uint64_t get_file_import_modified_time(int p_idx) const;
|
2018-07-16 00:29:00 +02:00
|
|
|
String get_file_script_class_name(int p_idx) const; //used for scripts
|
|
|
|
String get_file_script_class_extends(int p_idx) const; //used for scripts
|
2018-07-29 05:36:43 +02:00
|
|
|
String get_file_script_class_icon_path(int p_idx) const; //used for scripts
|
2024-06-14 06:13:45 +02:00
|
|
|
String get_file_icon_path(int p_idx) const; //used for FileSystemDock
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
EditorFileSystemDirectory *get_parent();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int find_file_index(const String &p_file) const;
|
|
|
|
int find_dir_index(const String &p_dir) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-02-27 21:43:26 +01:00
|
|
|
void force_update();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
EditorFileSystemDirectory();
|
|
|
|
~EditorFileSystemDirectory();
|
|
|
|
};
|
|
|
|
|
2022-03-31 22:00:17 +02:00
|
|
|
class EditorFileSystemImportFormatSupportQuery : public RefCounted {
|
|
|
|
GDCLASS(EditorFileSystemImportFormatSupportQuery, RefCounted);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
GDVIRTUAL0RC(bool, _is_active)
|
|
|
|
GDVIRTUAL0RC(Vector<String>, _get_file_extensions)
|
|
|
|
GDVIRTUAL0RC(bool, _query)
|
|
|
|
static void _bind_methods() {
|
|
|
|
GDVIRTUAL_BIND(_is_active);
|
|
|
|
GDVIRTUAL_BIND(_get_file_extensions);
|
|
|
|
GDVIRTUAL_BIND(_query);
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual bool is_active() const {
|
|
|
|
bool ret = false;
|
|
|
|
GDVIRTUAL_REQUIRED_CALL(_is_active, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
virtual Vector<String> get_file_extensions() const {
|
|
|
|
Vector<String> ret;
|
|
|
|
GDVIRTUAL_REQUIRED_CALL(_get_file_extensions, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
virtual bool query() {
|
|
|
|
bool ret = false;
|
|
|
|
GDVIRTUAL_REQUIRED_CALL(_query, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class EditorFileSystem : public Node {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(EditorFileSystem, Node);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_THREAD_SAFE_CLASS_
|
|
|
|
|
2016-01-05 14:36:24 +01:00
|
|
|
struct ItemAction {
|
|
|
|
enum Action {
|
|
|
|
ACTION_NONE,
|
|
|
|
ACTION_DIR_ADD,
|
|
|
|
ACTION_DIR_REMOVE,
|
|
|
|
ACTION_FILE_ADD,
|
|
|
|
ACTION_FILE_REMOVE,
|
2018-11-21 01:47:48 +01:00
|
|
|
ACTION_FILE_TEST_REIMPORT,
|
|
|
|
ACTION_FILE_RELOAD
|
2016-01-05 14:36:24 +01:00
|
|
|
};
|
|
|
|
|
2020-11-24 10:12:55 +01:00
|
|
|
Action action = ACTION_NONE;
|
|
|
|
EditorFileSystemDirectory *dir = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
String file;
|
2020-11-24 10:12:55 +01:00
|
|
|
EditorFileSystemDirectory *new_dir = nullptr;
|
|
|
|
EditorFileSystemDirectory::FileInfo *new_file = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2024-05-24 07:30:16 +02:00
|
|
|
struct ScannedDirectory {
|
|
|
|
String name;
|
|
|
|
String full_path;
|
|
|
|
Vector<ScannedDirectory *> subdirs;
|
|
|
|
List<String> files;
|
|
|
|
|
|
|
|
~ScannedDirectory();
|
|
|
|
};
|
|
|
|
|
2023-12-01 19:39:09 +01:00
|
|
|
bool use_threads = false;
|
2021-01-19 13:29:41 +01:00
|
|
|
Thread thread;
|
2014-02-10 02:10:30 +01:00
|
|
|
static void _thread_func(void *_userdata);
|
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
EditorFileSystemDirectory *new_filesystem = nullptr;
|
2024-05-24 07:30:16 +02:00
|
|
|
ScannedDirectory *first_scan_root_dir = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-02-15 15:56:58 +01:00
|
|
|
bool scanning = false;
|
|
|
|
bool importing = false;
|
|
|
|
bool first_scan = true;
|
|
|
|
bool scan_changes_pending = false;
|
2016-01-05 14:36:24 +01:00
|
|
|
float scan_total;
|
2019-02-26 22:43:37 +01:00
|
|
|
String filesystem_settings_version_for_import;
|
2022-02-15 15:56:58 +01:00
|
|
|
bool revalidate_import_files = false;
|
2024-05-24 07:30:16 +02:00
|
|
|
int nb_files_total = 0;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-01-05 14:36:24 +01:00
|
|
|
void _scan_filesystem();
|
2024-05-24 07:30:16 +02:00
|
|
|
void _first_scan_filesystem();
|
2024-07-05 16:16:36 +02:00
|
|
|
void _first_scan_process_scripts(const ScannedDirectory *p_scan_dir, HashSet<String> &p_existing_class_names, HashSet<String> &p_extensions);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<String> late_update_files;
|
2017-08-17 22:02:43 +02:00
|
|
|
|
|
|
|
void _save_late_updated_files();
|
|
|
|
|
2022-04-04 15:06:57 +02:00
|
|
|
EditorFileSystemDirectory *filesystem = nullptr;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
static EditorFileSystem *singleton;
|
|
|
|
|
2016-01-05 14:36:24 +01:00
|
|
|
/* Used for reading the filesystem cache file */
|
2014-02-10 02:10:30 +01:00
|
|
|
struct FileCache {
|
|
|
|
String type;
|
2023-01-19 19:12:25 +01:00
|
|
|
String resource_script_class;
|
2021-07-23 21:01:18 +02:00
|
|
|
ResourceUID::ID uid = ResourceUID::INVALID_ID;
|
2020-11-24 10:12:55 +01:00
|
|
|
uint64_t modification_time = 0;
|
|
|
|
uint64_t import_modification_time = 0;
|
2015-08-24 01:15:56 +02:00
|
|
|
Vector<String> deps;
|
2020-11-24 10:12:55 +01:00
|
|
|
bool import_valid = false;
|
2019-04-19 20:54:33 +02:00
|
|
|
String import_group_file;
|
2018-07-16 00:29:00 +02:00
|
|
|
String script_class_name;
|
|
|
|
String script_class_extends;
|
2018-07-29 05:36:43 +02:00
|
|
|
String script_class_icon_path;
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
HashMap<String, FileCache> file_cache;
|
2024-05-15 16:26:33 +02:00
|
|
|
HashSet<String> dep_update_list;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-01-05 14:36:24 +01:00
|
|
|
struct ScanProgress {
|
2024-06-11 11:46:35 +02:00
|
|
|
float hi = 0;
|
2024-05-24 07:30:16 +02:00
|
|
|
int current = 0;
|
|
|
|
EditorProgressBG *progress = nullptr;
|
|
|
|
void increment();
|
2016-01-05 14:36:24 +01:00
|
|
|
};
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2024-06-20 00:46:14 +02:00
|
|
|
struct DirectoryComparator {
|
|
|
|
bool operator()(const EditorFileSystemDirectory *p_a, const EditorFileSystemDirectory *p_b) const {
|
|
|
|
return p_a->name.filenocasecmp_to(p_b->name) < 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-02-01 13:45:45 +01:00
|
|
|
void _save_filesystem_cache();
|
2022-03-23 10:08:58 +01:00
|
|
|
void _save_filesystem_cache(EditorFileSystemDirectory *p_dir, Ref<FileAccess> p_file);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool _find_file(const String &p_file, EditorFileSystemDirectory **r_d, int &r_file_pos) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2024-05-24 07:30:16 +02:00
|
|
|
void _scan_fs_changes(EditorFileSystemDirectory *p_dir, ScanProgress &p_progress);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2024-02-15 17:25:58 +01:00
|
|
|
void _delete_internal_files(const String &p_file);
|
2024-05-24 07:30:16 +02:00
|
|
|
int _insert_actions_delete_files_directory(EditorFileSystemDirectory *p_dir);
|
2017-08-15 01:13:14 +02:00
|
|
|
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<String> textfile_extensions;
|
2024-09-05 11:12:59 +02:00
|
|
|
HashSet<String> other_file_extensions;
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<String> valid_extensions;
|
|
|
|
HashSet<String> import_extensions;
|
2016-01-05 14:36:24 +01:00
|
|
|
|
2024-05-24 07:30:16 +02:00
|
|
|
int _scan_new_dir(ScannedDirectory *p_dir, Ref<DirAccess> &da);
|
2024-08-23 00:44:54 +02:00
|
|
|
void _process_file_system(const ScannedDirectory *p_scan_dir, EditorFileSystemDirectory *p_dir, ScanProgress &p_progress, HashSet<String> *p_processed_files);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-01-19 13:29:41 +01:00
|
|
|
Thread thread_sources;
|
2022-02-15 15:56:58 +01:00
|
|
|
bool scanning_changes = false;
|
2024-02-09 13:47:13 +01:00
|
|
|
SafeFlag scanning_changes_done;
|
2016-01-05 14:36:24 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
static void _thread_func_sources(void *_userdata);
|
2016-01-05 14:36:24 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
List<String> sources_changed;
|
2016-01-05 14:36:24 +01:00
|
|
|
List<ItemAction> scan_actions;
|
|
|
|
|
2024-06-11 11:46:35 +02:00
|
|
|
bool _update_scan_actions();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-02-01 13:45:45 +01:00
|
|
|
void _update_extensions();
|
|
|
|
|
2024-06-02 01:52:28 +02:00
|
|
|
Error _reimport_file(const String &p_file, const HashMap<StringName, Variant> &p_custom_options = HashMap<StringName, Variant>(), const String &p_custom_importer = String(), Variant *generator_parameters = nullptr, bool p_update_file_system = true);
|
2019-04-19 20:54:33 +02:00
|
|
|
Error _reimport_group(const String &p_group_file, const Vector<String> &p_files);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-11-24 17:39:41 +01:00
|
|
|
bool _test_for_reimport(const String &p_path, bool p_only_imported_files);
|
2017-02-02 00:41:05 +01:00
|
|
|
|
|
|
|
bool reimport_on_missing_imported_files;
|
|
|
|
|
2017-08-17 22:02:43 +02:00
|
|
|
Vector<String> _get_dependencies(const String &p_path);
|
|
|
|
|
2017-09-21 01:59:19 +02:00
|
|
|
struct ImportFile {
|
|
|
|
String path;
|
2021-03-25 00:44:13 +01:00
|
|
|
String importer;
|
|
|
|
bool threaded = false;
|
2020-11-24 10:12:55 +01:00
|
|
|
int order = 0;
|
2017-09-21 01:59:19 +02:00
|
|
|
bool operator<(const ImportFile &p_if) const {
|
2021-03-25 00:44:13 +01:00
|
|
|
return order == p_if.order ? (importer < p_if.importer) : (order < p_if.order);
|
2017-09-21 01:59:19 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-05-24 07:30:16 +02:00
|
|
|
struct ScriptInfo {
|
|
|
|
String type;
|
|
|
|
String script_class_name;
|
|
|
|
String script_class_extends;
|
|
|
|
String script_class_icon_path;
|
|
|
|
};
|
|
|
|
|
2023-01-18 17:32:28 +01:00
|
|
|
Mutex update_script_mutex;
|
2024-05-24 07:30:16 +02:00
|
|
|
HashMap<String, ScriptInfo> update_script_paths;
|
|
|
|
HashSet<String> update_script_paths_documentation;
|
|
|
|
void _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);
|
2024-06-11 11:46:35 +02:00
|
|
|
void _update_script_classes();
|
2024-05-24 07:30:16 +02:00
|
|
|
void _update_script_documentation();
|
|
|
|
void _process_update_pending();
|
2024-08-23 00:44:54 +02:00
|
|
|
void _process_removed_files(const HashSet<String> &p_processed_files);
|
2018-07-16 00:29:00 +02:00
|
|
|
|
2022-05-12 10:20:12 +02:00
|
|
|
Mutex update_scene_mutex;
|
|
|
|
HashSet<String> update_scene_paths;
|
|
|
|
void _queue_update_scene_groups(const String &p_path);
|
|
|
|
void _update_scene_groups();
|
|
|
|
void _update_pending_scene_groups();
|
|
|
|
void _get_all_scenes(EditorFileSystemDirectory *p_dir, HashSet<String> &r_list);
|
|
|
|
|
2018-07-29 05:36:43 +02:00
|
|
|
String _get_global_script_class(const String &p_type, const String &p_path, String *r_extends, String *r_icon_path) const;
|
2018-07-16 00:29:00 +02:00
|
|
|
|
2018-10-05 04:00:02 +02:00
|
|
|
static Error _resource_import(const String &p_path);
|
2024-06-02 01:52:28 +02:00
|
|
|
static Ref<Resource> _load_resource_on_startup(ResourceFormatImporter *p_importer, const String &p_path, Error *r_error, bool p_use_sub_threads, float *r_progress, ResourceFormatLoader::CacheMode p_cache_mode);
|
2018-10-05 04:00:02 +02:00
|
|
|
|
2019-04-27 16:50:26 +02:00
|
|
|
bool using_fat32_or_exfat; // Workaround for projects in FAT32 or exFAT filesystem (pendrives, most of the time)
|
2019-01-21 19:23:08 +01:00
|
|
|
|
2022-05-19 17:00:06 +02:00
|
|
|
void _find_group_files(EditorFileSystemDirectory *efd, HashMap<String, Vector<String>> &group_files, HashSet<String> &groups_to_reimport);
|
2019-04-19 20:54:33 +02:00
|
|
|
|
|
|
|
void _move_group_files(EditorFileSystemDirectory *efd, const String &p_group_file, const String &p_new_location);
|
|
|
|
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<String> group_file_cache;
|
2024-06-14 06:13:45 +02:00
|
|
|
HashMap<String, String> file_icon_cache;
|
2019-04-19 20:54:33 +02:00
|
|
|
|
2021-03-25 00:44:13 +01:00
|
|
|
struct ImportThreadData {
|
|
|
|
const ImportFile *reimport_files;
|
|
|
|
int reimport_from;
|
2023-11-24 07:58:41 +01:00
|
|
|
SafeNumeric<int> max_index;
|
2021-03-25 00:44:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
void _reimport_thread(uint32_t p_index, ImportThreadData *p_import_data);
|
|
|
|
|
2021-07-23 21:01:18 +02:00
|
|
|
static ResourceUID::ID _resource_saver_get_resource_id_for_path(const String &p_path, bool p_generate);
|
|
|
|
|
2021-08-20 20:32:56 +02:00
|
|
|
bool _scan_extensions();
|
2024-02-15 17:25:58 +01:00
|
|
|
bool _scan_import_support(const Vector<String> &reimports);
|
2022-03-31 22:00:17 +02:00
|
|
|
|
|
|
|
Vector<Ref<EditorFileSystemImportFormatSupportQuery>> import_support_queries;
|
2021-08-20 20:32:56 +02:00
|
|
|
|
2024-06-14 06:13:45 +02:00
|
|
|
void _update_file_icon_path(EditorFileSystemDirectory::FileInfo *file_info);
|
|
|
|
void _update_files_icon_path(EditorFileSystemDirectory *edp = nullptr);
|
2024-05-24 07:30:16 +02:00
|
|
|
void _remove_invalid_global_class_names(const HashSet<String> &p_existing_class_names);
|
|
|
|
String _get_file_by_class_name(EditorFileSystemDirectory *p_dir, const String &p_class_name, EditorFileSystemDirectory::FileInfo *&r_file_info);
|
|
|
|
|
|
|
|
void _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);
|
2024-06-14 06:13:45 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
protected:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
|
|
|
static EditorFileSystem *get_singleton() { return singleton; }
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
EditorFileSystemDirectory *get_filesystem();
|
|
|
|
bool is_scanning() const;
|
2017-02-06 04:38:39 +01:00
|
|
|
bool is_importing() const { return importing; }
|
2024-04-09 11:20:43 +02:00
|
|
|
bool doing_first_scan() const { return first_scan; }
|
2014-02-10 02:10:30 +01:00
|
|
|
float get_scanning_progress() const;
|
|
|
|
void scan();
|
2017-02-01 13:45:45 +01:00
|
|
|
void scan_changes();
|
2017-03-05 16:44:50 +01:00
|
|
|
void update_file(const String &p_file);
|
2024-06-08 04:54:47 +02:00
|
|
|
void update_files(const Vector<String> &p_script_paths);
|
2022-05-19 17:00:06 +02:00
|
|
|
HashSet<String> get_valid_extensions() const;
|
2024-05-01 00:26:42 +02:00
|
|
|
void register_global_class_script(const String &p_search_path, const String &p_target_path);
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorFileSystemDirectory *get_filesystem_path(const String &p_path);
|
|
|
|
String get_file_type(const String &p_file) const;
|
|
|
|
EditorFileSystemDirectory *find_file(const String &p_file, int *r_index) const;
|
2016-07-03 18:15:15 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void reimport_files(const Vector<String> &p_files);
|
2023-02-02 22:41:04 +01:00
|
|
|
Error reimport_append(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters);
|
2017-02-01 13:45:45 +01:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
void reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const HashMap<StringName, Variant> &p_custom_params);
|
2021-03-19 13:57:52 +01:00
|
|
|
|
2019-04-19 20:54:33 +02:00
|
|
|
bool is_group_file(const String &p_path) const;
|
|
|
|
void move_group_file(const String &p_path, const String &p_new_path);
|
|
|
|
|
2024-09-16 15:52:51 +02:00
|
|
|
Error make_dir_recursive(const String &p_path, const String &p_base_path = String());
|
2024-06-20 00:46:14 +02:00
|
|
|
|
2021-02-22 06:34:27 +01:00
|
|
|
static bool _should_skip_directory(const String &p_path);
|
|
|
|
|
2022-03-31 22:00:17 +02:00
|
|
|
void add_import_format_support_query(Ref<EditorFileSystemImportFormatSupportQuery> p_query);
|
|
|
|
void remove_import_format_support_query(Ref<EditorFileSystemImportFormatSupportQuery> p_query);
|
2014-02-10 02:10:30 +01:00
|
|
|
EditorFileSystem();
|
|
|
|
~EditorFileSystem();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_FILE_SYSTEM_H
|