From c4d7d7c02ec6855cd925841045c48b5fad401718 Mon Sep 17 00:00:00 2001 From: Micky Date: Mon, 8 Jan 2024 15:44:06 +0100 Subject: [PATCH] Add documentation for GDExtension & GDExtensionManager --- doc/classes/GDExtension.xml | 17 +++++++++++++++++ doc/classes/GDExtensionManager.xml | 19 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/classes/GDExtension.xml b/doc/classes/GDExtension.xml index ee55c891314..533b32218f6 100644 --- a/doc/classes/GDExtension.xml +++ b/doc/classes/GDExtension.xml @@ -1,31 +1,42 @@ + A native library for GDExtension. + The [GDExtension] resource type represents a [url=https://en.wikipedia.org/wiki/Shared_library]shared library[/url] which can expand the functionality of the engine. The [GDExtensionManager] singleton is responsible for loading, reloading, and unloading [GDExtension] resources. + [b]Note:[/b] GDExtension itself is not a scripting language and has no relation to [GDScript] resources. + $DOCS_URL/tutorials/scripting/gdextension/what_is_gdextension.html + $DOCS_URL/tutorials/scripting/gdextension/gdextension_cpp_example.html + Closes the current library. + [b]Note:[/b] You normally should not call this method directly. This is handled automatically by [method GDExtensionManager.unload_extension]. + Returns the lowest level required for this extension to be properly initialized (see the [enum InitializationLevel] enum). + Initializes the library bound to this GDextension at the given initialization [param level]. + [b]Note:[/b] You normally should not call this method directly. This is handled automatically by [method GDExtensionManager.load_extension]. + Returns [code]true[/code] if this extension's library has been opened. @@ -33,17 +44,23 @@ + Opens the library at the specified [param path]. + [b]Note:[/b] You normally should not call this method directly. This is handled automatically by [method GDExtensionManager.load_extension]. + The library is initialized at the same time as the core features of the engine. + The library is initialized at the same time as the engine's servers (such as [RenderingServer] or [PhysicsServer3D]). + The library is initialized at the same time as the engine's scene-related classes. + The library is initialized at the same time as the engine's editor classes. Only happens when loading the GDExtension in the editor. diff --git a/doc/classes/GDExtensionManager.xml b/doc/classes/GDExtensionManager.xml index 8d2515dc286..1ecb23a03bf 100644 --- a/doc/classes/GDExtensionManager.xml +++ b/doc/classes/GDExtensionManager.xml @@ -1,65 +1,82 @@ + Provides access to GDExtension functionality. + The GDExtensionManager loads, initializes, and keeps track of all available [GDExtension] libraries in the project. + [b]Note:[/b] Do not worry about GDExtension unless you know what you are doing. + $DOCS_URL/tutorials/scripting/gdextension/what_is_gdextension.html + $DOCS_URL/tutorials/scripting/gdextension/gdextension_cpp_example.html + Returns the [GDExtension] at the given file [param path], or [code]null[/code] if it has not been loaded or does not exist. + Returns the file paths of all currently loaded extensions. + Returns [code]true[/code] if the extension at the given file [param path] has already been loaded successfully. See also [method get_loaded_extensions]. + Loads an extension by absolute file path. The [param path] needs to point to a valid [GDExtension]. Returns [constant LOAD_STATUS_OK] if successful. + Reloads the extension at the given file path. The [param path] needs to point to a valid [GDExtension], otherwise this method may return either [constant LOAD_STATUS_NOT_LOADED] or [constant LOAD_STATUS_FAILED]. + [b]Note:[/b] You can only reload extensions in the editor. In release builds, this method always fails and returns [constant LOAD_STATUS_FAILED]. + Unloads an extension by file path. The [param path] needs to point to an already loaded [GDExtension], otherwise this method returns [constant LOAD_STATUS_NOT_LOADED]. - Emitted after the editor has automatically reloaded any extensions. + Emitted after the editor has finished reloading one or more extensions. + The extension has loaded successfully. + The extension has failed to load, possibly because it does not exist or has missing dependencies. + The extension has already been loaded. + The extension has not been loaded. + The extension requires the application to restart to fully load.