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.

EditorExportPlugin

Hérite de : RefCounted < Object

Un script qui est exécuté à l'export du projet.

Description

EditorExportPlugins are automatically invoked whenever the user exports the project. They can be used to modify scenes and resources during project export based on what Feature Tags are set. For each plugin, _export_begin() is called at the beginning of the export process and then _export_file() is called for each exported file.

Register a EditorExportPlugin by creating a new EditorPlugin and calling its EditorPlugin.add_export_plugin() method.

Tutoriels

Méthodes

bool

_begin_customize_resources(platform: EditorExportPlatform, features: PackedStringArray) virtual const

bool

_begin_customize_scenes(platform: EditorExportPlatform, features: PackedStringArray) virtual const

Resource

_customize_resource(resource: Resource, path: String) virtual required

Node

_customize_scene(scene: Node, path: String) virtual required

void

_end_customize_resources() virtual

void

_end_customize_scenes() virtual

void

_end_generate_apple_embedded_project(path: String, will_build_archive: bool) virtual

void

_export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) virtual

void

_export_end() virtual

void

_export_file(path: String, type: String, features: PackedStringArray) virtual

PackedStringArray

_get_android_dependencies(platform: EditorExportPlatform, debug: bool) virtual const

PackedStringArray

_get_android_dependencies_maven_repos(platform: EditorExportPlatform, debug: bool) virtual const

PackedStringArray

_get_android_libraries(platform: EditorExportPlatform, debug: bool) virtual const

String

_get_android_manifest_activity_element_contents(platform: EditorExportPlatform, debug: bool) virtual const

String

_get_android_manifest_application_element_contents(platform: EditorExportPlatform, debug: bool) virtual const

String

_get_android_manifest_element_contents(platform: EditorExportPlatform, debug: bool) virtual const

int

_get_customization_configuration_hash() virtual required const

PackedStringArray

_get_export_features(platform: EditorExportPlatform, debug: bool) virtual const

bool

_get_export_option_visibility(platform: EditorExportPlatform, option: String) virtual const

String

_get_export_option_warning(platform: EditorExportPlatform, option: String) virtual const

Array[Dictionary]

_get_export_options(platform: EditorExportPlatform) virtual const

Dictionary

_get_export_options_overrides(platform: EditorExportPlatform) virtual const

String

_get_name() virtual required const

bool

_should_update_export_options(platform: EditorExportPlatform) virtual const

bool

_supports_platform(platform: EditorExportPlatform) virtual const

PackedByteArray

_update_android_prebuilt_manifest(platform: EditorExportPlatform, manifest_data: PackedByteArray) virtual const

void

add_apple_embedded_platform_bundle_file(path: String)

void

add_apple_embedded_platform_cpp_code(code: String)

void

add_apple_embedded_platform_embedded_framework(path: String)

void

add_apple_embedded_platform_framework(path: String)

void

add_apple_embedded_platform_linker_flags(flags: String)

void

add_apple_embedded_platform_plist_content(plist_content: String)

void

add_apple_embedded_platform_project_static_lib(path: String)

void

add_file(path: String, file: PackedByteArray, remap: bool)

void

add_ios_bundle_file(path: String)

void

add_ios_cpp_code(code: String)

void

add_ios_embedded_framework(path: String)

void

add_ios_framework(path: String)

void

add_ios_linker_flags(flags: String)

void

add_ios_plist_content(plist_content: String)

void

add_ios_project_static_lib(path: String)

void

add_macos_plugin_file(path: String)

void

add_shared_object(path: String, tags: PackedStringArray, target: String)

EditorExportPlatform

get_export_platform() const

EditorExportPreset

get_export_preset() const

Variant

get_option(name: StringName) const

void

skip()


Descriptions des méthodes

bool _begin_customize_resources(platform: EditorExportPlatform, features: PackedStringArray) virtual const 🔗

Return true if this plugin will customize resources based on the platform and features used.

When enabled, _get_customization_configuration_hash() and _customize_resource() will be called and must be implemented.


