Skip to main content

IEditorExportPlugin

Trait IEditorExportPlugin 

pub trait IEditorExportPlugin: GodotClass<Base = EditorExportPlugin> + You_forgot_the_attribute__godot_api {
Show 33 methods // Required methods fn customize_resource( &mut self, resource: Gd<Resource>, path: GString, ) -> Option<Gd<Resource>>; fn customize_scene( &mut self, scene: Gd<Node>, path: GString, ) -> Option<Gd<Node>>; fn get_customization_configuration_hash(&self) -> u64; fn get_name(&self) -> GString; // Provided methods fn init(base: Base<Self::Base>) -> Self { ... } fn on_notification(&mut self, what: ObjectNotification) { ... } fn on_get(&self, property: StringName) -> Option<Variant> { ... } fn on_set(&mut self, property: StringName, value: Variant) -> bool { ... } fn on_validate_property(&self, property: &mut PropertyInfo) { ... } fn on_get_property_list(&mut self) -> Vec<PropertyInfo> { ... } fn on_property_get_revert(&self, property: StringName) -> Option<Variant> { ... } fn to_string(&self) -> GString { ... } fn export_file( &mut self, path: GString, type_: GString, features: PackedArray<GString>, ) { ... } fn export_begin( &mut self, features: PackedArray<GString>, is_debug: bool, path: GString, flags: u32, ) { ... } fn export_end(&mut self) { ... } fn begin_customize_resources( &self, platform: Option<Gd<EditorExportPlatform>>, features: PackedArray<GString>, ) -> bool { ... } fn begin_customize_scenes( &self, platform: Option<Gd<EditorExportPlatform>>, features: PackedArray<GString>, ) -> bool { ... } fn end_customize_scenes(&mut self) { ... } fn end_customize_resources(&mut self) { ... } fn get_export_options( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> Array<AnyDictionary> { ... } fn get_export_options_overrides( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> AnyDictionary { ... } fn should_update_export_options( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> bool { ... } fn get_export_option_visibility( &self, platform: Option<Gd<EditorExportPlatform>>, option: GString, ) -> bool { ... } fn get_export_option_warning( &self, platform: Option<Gd<EditorExportPlatform>>, option: GString, ) -> GString { ... } fn get_export_features( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString> { ... } fn supports_platform( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> bool { ... } fn get_android_dependencies( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString> { ... } fn get_android_dependencies_maven_repos( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString> { ... } fn get_android_libraries( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString> { ... } fn get_android_manifest_activity_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString { ... } fn get_android_manifest_application_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString { ... } fn get_android_manifest_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString { ... } fn update_android_prebuilt_manifest( &self, platform: Option<Gd<EditorExportPlatform>>, manifest_data: PackedArray<u8>, ) -> PackedArray<u8> { ... }
}
Expand description

§Interface trait for class EditorExportPlugin.

Functions in this trait represent constructors (init) or virtual method callbacks invoked by the engine.

Base interfaces: IRefCounted > IObject.

See also Godot docs for EditorExportPlugin methods.

Required Methods§

fn customize_resource( &mut self, resource: Gd<Resource>, path: GString, ) -> Option<Gd<Resource>>

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:

fn customize_scene( &mut self, scene: Gd<Node>, path: GString, ) -> Option<Gd<Node>>

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.

fn get_customization_configuration_hash(&self) -> u64

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.

fn get_name(&self) -> GString

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.

Provided Methods§

fn init(base: Base<Self::Base>) -> Self

Godot constructor, accepting an injected base object.

base refers to the base instance of the class, which can either be stored in a Base<T> field or discarded. This method returns a fully-constructed instance, which will then be moved into a Gd<T> pointer.

If the class has a #[class(init)] attribute, this method will be auto-generated and must not be overridden.

fn on_notification(&mut self, what: ObjectNotification)

Called when the object receives a Godot notification.

The type of notification can be identified through what. The enum is designed to hold all possible NOTIFICATION_* constants that the current class can handle. However, this is not validated in Godot, so an enum variant Unknown exists to represent integers out of known constants (mistakes or future additions).

This method is named _notification in Godot, but on_notification in Rust. To send notifications, use the Object::notify method.

See also in Godot docs:

fn on_get(&self, property: StringName) -> Option<Variant>

