mirror of
https://github.com/godotengine/godot-cpp.git
synced 2025-12-31 01:48:45 +03:00
Merge pull request #1780 from piiertho/expose-object-set-script-instance
Expose gdextension_object_get_script_instance method from engine
This commit is contained in:
@@ -34,15 +34,16 @@
|
||||
* Together with the JSON file, you should be able to generate any binder.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef uint32_t char32_t;
|
||||
typedef uint16_t char16_t;
|
||||
#endif
|
||||
#else
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -792,9 +793,22 @@ typedef struct {
|
||||
const char *string;
|
||||
} GDExtensionGodotVersion;
|
||||
|
||||
typedef struct {
|
||||
uint32_t major;
|
||||
uint32_t minor;
|
||||
uint32_t patch;
|
||||
uint32_t hex; // Full version encoded as hexadecimal with one byte (2 hex digits) per number (e.g. for "3.1.12" it would be 0x03010C)
|
||||
const char *status; // (e.g. "stable", "beta", "rc1", "rc2")
|
||||
const char *build; // (e.g. "custom_build")
|
||||
const char *hash; // Full Git commit hash.
|
||||
uint64_t timestamp; // Git commit date UNIX timestamp in seconds, or 0 if unavailable.
|
||||
const char *string; // (e.g. "Godot v3.1.4.stable.official.mono")
|
||||
} GDExtensionGodotVersion2;
|
||||
|
||||
/**
|
||||
* @name get_godot_version
|
||||
* @since 4.1
|
||||
* @deprecated in Godot 4.5. Use `get_godot_version2` instead.
|
||||
*
|
||||
* Gets the Godot version that the GDExtension was loaded into.
|
||||
*
|
||||
@@ -802,6 +816,16 @@ typedef struct {
|
||||
*/
|
||||
typedef void (*GDExtensionInterfaceGetGodotVersion)(GDExtensionGodotVersion *r_godot_version);
|
||||
|
||||
/**
|
||||
* @name get_godot_version2
|
||||
* @since 4.5
|
||||
*
|
||||
* Gets the Godot version that the GDExtension was loaded into.
|
||||
*
|
||||
* @param r_godot_version A pointer to the structure to write the version information into.
|
||||
*/
|
||||
typedef void (*GDExtensionInterfaceGetGodotVersion2)(GDExtensionGodotVersion2 *r_godot_version);
|
||||
|
||||
/* INTERFACE: Memory */
|
||||
|
||||
/**
|
||||
@@ -2723,6 +2747,17 @@ typedef void (*GDExtensionInterfacePlaceHolderScriptInstanceUpdate)(GDExtensionS
|
||||
*/
|
||||
typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptInstance)(GDExtensionConstObjectPtr p_object, GDExtensionObjectPtr p_language);
|
||||
|
||||
/**
|
||||
* @name object_set_script_instance
|
||||
* @since 4.5
|
||||
*
|
||||
* Set the script instance data attached to this object.
|
||||
*
|
||||
* @param p_object A pointer to the Object.
|
||||
* @param p_script_instance A pointer to the script instance data to attach to this object.
|
||||
*/
|
||||
typedef void (*GDExtensionInterfaceObjectSetScriptInstance)(GDExtensionObjectPtr p_object, GDExtensionScriptInstanceDataPtr p_script_instance);
|
||||
|
||||
/* INTERFACE: Callable */
|
||||
|
||||
/**
|
||||
@@ -3086,7 +3121,7 @@ typedef void (*GDExtensionsInterfaceEditorHelpLoadXmlFromUtf8CharsAndLen)(const
|
||||
*
|
||||
* Registers a callback that Godot can call to get the list of all classes (from ClassDB) that may be used by the calling GDExtension.
|
||||
*
|
||||
* This is used by the editor to generate a build profiles (in "Tools" > "Engine Compilation Configuration Editor..." > "Detect from project"),
|
||||
* This is used by the editor to generate a build profile (in "Tools" > "Engine Compilation Configuration Editor..." > "Detect from project"),
|
||||
* in order to recompile Godot with only the classes used.
|
||||
* In the provided callback, the GDExtension should provide the list of classes that _may_ be used statically, thus the time of invocation shouldn't matter.
|
||||
* If a GDExtension doesn't register a callback, Godot will assume that it could be using any classes.
|
||||
|
||||
@@ -181,6 +181,8 @@ extern "C" GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object
|
||||
extern "C" GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3;
|
||||
extern "C" GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create;
|
||||
extern "C" GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update;
|
||||
extern "C" GDExtensionInterfaceObjectGetScriptInstance gdextension_interface_object_get_script_instance;
|
||||
extern "C" GDExtensionInterfaceObjectSetScriptInstance gdextension_interface_object_set_script_instance;
|
||||
extern "C" GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2;
|
||||
extern "C" GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind;
|
||||
extern "C" GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag;
|
||||
|
||||
@@ -188,6 +188,8 @@ GDExtensionInterfaceRefSetObject gdextension_interface_ref_set_object = nullptr;
|
||||
GDExtensionInterfaceScriptInstanceCreate3 gdextension_interface_script_instance_create3 = nullptr;
|
||||
GDExtensionInterfacePlaceHolderScriptInstanceCreate gdextension_interface_placeholder_script_instance_create = nullptr;
|
||||
GDExtensionInterfacePlaceHolderScriptInstanceUpdate gdextension_interface_placeholder_script_instance_update = nullptr;
|
||||
GDExtensionInterfaceObjectGetScriptInstance gdextension_interface_object_get_script_instance = nullptr;
|
||||
GDExtensionInterfaceObjectSetScriptInstance gdextension_interface_object_set_script_instance = nullptr;
|
||||
GDExtensionInterfaceClassdbConstructObject2 gdextension_interface_classdb_construct_object2 = nullptr;
|
||||
GDExtensionInterfaceClassdbGetMethodBind gdextension_interface_classdb_get_method_bind = nullptr;
|
||||
GDExtensionInterfaceClassdbGetClassTag gdextension_interface_classdb_get_class_tag = nullptr;
|
||||
@@ -471,6 +473,8 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge
|
||||
LOAD_PROC_ADDRESS(script_instance_create3, GDExtensionInterfaceScriptInstanceCreate3);
|
||||
LOAD_PROC_ADDRESS(placeholder_script_instance_create, GDExtensionInterfacePlaceHolderScriptInstanceCreate);
|
||||
LOAD_PROC_ADDRESS(placeholder_script_instance_update, GDExtensionInterfacePlaceHolderScriptInstanceUpdate);
|
||||
LOAD_PROC_ADDRESS(object_get_script_instance, GDExtensionInterfaceObjectGetScriptInstance);
|
||||
LOAD_PROC_ADDRESS(object_set_script_instance, GDExtensionInterfaceObjectSetScriptInstance);
|
||||
LOAD_PROC_ADDRESS(classdb_construct_object2, GDExtensionInterfaceClassdbConstructObject2);
|
||||
LOAD_PROC_ADDRESS(classdb_get_method_bind, GDExtensionInterfaceClassdbGetMethodBind);
|
||||
LOAD_PROC_ADDRESS(classdb_get_class_tag, GDExtensionInterfaceClassdbGetClassTag);
|
||||
|
||||
Reference in New Issue
Block a user