summaryrefslogtreecommitdiff
path: root/core/extension
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-08-23 14:53:27 -0300
committerreduz <reduzio@gmail.com>2021-08-23 19:58:40 -0300
commit44d62a9f4b6ac892b1fb9b8998be4162409952e3 (patch)
treecbc5ffa6979314def8adbc229cd94b4adf8afb1c /core/extension
parent679b9be9d30001e8ffc8087e412097f7394cacdd (diff)
Implement NativeExtension pointer arguments
* Allows calling into native extensions directly with a pointer * Makes it easier to implement some APIs more efficiently * Appears with a "*" in the documentation for the argument. * Implementing the pointer handling is entirely up to the implementation, although the extension API provides some hint. * AudioStream has been implemented as an example, allowing to create NativeExtension based AudioStreams.
Diffstat (limited to 'core/extension')
-rw-r--r--core/extension/extension_api_dump.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index 46dc5f284b..a8547a0090 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -39,6 +39,13 @@
#ifdef TOOLS_ENABLED
static String get_type_name(const PropertyInfo &p_info) {
+ if (p_info.type == Variant::INT && (p_info.hint == PROPERTY_HINT_INT_IS_POINTER)) {
+ if (p_info.hint_string == "") {
+ return "void*";
+ } else {
+ return p_info.hint_string + "*";
+ }
+ }
if (p_info.type == Variant::INT && (p_info.usage & PROPERTY_USAGE_CLASS_IS_ENUM)) {
return String("enum::") + String(p_info.class_name);
}
@@ -831,6 +838,20 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
}
}
+ {
+ Array native_structures;
+
+ {
+ Dictionary d;
+ d["name"] = "AudioFrame";
+ d["format"] = "float left,float right";
+
+ native_structures.push_back(d);
+ }
+
+ api_dump["native_structures"] = native_structures;
+ }
+
return api_dump;
}