EditorExportPlatform
继承: RefCounted < Object
派生: EditorExportPlatformAndroid, EditorExportPlatformAppleEmbedded, EditorExportPlatformExtension, EditorExportPlatformMacOS, EditorExportPlatformPC, EditorExportPlatformWeb
标识一个支持的导出平台,并在内部提供导出到该平台的功能。
描述
基础资源,提供从编辑器将项目的发布构建导出到平台的功能。存储特定于平台的元数据,例如平台的名称和支持的功能,并执行项目、PCK 文件和 ZIP 文件的导出。使用在项目导出时提供的平台导出模板。
在 EditorExportPlugin 的脚本中用于配置特定于平台的场景和资源的定制。有关详细信息,请参阅 EditorExportPlugin._begin_customize_scenes() 和 EditorExportPlugin._begin_customize_resources()。
方法
枚举
enum ExportMessageType: 🔗
ExportMessageType EXPORT_MESSAGE_NONE = 0
无效消息类型,是未指定类型时的默认值。
ExportMessageType EXPORT_MESSAGE_INFO = 1
信息类消息的消息类型,对导出没有影响。
ExportMessageType EXPORT_MESSAGE_WARNING = 2
警告类消息的消息类型,应当解决,但仍然允许完成导出。
ExportMessageType EXPORT_MESSAGE_ERROR = 3
错误类消息的消息类型,必须解决,会让导出失败。
flags DebugFlags: 🔗
DebugFlags DEBUG_FLAG_DUMB_CLIENT = 1
如果希望远程调试的项目使用远程文件系统,则设置该标志。如果设置了该标志,则 gen_export_flags() 会将 --remote-fs 和 --remote-fs-password(如果定义了 EditorSettings.filesystem/file_server/password)命令行参数追加到返回的列表中。
DebugFlags DEBUG_FLAG_REMOTE_DEBUG = 2
如果启用了远程调试,则设置该标志。如果设置了该标志,则 gen_export_flags() 会将 --remote-debug 和 --breakpoints(如果脚本编辑器中选择了断点或插件添加了断点)命令行参数追加到返回的列表中。
DebugFlags DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST = 4
如果远程调试的项目在本机运行,则设置该标志。如果设置了该标志,则 gen_export_flags() 会使用 localhost 作为远程调试器主机,不使用 EditorSettings.network/debug/remote_host。
DebugFlags DEBUG_FLAG_VIEW_COLLISIONS = 8
如果启用了“显示碰撞形状”远程调试选项,则设置该标志。如果设置了该标志,则 gen_export_flags() 会将 --debug-collisions 命令行参数追加到返回的列表中。
如果启用了“显示导航”远程调试选项,则设置该标志。如果设置了该标志,则 gen_export_flags() 会将 --debug-navigation 命令行参数追加到返回的列表中。
方法说明
void add_message(type: ExportMessageType, category: String, message: String) 🔗
在导出日志中添加一条消息,会在导出结束时显示。
void clear_messages() 🔗
清空导出日志。
EditorExportPreset create_preset() 🔗
新建该平台的预设。
Error export_pack(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags] = 0) 🔗
使用 preset 预设在 path 路径处创建 PCK 包。
Error export_pack_patch(preset: EditorExportPreset, debug: bool, path: String, patches: PackedStringArray = PackedStringArray(), flags: BitField[DebugFlags] = 0) 🔗
使用 preset 预设在 path 路径处创建 PCK 补丁包,只会包含相对于上一个补丁发生更改的文件。
注意:patches 是可选的,会覆盖导出预设中定义的补丁集。留空时会使用导出预设中定义的补丁。
Error export_project(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags] = 0) 🔗
使用 preset 预设在 path 路径处创建完整的项目。
Error export_project_files(preset: EditorExportPreset, debug: bool, save_cb: Callable, shared_cb: Callable = Callable()) 🔗
使用指定的预设导出项目文件。该方法可以用来实现与 PCK 和 ZIP 不同的自定义导出格式。每个导出的文件都会调用一个回调。
save_cb 会针对所有导出的文件调用,参数为:file_path: String、file_data: PackedByteArray、file_index: int、file_count: int、encryption_include_filters: PackedStringArray、encryption_exclude_filters: PackedStringArray、encryption_key: PackedByteArray。
shared_cb 会针对导出的共享/静态库调用,参数为:file_path: String、tags: PackedStringArray、target_folder: String。
注意:file_index 和 file_count 仅供跟踪进度使用,不一定唯一,也不一定精确。
Error export_zip(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags] = 0) 🔗
使用 preset 预设在 path 路径处创建 ZIP 压缩包。
Error export_zip_patch(preset: EditorExportPreset, debug: bool, path: String, patches: PackedStringArray = PackedStringArray(), flags: BitField[DebugFlags] = 0) 🔗
使用 preset 预设在 path 路径处创建 ZIP 补丁压缩包,只会包含相对于上一个补丁发生更改的文件。
注意:patches 是可选的,会覆盖导出预设中定义的补丁集。留空时会使用导出预设中定义的补丁。
Dictionary find_export_template(template_file_name: String) const 🔗
定位该平台的导出模板,返回带有以下字段的 Dictionary:路径 path: String 和错误 error: String。该方法旨在方便使用,自定义导出平台不必使用,也不必和官方模板一样存储导出模板。
PackedStringArray gen_export_flags(flags: BitField[DebugFlags]) 🔗
生成命令行参数数组,适用于使用调试标志和编辑器设置的默认导出模板。
Array get_current_presets() const 🔗
返回该平台的 EditorExportPreset 数组。
PackedStringArray get_forced_export_files(preset: EditorExportPreset = null) static 🔗
返回核心文件名数组,这些文件无论预设配置如何都应该导出。
Dictionary get_internal_export_files(preset: EditorExportPreset, debug: bool) 🔗
返回无论预设如何配置都应当额外导出的文件,这些文件不在项目源文件中。返回的 Dictionary 使用文件名作为键(String),值为对应的原始数据(PackedByteArray)。
String get_message_category(index: int) const 🔗
Returns the message category for the message with the given index.
int get_message_count() const 🔗
Returns the number of messages in the export log.
String get_message_text(index: int) const 🔗
Returns the text for the message with the given index.
ExportMessageType get_message_type(index: int) const 🔗
Returns the type for the message with the given index.
以友好字符串的形式,返回由该 EditorExportPlatform 类处理的导出操作系统的名称。可能的返回值为 Windows、Linux、macOS、Android、iOS 和 Web。
ExportMessageType get_worst_message_type() const 🔗
返回导出日志中目前存在的最严重的消息类型。
Dictionary save_pack(preset: EditorExportPreset, debug: bool, path: String, embed: bool = false) 🔗
保存 PCK 归档并返回 Dictionary,包含以下字段:result: Error、so_files: Array(包含字典的共享/静态对象数组,字典中包含以下字段:path: String、tags: PackedStringArray、target_folder: String)。
如果 embed 为 true,则 PCK 中的内容会追加到 path 文件的末尾,返回的 Dictionary 中额外包含以下字段:embedded_start: int(嵌入 PCK 的偏移量)和 embedded_size: int(嵌入 PCK 的大小)。
Dictionary save_pack_patch(preset: EditorExportPreset, debug: bool, path: String) 🔗
保存补丁 PCK 归档并返回 Dictionary,包含以下字段:result: Error、so_files: Array(包含字典的共享/静态对象数组,字典中包含以下字段:path: String、tags: PackedStringArray、target_folder: String)。
Dictionary save_zip(preset: EditorExportPreset, debug: bool, path: String) 🔗
保存 ZIP 归档并返回 Dictionary,包含以下字段:result: Error、so_files: Array(包含字典的共享/静态对象数组,字典中包含以下字段:path: String、tags: PackedStringArray、target_folder: String)。
Dictionary save_zip_patch(preset: EditorExportPreset, debug: bool, path: String) 🔗
保存补丁 ZIP 归档并返回 Dictionary,包含以下字段:result: Error、so_files: Array(包含字典的共享/静态对象数组,字典中包含以下字段:path: String、tags: PackedStringArray、target_folder: String)。
Error ssh_push_to_remote(host: String, port: String, scp_args: PackedStringArray, src_file: String, dst_file: String) const 🔗
将指定的文件通过 SCP 协议上传至远程主机。
Error ssh_run_on_remote(host: String, port: String, ssh_arg: PackedStringArray, cmd_args: String, output: Array = [], port_fwd: int = -1) const 🔗
通过 SSH 协议在远程主机上执行指定的命令,在 output 中返回命令的输出。
int ssh_run_on_remote_no_wait(host: String, port: String, ssh_args: PackedStringArray, cmd_args: String, port_fwd: int = -1) const 🔗
通过 SSH 协议在远程主机上执行指定的命令,返回(远程主机上的)进程 ID,无需等待命令完成。