bool _begin_customize_scenes(platform: EditorExportPlatform, features: PackedStringArray) virtual const 🔗

Return true if this plugin will customize scenes based on the platform and features used.

When enabled, _get_customization_configuration_hash() and _customize_scene() will be called and must be implemented.

Note: _customize_scene() will only be called for scenes that have been modified since the last export.


Resource _customize_resource(resource: Resource, path: String) virtual required 🔗

Customize a resource. If changes are made to it, return the same or a new resource. Otherwise, return null. When a new resource is returned, resource will be replaced by a copy of the new resource.

The path argument is only used when customizing an actual file, otherwise this means that this resource is part of another one and it will be empty.

Implementing this method is required if _begin_customize_resources() returns true.

Note: When customizing any of the following types and returning another resource, the other resource should not be skipped using skip() in _export_file():


Node _customize_scene(scene: Node, path: String) virtual required 🔗

Customize a scene. If changes are made to it, return the same or a new scene. Otherwise, return null. If a new scene is returned, it is up to you to dispose of the old one.

Implementing this method is required if _begin_customize_scenes() returns true.

Note: To change a variable in your scene, use the @export annotation when declaring it.


void _end_customize_resources() virtual 🔗

This is called when the customization process for resources ends.


void _end_customize_scenes() virtual 🔗

Ceci est appelé lorsque le processus de personnalisation pour les scènes se termine.


void _end_generate_apple_embedded_project(path: String, will_build_archive: bool) virtual 🔗

This is called after Xcode project generation, but before it is built.

Note: Only supported on iOS and visionOS.


void _export_begin(features: PackedStringArray, is_debug: bool, path: String, flags: int) virtual 🔗

Méthode virtuelle à surcharger par l'utilisateur. Elle est appelée lorsque l'exportation commence et fournit toutes les informations sur l'exportation. features est la liste des fonctionnalité pour l'export, is_debug est true pour les builds de débogage, path est le chemin cible pour le projet exporté. flags n'est utilisé que lors de l'exécution d'un profil exécutable, p.ex. lorsque vous utilisez native run sur Android.


void _export_end() virtual 🔗

Une méthode virtuelle à surcharger par l'utilisateur. Elle est appelée lorsque l'exportation est terminée.


void _export_file(path: String, type: String, features: PackedStringArray) virtual 🔗

Une méthode virtuelle à surcharger par l'utilisateur. Elle est appelée pour chaque fichier exporté avant_customize_resource() and _customize_scene(). Les arguments passés peuvent permettre d'identifier le fichier exporté.path est le chemin du fichier, type est la Resource représentée par ce fichier (par exemple PackedScene) et features est la liste des fonctionnalités de cette exportation.

Appeler skip() dans cette fonction de rappel pour ne pas exporter ce fichier.


