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...
EditorExportPlatformExtension
繼承: EditorExportPlatform < RefCounted < Object
自訂 EditorExportPlatform 實作(外掛)的基底類別。
說明
外部 EditorExportPlatform 實作應當繼承自該類。
要使用 EditorExportPlatform,請先使用 EditorPlugin.add_export_platform() 方法注冊。
方法
方法說明
bool _can_export(preset: EditorExportPreset, debug: bool) virtual const 🔗
如果指定的 preset 有效且可以匯出,則回傳 true。使用 set_config_error() 和 set_config_missing_templates() 來設定錯誤細節。
通常的實作會呼叫 _has_valid_export_configuration() 和 _has_valid_project_configuration() 來確定匯出是否可行。
void _cleanup() virtual 🔗
注銷平台前編輯器會呼叫該方法。
Error _export_pack(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags]) virtual 🔗
使用 preset 預設在 path 路徑處建立 PCK 包。
在匯出對話框中按下“匯出 PCK/ZIP”按鈕,停用“匯出為補丁”,並選擇 PCK 作為檔案型別時,將呼叫該方法。
Error _export_pack_patch(preset: EditorExportPreset, debug: bool, path: String, patches: PackedStringArray, flags: BitField[DebugFlags]) virtual 🔗
使用 preset 預設在路徑 path 處建立補丁 PCK 封存檔,包含自上次補丁以來發生更改的檔案。
在匯出對話框中按下“匯出 PCK/ZIP”按鈕,啟用“匯出為補丁”,並選擇 PCK 作為檔案型別時,將呼叫該方法。
注意:patches 中的補丁在呼叫該方法時已載入 ,僅作為情境提供。為空時將載入匯出預設中定義的補丁。
Error _export_project(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags]) virtual required 🔗
使用 preset 預設在 path 路徑處建立完整的專案。
在匯出對話框中按下“匯出”按鈕時,將呼叫該方法。
該方法的實作可以呼叫 EditorExportPlatform.save_pack() 或 EditorExportPlatform.save_zip() 來使用預設的 PCK/ZIP 匯出過程,或者呼叫 EditorExportPlatform.export_project_files() 並實作自訂回呼來處理每個匯出的檔案。
Error _export_zip(preset: EditorExportPreset, debug: bool, path: String, flags: BitField[DebugFlags]) virtual 🔗
使用 preset 預設在 path 路徑處建立 ZIP 封存檔。
在匯出對話框中按下“匯出 PCK/ZIP”按鈕,停用“匯出為補丁”,並選擇 ZIP 作為檔案型別時,將呼叫該方法。
Error _export_zip_patch(preset: EditorExportPreset, debug: bool, path: String, patches: PackedStringArray, flags: BitField[DebugFlags]) virtual 🔗
使用 preset 預設在 path 路徑處建立 ZIP 封存檔,僅包含自上次補丁以來發生更改的檔案。
在匯出對話框中按下“匯出 PCK/ZIP”按鈕,啟用“匯出為補丁”,並選擇 ZIP 作為檔案型別時,將呼叫該方法。
注意:patches 中的補丁在呼叫該方法時已載入 ,僅作為情境提供。為空時將載入匯出預設中定義的補丁。
PackedStringArray _get_binary_extensions(preset: EditorExportPreset) virtual required const 🔗
回傳完整專案匯出所支援的二進位檔案副檔名陣列。
String _get_debug_protocol() virtual const 🔗
回傳用於遠端除錯的協議。預設實作回傳 tcp://。
String _get_device_architecture(device: int) virtual const 🔗
Returns device architecture for remote deploy.
bool _get_export_option_visibility(preset: EditorExportPreset, option: String) virtual const 🔗
驗證 option 並回傳指定 preset 的可見性。預設實作為所有選項都回傳 true。
String _get_export_option_warning(preset: EditorExportPreset, option: StringName) virtual const 🔗
驗證 option 並回傳指定 preset 的警告訊息。預設實作為所有選項都回傳空字串。
Array[Dictionary] _get_export_options() virtual const 🔗
回傳屬性清單,型別是元素為字典的 Array。每個 Dictionary 都必須至少包含 name: StringName 和 type: Variant.Type 兩個條目。
另外還支援如下欄位:
hint: PropertyHinthint_string: Stringusage: PropertyUsageFlagsclass_name: StringNamedefault_value: Variant,屬性的預設值。update_visibility: bool,如果設為true,則會在該屬性發生更改時為每個屬性都呼叫 _get_export_option_visibility()。required: bool,如果設為true,則該屬性的警告是關鍵的,解決後才能夠實作匯出。該值是 _has_valid_export_configuration() 實作的提示,引擎不直接使用。
另見 Object._get_property_list()。
Texture2D _get_logo() virtual required const 🔗
回傳匯出對話框中顯示的平台徽標,該徽標應為 32×32 像素,並根據目前編輯器的縮放進行調整(見 EditorInterface.get_editor_scale())。
String _get_name() virtual required const 🔗
回傳匯出平台的名稱。
Texture2D _get_option_icon(device: int) virtual const 🔗
Returns the item icon for the specified device in the remote deploy menu. The icon should be 16×16 pixels, adjusted for the current editor scale (see EditorInterface.get_editor_scale()).
String _get_option_label(device: int) virtual const 🔗
Returns remote deploy menu item label for the specified device.
String _get_option_tooltip(device: int) virtual const 🔗
Returns remote deploy menu item tooltip for the specified device.
int _get_options_count() virtual const 🔗
Returns the number of devices (or other options) available in the remote deploy menu.
String _get_options_tooltip() virtual const 🔗
Returns tooltip of the remote deploy menu button.
String _get_os_name() virtual required const 🔗
回傳目標作業系統的名稱。
PackedStringArray _get_platform_features() virtual required const 🔗
回傳平台特定功能的陣列。
PackedStringArray _get_preset_features(preset: EditorExportPreset) virtual required const 🔗
回傳 preset 預設對應的平台特定功能的陣列。
Texture2D _get_run_icon() virtual const 🔗
Returns the icon of the remote deploy menu button. The icon should be 16×16 pixels, adjusted for the current editor scale (see EditorInterface.get_editor_scale()).
bool _has_valid_export_configuration(preset: EditorExportPreset, debug: bool) virtual required const 🔗
如果匯出設定有效,則回傳 true。
bool _has_valid_project_configuration(preset: EditorExportPreset) virtual required const 🔗
如果專案設定有效,則回傳 true。
void _initialize() virtual 🔗
初始化外掛。平台注冊時由編輯器呼叫。
bool _is_executable(path: String) virtual const 🔗
如果指定的檔案是目標平台上的有效可執行檔(原生可執行檔或腳本),則回傳 true。
Returns true if remote deploy options are changed and editor interface should be updated.
Error _run(preset: EditorExportPreset, device: int, debug_flags: BitField[DebugFlags]) virtual 🔗
This method is called when device remote deploy menu option is selected.
Implementation should export project to a temporary location, upload and run it on the specific device, or perform another action associated with the menu item.
bool _should_update_export_options() virtual 🔗
如果匯出選項清單發生了更改,應當更新預設,則回傳 true。
String get_config_error() const 🔗
回傳目前設定的錯誤訊息文字。該方法只應在 _can_export()、_has_valid_export_configuration()、_has_valid_project_configuration() 的實作中呼叫。
bool get_config_missing_templates() const 🔗
如果目前設定缺失匯出範本,則回傳 true。該方法只應在 _can_export()、_has_valid_export_configuration()、_has_valid_project_configuration() 的實作中呼叫。
void set_config_error(error_text: String) const 🔗
設定目前設定的錯誤訊息文字。該方法只應在 _can_export()、_has_valid_export_configuration()、_has_valid_project_configuration() 的實作中呼叫。
void set_config_missing_templates(missing_templates: bool) const 🔗
設為 true 表示目前設定缺失匯出範本 。該方法只應在 _can_export()、_has_valid_export_configuration()、_has_valid_project_configuration() 的實作中呼叫。