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...
ResourceImporter
继承: RefCounted < Object
派生: EditorImportPlugin, ResourceImporterBitMap, ResourceImporterBMFont, ResourceImporterCSVTranslation, ResourceImporterDynamicFont, ResourceImporterImage, ResourceImporterImageFont, ResourceImporterLayeredTexture, ResourceImporterMP3, ResourceImporterOBJ, ResourceImporterOggVorbis, ResourceImporterScene, ResourceImporterShaderFile, ResourceImporterSVG, ResourceImporterTexture, ResourceImporterTextureAtlas, ResourceImporterWAV
资源导入器的基类。
描述
这是 Godot 资源导入器的基类。要使用编辑器插件实现你自己的资源导入器,请参考 EditorImportPlugin。
教程
方法
_get_build_dependencies(path: String) virtual const |
枚举
enum ImportOrder: 🔗
ImportOrder IMPORT_ORDER_DEFAULT = 0
默认导入顺序。
ImportOrder IMPORT_ORDER_SCENE = 100
场景的导入顺序,确保场景被导入在所有其他核心资源(如纹理)之后。自定义导入器的导入顺序一般应低于100,以避免导入依赖自定义资源的场景时出现问题。
方法说明
PackedStringArray _get_build_dependencies(path: String) virtual const 🔗
当引擎编译配置文件编辑器想要检查导入资源所需的构建选项时会调用此方法。例如, ResourceImporterDynamicFont 有一个名为 ResourceImporterDynamicFont.multichannel_signed_distance_field 的属性,该属性要求引擎在构建时必须启用“msdfgen”模块。如果该资源恰好是自定义的资源,则会像这样处理:
func _get_build_dependencies(path):
var resource = load(path)
var dependencies = PackedStringArray()
if resource.multichannel_signed_distance_field:
dependencies.push_back("module_msdfgen_enabled")
return dependencies