summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-10-09 13:55:36 +0200
committerGitHub <noreply@github.com>2017-10-09 13:55:36 +0200
commitea37f44ec84edb3309845bfb27e863d5aa529ce4 (patch)
treebe8a1cb41eecfc9369c686d2377d4422c7caed26 /modules
parentbf0b32819766124c9d0ddaf63eb59d54959c8bef (diff)
parent6f3fffecb390aacb8cac1f20f0a3fe0665e226e4 (diff)
Merge pull request #11950 from sheepandshepherd/gdnative_property_index
Include property index in GDNative class API
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");