Called whenever get() is called or Godot gets the value of a property.

Should return the given property’s value as Some(value), or None if the property should be handled normally.

See also in Godot docs:

fn on_set(&mut self, property: StringName, value: Variant) -> bool

Called whenever Godot set() is called or Godot sets the value of a property.

Should set property to the given value and return true, or return false to indicate the property should be handled normally.

See also in Godot docs:

fn on_validate_property(&self, property: &mut PropertyInfo)

Called whenever Godot retrieves value of property. Allows to customize existing properties. Every property info goes through this method, except properties added with on_get_property_list().

Exposed property here is a shared mutable reference obtained (and returned to) from Godot.

See also in the Godot docs:

fn on_get_property_list(&mut self) -> Vec<PropertyInfo>

Available on since_api=4.3 only.

Called whenever Godot get_property_list() is called, the returned vector here is appended to the existing list of properties.

This should mainly be used for advanced purposes, such as dynamically updating the property list in the editor.

See also in Godot docs:

fn on_property_get_revert(&self, property: StringName) -> Option<Variant>

Called by Godot to tell if a property has a custom revert or not.

Return None for no custom revert, and return Some(value) to specify the custom revert.

This is a combination of Godot’s Object::_property_get_revert and Object::_property_can_revert. This means that this function will usually be called twice by Godot to find the revert.

Note that this should be a pure function. That is, it should always return the same value for a property as long as self remains unchanged. Otherwise, this may lead to unexpected (safe) behavior.

fn to_string(&self) -> GString

String representation of the Godot instance.

Override this method to define how the instance is represented as a string. Used by impl Display for Gd<T>, as well as str() and print() in GDScript.

fn export_file( &mut self, path: GString, type_: GString, features: PackedArray<GString>, )

Virtual method to be overridden by the user. Called for each exported file before customize_resource and customize_scene. The arguments can be used to identify the file. path is the path of the file, type is the Resource represented by the file (e.g. PackedScene), and features is the list of features for the export.

Calling skip inside this callback will make the file not included in the export.

fn export_begin( &mut self, features: PackedArray<GString>, is_debug: bool, path: GString, flags: u32, )

Virtual method to be overridden by the user. It is called when the export starts and provides all information about the export. features is the list of features for the export, is_debug is true for debug builds, path is the target path for the exported project. flags is only used when running a runnable profile, e.g. when using native run on Android.

fn export_end(&mut self)

Virtual method to be overridden by the user. Called when the export is finished.

fn begin_customize_resources( &self, platform: Option<Gd<EditorExportPlatform>>, features: PackedArray<GString>, ) -> bool

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.

fn begin_customize_scenes( &self, platform: Option<Gd<EditorExportPlatform>>, features: PackedArray<GString>, ) -> bool

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.

fn end_customize_scenes(&mut self)

This is called when the customization process for scenes ends.

fn end_customize_resources(&mut self)

This is called when the customization process for resources ends.

fn get_export_options( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> Array<AnyDictionary>

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 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.

fn get_export_options_overrides( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> AnyDictionary

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,
		}

fn should_update_export_options( &self, platform: Option<Gd<EditorExportPlatform>>, ) -> bool

Return true if the result of get_export_options has changed and the export options of the preset corresponding to platform should be updated.

fn get_export_option_visibility( &self, platform: Option<Gd<EditorExportPlatform>>, option: GString, ) -> bool

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

fn get_export_option_warning( &self, platform: Option<Gd<EditorExportPlatform>>, option: GString, ) -> GString

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.

fn get_export_features( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString>

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

fn supports_platform(&self, platform: Option<Gd<EditorExportPlatform>>) -> bool

Return true if the plugin supports the given platform.

fn get_android_dependencies( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString>

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn get_android_dependencies_maven_repos( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString>

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn get_android_libraries( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> PackedArray<GString>

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn get_android_manifest_activity_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn get_android_manifest_application_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn get_android_manifest_element_contents( &self, platform: Option<Gd<EditorExportPlatform>>, debug: bool, ) -> GString

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 [member EditorExportPlatformAndroid.gradle_build/use_gradle_build] to be enabled.

fn update_android_prebuilt_manifest( &self, platform: Option<Gd<EditorExportPlatform>>, manifest_data: PackedArray<u8>, ) -> PackedArray<u8>

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§