Documentation
¶
Overview ¶
[graphics.gd/classdb/EditorExportPlugin]s are automatically invoked whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, [Interface.ExportBegin] is called at the beginning of the export process and then [Interface.ExportFile] is called for each exported file.
To use graphics.gd/classdb/EditorExportPlugin, register it using the graphics.gd/classdb/EditorPlugin.Instance.AddExportPlugin method first.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AddFile(path string, file []byte, remap bool)
- func (self Instance) AddIosBundleFile(path string)
- func (self Instance) AddIosCppCode(code string)
- func (self Instance) AddIosEmbeddedFramework(path string)
- func (self Instance) AddIosFramework(path string)
- func (self Instance) AddIosLinkerFlags(flags string)
- func (self Instance) AddIosPlistContent(plist_content string)
- func (self Instance) AddIosProjectStaticLib(path string)
- func (self Instance) AddMacosPluginFile(path string)
- func (self Instance) AddSharedObject(path string, tags []string, target string)
- func (self Instance) AsEditorExportPlugin() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) GetExportPlatform() EditorExportPlatform.Instance
- func (self Instance) GetExportPreset() EditorExportPreset.Instance
- func (self Instance) GetOption(name string) any
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Skip()
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsEditorExportPlugin ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.EditorExportPlugin
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddFile ¶
Adds a custom file to be exported. 'path' is the virtual path that can be used to load the file, 'file' is the binary data of the file.
When called inside [Interface.ExportFile] and 'remap' is true, the current file will not be exported, but instead remapped to this custom file. 'remap' is ignored when called in other places.
'file' will not be imported, so consider using [Interface.CustomizeResource] to remap imported resources.
func (Instance) AddIosBundleFile ¶
Adds an iOS bundle file from the given 'path' to the exported project.
func (Instance) AddIosCppCode ¶
Adds a C++ code to the iOS export. The final code is created from the code appended by each active export plugin.
func (Instance) AddIosEmbeddedFramework ¶
Adds a dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project and embeds it into resulting binary.
Note: For static libraries (*.a) works in same way as Instance.AddIosFramework.
Note: This method should not be used for System libraries as they are already present on the device.
func (Instance) AddIosFramework ¶
Adds a static library (*.a) or dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project.
func (Instance) AddIosLinkerFlags ¶
Adds linker flags for the iOS export.
func (Instance) AddIosPlistContent ¶
Adds content for iOS Property List files.
func (Instance) AddIosProjectStaticLib ¶
Adds a static lib from the given 'path' to the iOS project.
func (Instance) AddMacosPluginFile ¶
Adds file or directory matching 'path' to PlugIns directory of macOS app bundle.
Note: This is useful only for macOS exports.
func (Instance) AddSharedObject ¶
Adds a shared object or a directory containing only shared objects with the given 'tags' and destination 'path'.
Note: In case of macOS exports, those shared objects will be added to Frameworks directory of app bundle.
In case of a directory code-sign will error if you place non code object in directory.
func (Instance) AsEditorExportPlugin ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) GetExportPlatform ¶
func (self Instance) GetExportPlatform() EditorExportPlatform.Instance
Returns currently used export platform.
func (Instance) GetExportPreset ¶
func (self Instance) GetExportPreset() EditorExportPreset.Instance
Returns currently used export preset.
func (Instance) GetOption ¶
Returns the current value of an export option supplied by [Interface.GetExportOptions].
type Interface ¶
type Interface interface { // Virtual method to be overridden by the user. Called for each exported file before [Interface.CustomizeResource] and [Interface.CustomizeScene]. The arguments can be used to identify the file. 'path' is the path of the file, 'type' is the [graphics.gd/classdb/Resource] represented by the file (e.g. [graphics.gd/classdb/PackedScene]), and 'features' is the list of features for the export. // // Calling [Instance.Skip] inside this callback will make the file not included in the export. ExportFile(path string, atype string, features []string) // 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. ExportBegin(features []string, is_debug bool, path string, flags int) // Virtual method to be overridden by the user. Called when the export is finished. ExportEnd() // Return true if this plugin will customize resources based on the platform and features used. // // When enabled, [Interface.GetCustomizationConfigurationHash] and [Interface.CustomizeResource] will be called and must be implemented. BeginCustomizeResources(platform EditorExportPlatform.Instance, features []string) bool // 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 [Interface.BeginCustomizeResources] returns true. // // Note: When customizing any of the following types and returning another resource, the other resource should not be skipped using [Instance.Skip] in [Interface.ExportFile]: // // - [graphics.gd/classdb/AtlasTexture] // // - [graphics.gd/classdb/CompressedCubemap] // // - [graphics.gd/classdb/CompressedCubemapArray] // // - [graphics.gd/classdb/CompressedTexture2D] // // - [graphics.gd/classdb/CompressedTexture2DArray] // // - [graphics.gd/classdb/CompressedTexture3D] CustomizeResource(resource Resource.Instance, path string) Resource.Instance // Return true if this plugin will customize scenes based on the platform and features used. // // When enabled, [Interface.GetCustomizationConfigurationHash] and [Interface.CustomizeScene] will be called and must be implemented. // // Note: [Interface.CustomizeScene] will only be called for scenes that have been modified since the last export. BeginCustomizeScenes(platform EditorExportPlatform.Instance, features []string) bool // 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 [Interface.BeginCustomizeScenes] returns true. CustomizeScene(scene Node.Instance, path string) Node.Instance // 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 [Interface.BeginCustomizeResources] returns true. GetCustomizationConfigurationHash() int // This is called when the customization process for scenes ends. EndCustomizeScenes() // This is called when the customization process for resources ends. EndCustomizeResources() // Return a list of export options that can be configured for this export plugin. // // Each element in the return value is a data structure with the following keys: // // - option: A dictionary with the structure documented by [graphics.gd/classdb/Object.Instance.GetPropertyList], 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 [Instance.OnObject.PropertyListChanged] when the option is changed. GetExportOptions(platform EditorExportPlatform.Instance) [][]struct { Option Object.PropertyInfo "gd:\"option\"" DefaultValue interface{} "gd:\"default_value\"" UpdateVisibility bool "gd:\"update_visibility\"" } // Return a data structure 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, // // } // // GetExportOptionsOverrides(platform EditorExportPlatform.Instance) map[string]interface{} // Return true, if the result of [Interface.GetExportOptions] has changed and the export options of preset corresponding to 'platform' should be updated. ShouldUpdateExportOptions(platform EditorExportPlatform.Instance) bool // Optional. // // Validates 'option' and returns the visibility for the specified 'platform'. The default implementation returns true for all options. GetExportOptionVisibility(platform EditorExportPlatform.Instance, option string) bool // Check the requirements for the given 'option' and return a non-empty warning string if they are not met. // // Note: Use [Instance.GetOption] to check the value of the export options. GetExportOptionWarning(platform EditorExportPlatform.Instance, option string) string // Return a []string of additional features this preset, for the given 'platform', should have. GetExportFeatures(platform EditorExportPlatform.Instance, debug bool) []string // 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. GetName() string // Return true if the plugin supports the given 'platform'. SupportsPlatform(platform EditorExportPlatform.Instance) bool // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. // // [Android documentation on dependencies]: https://developer.android.com/build/dependencies?agpversion GetAndroidDependencies(platform EditorExportPlatform.Instance, debug bool) []string // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. // // [Gradle documentation on dependency management]: https://docs.gradle.org/current/userguide/dependency_management.html#sec:maven_repo GetAndroidDependenciesMavenRepos(platform EditorExportPlatform.Instance, debug bool) []string // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. GetAndroidLibraries(platform EditorExportPlatform.Instance, debug bool) []string // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. GetAndroidManifestActivityElementContents(platform EditorExportPlatform.Instance, debug bool) string // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. GetAndroidManifestApplicationElementContents(platform EditorExportPlatform.Instance, debug bool) string // 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 [graphics.gd/classdb/EditorExportPlatformAndroid.Instance] "gradle_build/use_gradle_build" to be enabled. GetAndroidManifestElementContents(platform EditorExportPlatform.Instance, debug bool) string }