Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

EditorFileSystem

继承: Node < Object

编辑器可以浏览的资源文件系统。

描述

这个对象储存着文件系统里所有的资源的信息,类型和其他。

注意:这个类不应该被直接实例化。应该使用下列方法 EditorInterface.get_resource_filesystem 来读取单例。

方法

String

get_file_type ( String path ) const

EditorFileSystemDirectory

get_filesystem ( )

EditorFileSystemDirectory

get_filesystem_path ( String path )

float

get_scanning_progress ( ) const

bool

is_scanning ( ) const

void

reimport_files ( PackedStringArray files )

void

scan ( )

void

scan_sources ( )

void

update_file ( String path )


信号

filesystem_changed ( )

在文件系统更改的时候触发。


resources_reimported ( PackedStringArray resources )

重新导入资源时触发。


resources_reload ( PackedStringArray resources )

如果在扫描文件系统的时候,至少有一个资源被重新加载,则触发该信号。


script_classes_updated ( )

更新全局脚本类列表时触发。


sources_changed ( bool exist )

如果导入文件的来源发生变化,则触发。


方法说明

String get_file_type ( String path ) const

返回文件的资源类型,给定完整路径。这将返回字符串,如 "Resource""GDScript"不是文件扩展名,如 ".gd"


EditorFileSystemDirectory get_filesystem ( )

获取根目录对象。


EditorFileSystemDirectory get_filesystem_path ( String path )

返回在 path 下文件系统的视图。


float get_scanning_progress ( ) const

如果文件系统正在被扫描,返回扫描的进度,值为 0-1。


bool is_scanning ( ) const

如果文件系统正在进行扫描,则返回 true


void reimport_files ( PackedStringArray files )

重新导入一组文件。如果这些文件或其 .import 文件是由脚本或外部程序直接编辑的,请调用此函数。

如果文件类型已更改或文件是新创建的,请使用 update_filescan

注意:此函数会阻塞,直到导入完成。但由于进度条更新,主循环迭代,包括计时器和 Node._process,将在导入过程中发生。避免在导入正在进行时调用 reimport_filesscan


void scan ( )

扫描文件系统的改动。


void scan_sources ( )

检查是否更改了已导入资源的来源。


void update_file ( String path )

在现有目录中添加文件,或计划在编辑器重新启动时更新文件信息。可用于更新由外部程序保存的文本文件。

这不会导入文件。要重新导入,请调用 reimport_filesscan 方法。