diff options
author | Bastiaan Olij <mux213@gmail.com> | 2018-05-30 18:49:07 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 18:49:07 +1000 |
commit | 3d9dffdef7d436cda779ee4a659476fa94c62a35 (patch) | |
tree | fa473f5c1a7b2d1820d5849f7fc8c26106e49ba8 | |
parent | 46bab3abc71156cd2da95312368f2c72abe7b151 (diff) | |
parent | 8901b3cf0050b107edc68a46005e67fd9aaf2999 (diff) |
Merge pull request #19171 from BastiaanOlij/add_arvr_interface_gdnative_version
Adding version info to GDNative ARVR interfaces
-rw-r--r-- | modules/gdnative/arvr/arvr_interface_gdnative.cpp | 4 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 2 | ||||
-rw-r--r-- | modules/gdnative/include/arvr/godot_arvr.h | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.cpp b/modules/gdnative/arvr/arvr_interface_gdnative.cpp index 49e0a19d9e..385c020a78 100644 --- a/modules/gdnative/arvr/arvr_interface_gdnative.cpp +++ b/modules/gdnative/arvr/arvr_interface_gdnative.cpp @@ -217,6 +217,10 @@ void ARVRInterfaceGDNative::process() { extern "C" { void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface) { + // If our major version is 0 or bigger then 10, we're likely looking at our constructor pointer from an older plugin + ERR_EXPLAINC("GDNative ARVR interfaces build for Godot 3.0 are not supported"); + ERR_FAIL_COND((p_interface->version.major == 0) || (p_interface->version.major > 10)); + Ref<ARVRInterfaceGDNative> new_interface; new_interface.instance(); new_interface->set_interface((godot_arvr_interface_gdnative *const)p_interface); diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 9fcf61af8a..c16f2d3b40 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -5966,7 +5966,7 @@ "type": "ARVR", "version": { "major": 1, - "minor": 0 + "minor": 1 }, "next": null, "api": [ diff --git a/modules/gdnative/include/arvr/godot_arvr.h b/modules/gdnative/include/arvr/godot_arvr.h index b9aedc0bef..63de62b507 100644 --- a/modules/gdnative/include/arvr/godot_arvr.h +++ b/modules/gdnative/include/arvr/godot_arvr.h @@ -37,7 +37,15 @@ extern "C" { #endif +// For future versions of the API we should only add new functions at the end of the structure and use the +// version info to detect whether a call is available + +// Use these to populate version in your plugin +#define GODOTVR_API_MAJOR 1 +#define GODOTVR_API_MINOR 0 + typedef struct { + godot_gdnative_api_version version; /* version of our API */ void *(*constructor)(godot_object *); void (*destructor)(void *); godot_string (*get_name)(const void *); |