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...
Vendor Runtime Module
Un Vendor Runtime Module è un modulo di Godot applicabile solo in fase di esecuzione di un progetto. Si crea come un normale modulo C++ personalizzato, ma è impacchettato tramite un'estensione dell'editor per rendere le funzionalità offerte facilmente accessibili e utilizzabili dentro un progetto Godot standard.
Perché?
Vendor runtime modules provide developers with access to vendor-specific optimizations, features, and/or platforms for their running projects.
This provides benefits to vendors who are able to expose their technologies to all developers, and improve and refine them in a rapid, iterative, and frictionless manner. This also provides benefits to developers and users who are able to access and use a diverse range of vendor technologies to improve their games.
Creating a vendor runtime module
Generare modelli di esportazione
Assicurarsi di seguire le istruzioni per creare un modulo C++ personalizzato.
Poiché è un modulo runtime la cui funzionalità dovrebbe essere accessibile solo dal progetto in esecuzione, bisogna generare un modello di esportazione per ogni piattaforma che si intende supportare. Consultare le pagine Compilazione per ulteriori informazioni.
Creating the wrapper editor plugin
Una volta generati i modelli di esportazione, bisogna creare un'estensione dell'editor per impacchettarli e renderli facilmente accessibili agli utenti finali tramite il Godot Asset Store.
Segui queste istruzioni per iniziare a creare l'estensione. Lo script base della tua estensione dovrebbe essere simile al seguente:
@tool
extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here.
pass
func _exit_tree():
# Clean-up of the plugin goes here.
pass
Il passo successivo consiste nel definire e creare un'istanza di EditorExportPlugin. L'istanza di EditorExportPlugin serve per integrarsi nel flusso di esportazione e sostituire i modelli di esportazione predefiniti con quelli generati dal modulo runtime del fornitore.
Usando il codice della nostra estensione base per l'editor riportato sopra, un implementazione di esempio sarebbe così:
@tool
extends EditorPlugin
# A class member to hold the editor export plugin during its lifecycle.
var export_plugin: VRMExportPlugin
func _enter_tree():
# Initialization of the plugin goes here.
export_plugin = VRMExportPlugin.new()
add_export_plugin(export_plugin)
func _exit_tree():
# Clean-up of the plugin goes here.
remove_export_plugin(export_plugin)
export_plugin = null
class VRMExportPlugin extends EditorExportPlugin:
var _path_to_debug_export_template = ""
var _path_to_release_export_template = ""
# Return true for all supported platforms.
func _supports_platform(platform):
return platform is EditorExportPlatformAndroid
# Overrides the default export templates.
func _get_export_options_overrides(platform):
var overrides = {}
if not _supports_platform(platform):
return overrides
# Overrides Android export preset's "custom_template" options.
overrides["custom_template/debug"] = _path_to_debug_export_template
overrides["custom_template/release"] = _path_to_release_export_template
return overrides
# Optional: specify additional export preset options to customize the export template.
func _get_export_options(platform):
pass
func _get_name():
return "VRM Plugin"
Suggerimento
This section covers the basics to wrap and expose a vendor runtime module via an editor plugin, but editor plugins have a lot more functionality that can be used to customize the editor further. Feel free to explore and leverage those functionalities to improve the user experience for your vendor runtime module.