Explorar o código

Merge pull request #12725 from karroffel/gdnative-api-fixes

[GDNative] even more API fixes
Rémi Verschelde %!s(int64=7) %!d(string=hai) anos
pai
achega
77345916c5

+ 5 - 0
modules/gdnative/gdnative/array.cpp

@@ -158,6 +158,11 @@ godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot
 	return (godot_variant *)&self->operator[](p_idx);
 }
 
+const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx) {
+	const Array *self = (const Array *)p_self;
+	return (const godot_variant *)&self->operator[](p_idx);
+}
+
 void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value) {
 	Array *self = (Array *)p_self;
 	Variant *val = (Variant *)p_value;

+ 6 - 0
modules/gdnative/gdnative/dictionary.cpp

@@ -130,6 +130,12 @@ godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, c
 	return (godot_variant *)&self->operator[](*key);
 }
 
+const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key) {
+	const Dictionary *self = (const Dictionary *)p_self;
+	const Variant *key = (const Variant *)p_key;
+	return (const godot_variant *)&self->operator[](*key);
+}
+
 godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key) {
 	Dictionary *self = (Dictionary *)p_self;
 	const Variant *key = (const Variant *)p_key;

+ 23 - 0
modules/gdnative/gdnative_api.json

@@ -2488,6 +2488,14 @@
         ["const godot_int", "p_idx"]
       ]
     },
+    {
+      "name": "godot_array_operator_index_const",
+      "return_type": "const godot_variant *",
+      "arguments": [
+        ["const godot_array *", "p_self"],
+        ["const godot_int", "p_idx"]
+      ]
+    },
     {
       "name": "godot_array_append",
       "return_type": "void",
@@ -2786,6 +2794,14 @@
         ["const godot_variant *", "p_key"]
       ]
     },
+    {
+      "name": "godot_dictionary_operator_index_const",
+      "return_type": "const godot_variant *",
+      "arguments": [
+        ["const godot_dictionary *", "p_self"],
+        ["const godot_variant *", "p_key"]
+      ]
+    },
     {
       "name": "godot_dictionary_next",
       "return_type": "godot_variant *",
@@ -5644,6 +5660,13 @@
         ["godot_object *", "p_instance"]
       ]
     },
+    {
+      "name": "godot_pluginscript_register_language",
+      "return_type": "void",
+      "arguments": [
+        ["const godot_pluginscript_language_desc *", "language_desc"]
+      ]
+    },
     {
       "name": "godot_arvr_register_interface",
       "return_type": "void",

+ 2 - 0
modules/gdnative/include/gdnative/array.h

@@ -76,6 +76,8 @@ godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p
 
 godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx);
 
+const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx);
+
 void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value);
 
 void GDAPI godot_array_clear(godot_array *p_self);

+ 2 - 0
modules/gdnative/include/gdnative/dictionary.h

@@ -85,6 +85,8 @@ void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p
 
 godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key);
 
+const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key);
+
 godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key);
 
 godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);