Files
godot-docs-l10n/classes/zh_CN/class_editorfilesystem.rst

258 lines
11 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.4/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.4/doc/classes/EditorFileSystem.xml.
.. _class_EditorFileSystem:
EditorFileSystem
================
**继承:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
编辑器可以浏览的资源文件系统。
.. rst-class:: classref-introduction-group
描述
----
这个对象储存着文件系统里所有的资源的信息,类型和其他。
\ **注意:**\ 这个类不应该被直接实例化。应该使用下列方法 :ref:`EditorInterface.get_resource_filesystem()<class_EditorInterface_method_get_resource_filesystem>` 来读取单例。
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_file_type<class_EditorFileSystem_method_get_file_type>`\ (\ path\: :ref:`String<class_String>`\ ) |const| |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`EditorFileSystemDirectory<class_EditorFileSystemDirectory>` | :ref:`get_filesystem<class_EditorFileSystem_method_get_filesystem>`\ (\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`EditorFileSystemDirectory<class_EditorFileSystemDirectory>` | :ref:`get_filesystem_path<class_EditorFileSystem_method_get_filesystem_path>`\ (\ path\: :ref:`String<class_String>`\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_scanning_progress<class_EditorFileSystem_method_get_scanning_progress>`\ (\ ) |const| |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_scanning<class_EditorFileSystem_method_is_scanning>`\ (\ ) |const| |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`reimport_files<class_EditorFileSystem_method_reimport_files>`\ (\ files\: :ref:`PackedStringArray<class_PackedStringArray>`\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`scan<class_EditorFileSystem_method_scan>`\ (\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`scan_sources<class_EditorFileSystem_method_scan_sources>`\ (\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`update_file<class_EditorFileSystem_method_update_file>`\ (\ path\: :ref:`String<class_String>`\ ) |
+-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
信号
----
.. _class_EditorFileSystem_signal_filesystem_changed:
.. rst-class:: classref-signal
**filesystem_changed**\ (\ ) :ref:`🔗<class_EditorFileSystem_signal_filesystem_changed>`
在文件系统更改的时候触发。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_signal_resources_reimported:
.. rst-class:: classref-signal
**resources_reimported**\ (\ resources\: :ref:`PackedStringArray<class_PackedStringArray>`\ ) :ref:`🔗<class_EditorFileSystem_signal_resources_reimported>`
重新导入资源时触发。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_signal_resources_reimporting:
.. rst-class:: classref-signal
**resources_reimporting**\ (\ resources\: :ref:`PackedStringArray<class_PackedStringArray>`\ ) :ref:`🔗<class_EditorFileSystem_signal_resources_reimporting>`
在重新导入资源之前触发。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_signal_resources_reload:
.. rst-class:: classref-signal
**resources_reload**\ (\ resources\: :ref:`PackedStringArray<class_PackedStringArray>`\ ) :ref:`🔗<class_EditorFileSystem_signal_resources_reload>`
如果在扫描文件系统的时候,至少有一个资源被重新加载,则触发该信号。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_signal_script_classes_updated:
.. rst-class:: classref-signal
**script_classes_updated**\ (\ ) :ref:`🔗<class_EditorFileSystem_signal_script_classes_updated>`
更新全局脚本类列表时触发。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_signal_sources_changed:
.. rst-class:: classref-signal
**sources_changed**\ (\ exist\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_EditorFileSystem_signal_sources_changed>`
如果导入文件的来源发生变化,则触发。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_EditorFileSystem_method_get_file_type:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_file_type**\ (\ path\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_EditorFileSystem_method_get_file_type>`
返回文件的资源类型,给定完整路径。这将返回字符串,如 ``"Resource"````"GDScript"``\ \ *不是*\ 文件扩展名,如 ``".gd"``\ 。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_get_filesystem:
.. rst-class:: classref-method
:ref:`EditorFileSystemDirectory<class_EditorFileSystemDirectory>` **get_filesystem**\ (\ ) :ref:`🔗<class_EditorFileSystem_method_get_filesystem>`
获取根目录对象。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_get_filesystem_path:
.. rst-class:: classref-method
:ref:`EditorFileSystemDirectory<class_EditorFileSystemDirectory>` **get_filesystem_path**\ (\ path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_EditorFileSystem_method_get_filesystem_path>`
返回在 ``path`` 下文件系统的视图。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_get_scanning_progress:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_scanning_progress**\ (\ ) |const| :ref:`🔗<class_EditorFileSystem_method_get_scanning_progress>`
如果文件系统正在被扫描,返回扫描的进度,值为 0-1。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_is_scanning:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_scanning**\ (\ ) |const| :ref:`🔗<class_EditorFileSystem_method_is_scanning>`
如果文件系统正在进行扫描,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_reimport_files:
.. rst-class:: classref-method
|void| **reimport_files**\ (\ files\: :ref:`PackedStringArray<class_PackedStringArray>`\ ) :ref:`🔗<class_EditorFileSystem_method_reimport_files>`
重新导入一组文件。如果这些文件或其 ``.import`` 文件是由脚本或外部程序直接编辑的,请调用此函数。
如果文件类型已更改或文件是新创建的,请使用 :ref:`update_file()<class_EditorFileSystem_method_update_file>` 或 :ref:`scan()<class_EditorFileSystem_method_scan>`\ 。
\ **注意:**\ 此函数会阻塞,直到导入完成。但由于进度条更新,主循环迭代,包括计时器和 :ref:`Node._process()<class_Node_private_method__process>`\ ,将在导入过程中发生。避免在导入正在进行时调用 :ref:`reimport_files()<class_EditorFileSystem_method_reimport_files>` 或 :ref:`scan()<class_EditorFileSystem_method_scan>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_scan:
.. rst-class:: classref-method
|void| **scan**\ (\ ) :ref:`🔗<class_EditorFileSystem_method_scan>`
扫描文件系统的改动。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_scan_sources:
.. rst-class:: classref-method
|void| **scan_sources**\ (\ ) :ref:`🔗<class_EditorFileSystem_method_scan_sources>`
检查是否更改了已导入资源的来源。
.. rst-class:: classref-item-separator
----
.. _class_EditorFileSystem_method_update_file:
.. rst-class:: classref-method
|void| **update_file**\ (\ path\: :ref:`String<class_String>`\ ) :ref:`🔗<class_EditorFileSystem_method_update_file>`
在现有目录中添加文件,或计划在编辑器重新启动时更新文件信息。可用于更新由外部程序保存的文本文件。
这不会导入文件。要重新导入,请调用 :ref:`reimport_files()<class_EditorFileSystem_method_reimport_files>` 或 :ref:`scan()<class_EditorFileSystem_method_scan>` 方法。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`