summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorsheepandshepherd <sheepandshepherd@hotmail.com>2017-10-08 23:51:24 +0200
committersheepandshepherd <sheepandshepherd@hotmail.com>2017-10-08 23:57:06 +0200
commit6f3fffecb390aacb8cac1f20f0a3fe0665e226e4 (patch)
treed7f3202aac1577f9e156e457494efa6158ecc915 /modules
parentb9702991a199109b6dce1d6b54800b1e9235aa57 (diff)
Include property index in GDNative class API
Needed by properties that share set/get functions. Fixes #10329.
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index fdd5a2ea19..9a956ff594 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -80,6 +80,7 @@ struct PropertyAPI {
String getter;
String setter;
String type;
+ int index;
};
struct ConstantAPI {
@@ -259,6 +260,8 @@ List<ClassAPI> generate_c_api_classes() {
property_api.type = get_type_name(p->get());
}
+ property_api.index = ClassDB::get_property_index(class_name, p->get().name);
+
if (!property_api.setter.empty() || !property_api.getter.empty()) {
class_api.properties.push_back(property_api);
}
@@ -395,7 +398,8 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n");
source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n");
- source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\"\n");
+ source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\",\n");
+ source.push_back(String("\t\t\t\t\"index\": ") + itos(e->get().index) + "\n");
source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
}
source.push_back("\t\t],\n");