PackedStringArray _get_android_dependencies(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is called to retrieve the set of Android dependencies provided by this plugin. Each returned Android dependency should have the format of an Android remote binary dependency: org.godot.example:my-plugin:0.0.0

For more information see Android documentation on dependencies.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


PackedStringArray _get_android_dependencies_maven_repos(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is called to retrieve the URLs of Maven repositories for the set of Android dependencies provided by this plugin.

For more information see Gradle documentation on dependency management.

Note: Google's Maven repo and the Maven Central repo are already included by default.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


PackedStringArray _get_android_libraries(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is called to retrieve the local paths of the Android libraries archive (AAR) files provided by this plugin.

Note: Relative paths must be relative to Godot's res://addons/ directory. For example, an AAR file located under res://addons/hello_world_plugin/HelloWorld.release.aar can be returned as an absolute path using res://addons/hello_world_plugin/HelloWorld.release.aar or a relative path using hello_world_plugin/HelloWorld.release.aar.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


String _get_android_manifest_activity_element_contents(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is used at export time to update the contents of the activity element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


String _get_android_manifest_application_element_contents(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is used at export time to update the contents of the application element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


String _get_android_manifest_element_contents(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Virtual method to be overridden by the user. This is used at export time to update the contents of the manifest element in the generated Android manifest.

Note: Only supported on Android and requires EditorExportPlatformAndroid.gradle_build/use_gradle_build to be enabled.


int _get_customization_configuration_hash() virtual required const 🔗

Return a hash based on the configuration passed (for both scenes and resources). This helps keep separate caches for separate export configurations.

Implementing this method is required if _begin_customize_resources() returns true.

Note: _customize_resource() and _customize_scene() will not be called when the EditorExportPlugin script is modified unless this hash changes too.


PackedStringArray _get_export_features(platform: EditorExportPlatform, debug: bool) virtual const 🔗

Return a PackedStringArray of additional features this preset, for the given platform, should have.


bool _get_export_option_visibility(platform: EditorExportPlatform, option: String) virtual const 🔗

Validates option and returns the visibility for the specified platform. The default implementation returns true for all options.


String _get_export_option_warning(platform: EditorExportPlatform, option: String) virtual const 🔗

Check the requirements for the given option and return a non-empty warning string if they are not met.

Note: Use get_option() to check the value of the export options.


Array[Dictionary] _get_export_options(platform: EditorExportPlatform) virtual const 🔗

Return a list of export options that can be configured for this export plugin.

Each element in the return value is a Dictionary with the following keys:

  • option: A dictionary with the structure documented by Object.get_property_list(), but all keys are optional.

  • default_value: The default value for this option.

  • update_visibility: An optional boolean value. If set to true, the preset will emit Object.property_list_changed when the option is changed.


Dictionary _get_export_options_overrides(platform: EditorExportPlatform) virtual const 🔗

Return a Dictionary of override values for export options, that will be used instead of user-provided values. Overridden options will be hidden from the user interface.

class MyExportPlugin extends EditorExportPlugin:
    func _get_name() -> String:
        return "MyExportPlugin"

    func _supports_platform(platform) -> bool:
        if platform is EditorExportPlatformPC:
            # Run on all desktop platforms including Windows, MacOS and Linux.
            return true
        return false

    func _get_export_options_overrides(platform) -> Dictionary:
        # Override "Embed PCK" to always be enabled.
        return {
            "binary_format/embed_pck": true,
        }

String _get_name() virtual required const 🔗

Return the name identifier of this plugin (for future identification by the exporter). The plugins are sorted by name before exporting.

Implementing this method is required.


bool _should_update_export_options(platform: EditorExportPlatform) virtual const 🔗

Renvoie true si le résultat de _get_export_options() a changé et les options d'export du préréglage correspondant à platform devraient être mises à jour.


bool _supports_platform(platform: EditorExportPlatform) virtual const 🔗

Renvoie true si le plugin supporte la plate-forme platform donnée.


PackedByteArray _update_android_prebuilt_manifest(platform: EditorExportPlatform, manifest_data: PackedByteArray) virtual const 🔗

Provide access to the Android prebuilt manifest and allows the plugin to modify it if needed.

Implementers of this virtual method should take the binary manifest data from manifest_data, copy it, modify it, and then return it with the modifications.

If no modifications are needed, then an empty PackedByteArray should be returned.


void add_apple_embedded_platform_bundle_file(path: String) 🔗

Ajoute un fichier de paquet de plate-forme intégré d'Apple depuis path au projet exporté.


void add_apple_embedded_platform_cpp_code(code: String) 🔗

Ajoute du code C++ à l'export de plate-forme intégrée Apple. Le code final est créé à partir du code ajouté par chaque plugin d'export actif.


void add_apple_embedded_platform_embedded_framework(path: String) 🔗

Ajoute une bibliothèque dynamique (*.dylib, *.framework) au "Linking Phase" dans le projet Xcode de la plateforme intégrée Apple et l'intègre au binaire final.

Note : Pour les bibliothèques statiques (*.a), cela fonctionne de la même manière que add_apple_embedded_platform_framework().

Note : Cette méthode ne devrait pas être utilisée pour les bibliothèques système car elles sont déjà présentes sur l'appareil.


void add_apple_embedded_platform_framework(path: String) 🔗

Adds a static library (*.a) or a dynamic library (*.dylib, *.framework) to the Linking Phase to the Apple embedded platform's Xcode project.


void add_apple_embedded_platform_linker_flags(flags: String) 🔗

Adds linker flags for the Apple embedded platform export.


void add_apple_embedded_platform_plist_content(plist_content: String) 🔗

Adds additional fields to the Apple embedded platform's project Info.plist file.


void add_apple_embedded_platform_project_static_lib(path: String) 🔗

Ajoute une bibliothèque statique depuis path au projet de plateforme intégré Apple.


void add_file(path: String, file: PackedByteArray, remap: bool) 🔗

Ajoute un fichier personnalisé à exporter. path est le chemin virtuel qui peut être utilisé pour charger le fichier, file représente les données binaires du fichier.

Quand appelée au sein de _export_file() et lorsque remap est true, le fichier ne sera pas exporté, mais sera remplacé par une référence à ce fichier. remap est ignoré quand appelé dans d'autres endroits.

file ne sera pas importé, alors envisagez d'utiliser _customize_resource() pour remapper les ressources importées.


void add_ios_bundle_file(path: String) 🔗

Obsolète : Use add_apple_embedded_platform_bundle_file() instead.

Ajoute un fichier d'iOS depuis path au projet exporté.


void add_ios_cpp_code(code: String) 🔗

Obsolète : Use add_apple_embedded_platform_cpp_code() instead.

Adds C++ code to the iOS export. The final code is created from the code appended by each active export plugin.


void add_ios_embedded_framework(path: String) 🔗

Obsolète : Use add_apple_embedded_platform_embedded_framework() instead.

Ajoute une bibliothèque dynamique (*.dylib, *.framework) au "Linking Phase" dans le projet Xcode d'iOS et l'intègre au binaire final.

Note : Pour les bibliothèques statiques (*.a), cela fonctionne de la même manière que add_apple_embedded_platform_framework().

Note : Cette méthode ne devrait pas être utilisée pour les bibliothèques système car elles sont déjà présentes sur l'appareil.


void add_ios_framework(path: String) 🔗

Obsolète : Use add_apple_embedded_platform_framework() instead.

Adds a static library (*.a) or a dynamic library (*.dylib, *.framework) to the Linking Phase to the iOS Xcode project.


void add_ios_linker_flags(flags: String) 🔗

Obsolète : Use add_apple_embedded_platform_linker_flags() instead.

Ajoute un drapeau à l'assembleur pour l'export iOS.


void add_ios_plist_content(plist_content: String) 🔗

Obsolète : Use add_apple_embedded_platform_plist_content() instead.

Adds additional fields to the iOS project Info.plist file.


void add_ios_project_static_lib(path: String) 🔗

Obsolète : Use add_apple_embedded_platform_project_static_lib() instead.

Ajoute une bibliothèque statique depuis path au projet iOS.


void add_macos_plugin_file(path: String) 🔗

Ajoute le fichier ou le dossier correspondant à l'emplacement path au dossier PlugIns de l'application macOS.

Note : Cela n'est utile que pour les exports macOS.


void add_shared_object(path: String, tags: PackedStringArray, target: String) 🔗

Ajoute un objet partagé ou un dossier contenant uniquement des objets partagés avec les étiquettestags et la destination path.

Note : En cas d'exportation pour macOS, ces objets partagés seront ajoutés au dossier Frameworks de l'app bundle.

Pour les dossiers, "code-sign" affichera une erreur si vous placez dans ce dossier un objet qui n'est pas du code.


EditorExportPlatform get_export_platform() const 🔗

Renvoie la plateforme d'export actuellement utilisée.


EditorExportPreset get_export_preset() const 🔗

Renvoie le préreglage d'export actuellement utilisé.


Variant get_option(name: StringName) const 🔗

Renvoie la valeur actuelle d'une option d'export fournie par _get_export_options().


void skip() 🔗

Sera appelée dans _export_file(). Ignore le fichier actuel, il ne figurera donc pas dans l'export.