Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EditorFileSystem
编辑器可以浏览的资源文件系统。
描述
这个对象储存着文件系统里所有的资源的信息,类型和其他。
注意:这个类不应该被直接实例化。应该使用下列方法 EditorInterface.get_resource_filesystem() 来读取单例。
方法
get_file_type(path: String) const |
|
get_filesystem_path(path: String) |
|
get_scanning_progress() const |
|
is_scanning() const |
|
void |
reimport_files(files: PackedStringArray) |
void |
scan() |
void |
|
void |
update_file(path: String) |
信号
filesystem_changed() 🔗
在文件系统更改的时候触发。
resources_reimported(resources: PackedStringArray) 🔗
重新导入资源时触发。
resources_reimporting(resources: PackedStringArray) 🔗
在重新导入资源之前触发。
resources_reload(resources: PackedStringArray) 🔗
如果在扫描文件系统的时候,至少有一个资源被重新加载,则触发该信号。
script_classes_updated() 🔗
更新全局脚本类列表时触发。
sources_changed(exist: bool) 🔗
如果导入文件的来源发生变化,则触发。
方法说明
String get_file_type(path: String) const 🔗
返回文件的资源类型,给定完整路径。这将返回字符串,如 "Resource"
或 "GDScript"
,不是文件扩展名,如 ".gd"
。
EditorFileSystemDirectory get_filesystem() 🔗
获取根目录对象。
EditorFileSystemDirectory get_filesystem_path(path: String) 🔗
返回在 path
下文件系统的视图。
float get_scanning_progress() const 🔗
如果文件系统正在被扫描,返回扫描的进度,值为 0-1。
如果文件系统正在进行扫描,则返回 true
。
void reimport_files(files: PackedStringArray) 🔗
重新导入一组文件。如果这些文件或其 .import
文件是由脚本或外部程序直接编辑的,请调用此函数。
如果文件类型已更改或文件是新创建的,请使用 update_file() 或 scan()。
注意:此函数会阻塞,直到导入完成。但由于进度条更新,主循环迭代,包括计时器和 Node._process(),将在导入过程中发生。避免在导入正在进行时调用 reimport_files() 或 scan()。
void scan() 🔗
扫描文件系统的改动。
void scan_sources() 🔗
检查是否更改了已导入资源的来源。
void update_file(path: String) 🔗
在现有目录中添加文件,或计划在编辑器重新启动时更新文件信息。可用于更新由外部程序保存的文本文件。
这不会导入文件。要重新导入,请调用 reimport_files() 或 scan() 方法。