| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*  editor_file_system.h                                                 */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*                       This file is part of:                           */ | 
					
						
							|  |  |  | /*                           GODOT ENGINE                                */ | 
					
						
							| 
									
										
										
										
											2017-08-27 14:16:55 +02:00
										 |  |  | /*                      https://godotengine.org                          */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2021-01-01 20:13:46 +01:00
										 |  |  | /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */ | 
					
						
							|  |  |  | /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* 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-09 22:10:30 -03:00
										 |  |  | #ifndef EDITOR_FILE_SYSTEM_H
 | 
					
						
							|  |  |  | #define EDITOR_FILE_SYSTEM_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 18:13:45 +02:00
										 |  |  | #include "core/os/dir_access.h"
 | 
					
						
							|  |  |  | #include "core/os/thread.h"
 | 
					
						
							|  |  |  | #include "core/os/thread_safe.h"
 | 
					
						
							| 
									
										
										
										
											2021-02-10 19:22:13 +01:00
										 |  |  | #include "core/templates/safe_refcount.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-07 19:33:38 -03:00
										 |  |  | #include "core/templates/set.h"
 | 
					
						
							| 
									
										
										
										
											2021-03-24 20:44:13 -03:00
										 |  |  | #include "core/templates/thread_work_pool.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | #include "scene/main/node.h"
 | 
					
						
							| 
									
										
										
										
											2021-03-24 20:44:13 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | class FileAccess; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-04 17:41:58 -03:00
										 |  |  | struct EditorProgressBG; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | class EditorFileSystemDirectory : public Object { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(EditorFileSystemDirectory, Object); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	String name; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	uint64_t modified_time; | 
					
						
							|  |  |  | 	bool verified; //used for checking changes
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	EditorFileSystemDirectory *parent; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	Vector<EditorFileSystemDirectory *> subdirs; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct FileInfo { | 
					
						
							|  |  |  | 		String file; | 
					
						
							| 
									
										
										
										
											2015-08-23 20:15:56 -03:00
										 |  |  | 		StringName type; | 
					
						
							| 
									
										
										
										
											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 15:54:33 -03:00
										 |  |  | 		String import_group_file; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 		Vector<String> deps; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		bool verified = false; //used for checking changes
 | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 		String script_class_name; | 
					
						
							|  |  |  | 		String script_class_extends; | 
					
						
							| 
									
										
										
										
											2018-07-28 22:36:43 -05:00
										 |  |  | 		String script_class_icon_path; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct FileInfoSort { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		bool operator()(const FileInfo *p_a, const FileInfo *p_b) const { | 
					
						
							|  |  |  | 			return p_a->file < p_b->file; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	void sort_files(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	Vector<FileInfo *> files; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	static void _bind_methods(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	friend class EditorFileSystem; | 
					
						
							| 
									
										
										
										
											2014-11-12 11:23:23 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03: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-23 20:15:56 -03:00
										 |  |  | 	StringName get_file_type(int p_idx) const; | 
					
						
							|  |  |  | 	Vector<String> get_file_deps(int p_idx) const; | 
					
						
							| 
									
										
										
										
											2017-08-29 20:17:34 -03: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; | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03: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-28 22:36:43 -05:00
										 |  |  | 	String get_file_script_class_icon_path(int p_idx) const; //used for scripts
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03: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-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	EditorFileSystemDirectory(); | 
					
						
							|  |  |  | 	~EditorFileSystemDirectory(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class EditorFileSystem : public Node { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	GDCLASS(EditorFileSystem, Node); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	_THREAD_SAFE_CLASS_ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	struct ItemAction { | 
					
						
							|  |  |  | 		enum Action { | 
					
						
							|  |  |  | 			ACTION_NONE, | 
					
						
							|  |  |  | 			ACTION_DIR_ADD, | 
					
						
							|  |  |  | 			ACTION_DIR_REMOVE, | 
					
						
							|  |  |  | 			ACTION_FILE_ADD, | 
					
						
							|  |  |  | 			ACTION_FILE_REMOVE, | 
					
						
							| 
									
										
										
										
											2018-11-20 21:47:48 -03:00
										 |  |  | 			ACTION_FILE_TEST_REIMPORT, | 
					
						
							|  |  |  | 			ACTION_FILE_RELOAD | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 		}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		Action action = ACTION_NONE; | 
					
						
							|  |  |  | 		EditorFileSystemDirectory *dir = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		String file; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		EditorFileSystemDirectory *new_dir = nullptr; | 
					
						
							|  |  |  | 		EditorFileSystemDirectory::FileInfo *new_file = nullptr; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool use_threads; | 
					
						
							| 
									
										
										
										
											2021-01-19 13:29:41 +01:00
										 |  |  | 	Thread thread; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	static void _thread_func(void *_userdata); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	EditorFileSystemDirectory *new_filesystem; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bool abort_scan; | 
					
						
							|  |  |  | 	bool scanning; | 
					
						
							| 
									
										
										
										
											2017-02-06 00:38:39 -03:00
										 |  |  | 	bool importing; | 
					
						
							| 
									
										
										
										
											2019-02-26 18:43:37 -03:00
										 |  |  | 	bool first_scan; | 
					
						
							| 
									
										
										
										
											2020-02-10 09:19:10 +01:00
										 |  |  | 	bool scan_changes_pending; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	float scan_total; | 
					
						
							| 
									
										
										
										
											2019-02-26 18:43:37 -03:00
										 |  |  | 	String filesystem_settings_version_for_import; | 
					
						
							|  |  |  | 	bool revalidate_import_files; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	void _scan_filesystem(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-17 17:02:43 -03:00
										 |  |  | 	Set<String> late_added_files; //keep track of files that were added, these will be re-scanned
 | 
					
						
							|  |  |  | 	Set<String> late_update_files; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void _save_late_updated_files(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	EditorFileSystemDirectory *filesystem; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	static EditorFileSystem *singleton; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	/* Used for reading the filesystem cache file */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	struct FileCache { | 
					
						
							|  |  |  | 		String type; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		uint64_t modification_time = 0; | 
					
						
							|  |  |  | 		uint64_t import_modification_time = 0; | 
					
						
							| 
									
										
										
										
											2015-08-23 20:15:56 -03:00
										 |  |  | 		Vector<String> deps; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		bool import_valid = false; | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 		String import_group_file; | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 		String script_class_name; | 
					
						
							|  |  |  | 		String script_class_extends; | 
					
						
							| 
									
										
										
										
											2018-07-28 22:36:43 -05:00
										 |  |  | 		String script_class_icon_path; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	HashMap<String, FileCache> file_cache; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	struct ScanProgress { | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		float low = 0; | 
					
						
							|  |  |  | 		float hi = 0; | 
					
						
							|  |  |  | 		mutable EditorProgressBG *progress = nullptr; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		void update(int p_current, int p_total) const; | 
					
						
							|  |  |  | 		ScanProgress get_sub(int p_current, int p_total) const; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	void _save_filesystem_cache(); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _save_filesystem_cache(EditorFileSystemDirectory *p_dir, FileAccess *p_file); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03: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-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-15 01:13:14 +02:00
										 |  |  | 	void _delete_internal_files(String p_file); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	Set<String> valid_extensions; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	Set<String> import_extensions; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void _scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess *da, const ScanProgress &p_progress); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-19 13:29:41 +01:00
										 |  |  | 	Thread thread_sources; | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	bool scanning_changes; | 
					
						
							|  |  |  | 	bool scanning_changes_done; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	static void _thread_func_sources(void *_userdata); | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	List<String> sources_changed; | 
					
						
							| 
									
										
										
										
											2016-01-05 10:36:24 -03:00
										 |  |  | 	List<ItemAction> scan_actions; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	bool _update_scan_actions(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	void _update_extensions(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-19 09:57:52 -03:00
										 |  |  | 	void _reimport_file(const String &p_file, const Map<StringName, Variant> *p_custom_options = nullptr, const String &p_custom_importer = String()); | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 	Error _reimport_group(const String &p_group_file, const Vector<String> &p_files); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 13:39:41 -03:00
										 |  |  | 	bool _test_for_reimport(const String &p_path, bool p_only_imported_files); | 
					
						
							| 
									
										
										
										
											2017-02-01 20:41:05 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bool reimport_on_missing_imported_files; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-17 17:02:43 -03:00
										 |  |  | 	Vector<String> _get_dependencies(const String &p_path); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-20 20:59:19 -03:00
										 |  |  | 	struct ImportFile { | 
					
						
							|  |  |  | 		String path; | 
					
						
							| 
									
										
										
										
											2021-03-24 20:44:13 -03:00
										 |  |  | 		String importer; | 
					
						
							|  |  |  | 		bool threaded = false; | 
					
						
							| 
									
										
										
										
											2020-11-24 10:12:55 +01:00
										 |  |  | 		int order = 0; | 
					
						
							| 
									
										
										
										
											2017-09-20 20:59:19 -03:00
										 |  |  | 		bool operator<(const ImportFile &p_if) const { | 
					
						
							| 
									
										
										
										
											2021-03-24 20:44:13 -03:00
										 |  |  | 			return order == p_if.order ? (importer < p_if.importer) : (order < p_if.order); | 
					
						
							| 
									
										
										
										
											2017-09-20 20:59:19 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 	void _scan_script_classes(EditorFileSystemDirectory *p_dir); | 
					
						
							| 
									
										
										
										
											2021-02-10 19:22:13 +01:00
										 |  |  | 	SafeFlag update_script_classes_queued; | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 	void _queue_update_script_classes(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-28 22:36:43 -05:00
										 |  |  | 	String _get_global_script_class(const String &p_type, const String &p_path, String *r_extends, String *r_icon_path) const; | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-04 23:00:02 -03:00
										 |  |  | 	static Error _resource_import(const String &p_path); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-27 22:50:26 +08:00
										 |  |  | 	bool using_fat32_or_exfat; // Workaround for projects in FAT32 or exFAT filesystem (pendrives, most of the time)
 | 
					
						
							| 
									
										
										
										
											2019-01-21 15:23:08 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-17 07:33:00 +01:00
										 |  |  | 	void _find_group_files(EditorFileSystemDirectory *efd, Map<String, Vector<String>> &group_files, Set<String> &groups_to_reimport); | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void _move_group_files(EditorFileSystemDirectory *efd, const String &p_group_file, const String &p_new_location); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Set<String> group_file_cache; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-24 20:44:13 -03:00
										 |  |  | 	ThreadWorkPool import_threads; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct ImportThreadData { | 
					
						
							|  |  |  | 		const ImportFile *reimport_files; | 
					
						
							|  |  |  | 		int reimport_from; | 
					
						
							|  |  |  | 		int max_index = 0; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void _reimport_thread(uint32_t p_index, ImportThreadData *p_import_data); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03: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-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	EditorFileSystemDirectory *get_filesystem(); | 
					
						
							|  |  |  | 	bool is_scanning() const; | 
					
						
							| 
									
										
										
										
											2017-02-06 00:38:39 -03:00
										 |  |  | 	bool is_importing() const { return importing; } | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	float get_scanning_progress() const; | 
					
						
							|  |  |  | 	void scan(); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 	void scan_changes(); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void update_file(const String &p_file); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03: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 13:15:15 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	void reimport_files(const Vector<String> &p_files); | 
					
						
							| 
									
										
										
										
											2017-02-01 09:45:45 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-19 09:57:52 -03:00
										 |  |  | 	void reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const Map<StringName, Variant> &p_custom_params); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-15 19:29:00 -03:00
										 |  |  | 	void update_script_classes(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-19 15:54:33 -03:00
										 |  |  | 	bool is_group_file(const String &p_path) const; | 
					
						
							|  |  |  | 	void move_group_file(const String &p_path, const String &p_new_path); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-21 21:34:27 -08:00
										 |  |  | 	static bool _should_skip_directory(const String &p_path); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	EditorFileSystem(); | 
					
						
							|  |  |  | 	~EditorFileSystem(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // EDITOR_FILE_SYSTEM_H
 |