summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Leblond <emmanuel.leblond@gmail.com>2022-08-15 11:09:14 +0200
committerEmmanuel Leblond <emmanuel.leblond@gmail.com>2022-11-12 20:13:00 +0100
commita2e6e996b28fe771c2594010fb3db098f918f49a (patch)
treee8e8bde09c32673a440e763b92c59525d9ffd281
parentc17f17eb98188a7134c85bdbdf0123127c462046 (diff)
Skip unset getter/setter/index fields in class property when generating extension_api.json
-rw-r--r--core/extension/extension_api_dump.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp
index a2c507e350..e3bde08cde 100644
--- a/core/extension/extension_api_dump.cpp
+++ b/core/extension/extension_api_dump.cpp
@@ -871,9 +871,18 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() {
Dictionary d2;
d2["type"] = get_property_info_type_name(F);
d2["name"] = String(property_name);
- d2["setter"] = ClassDB::get_property_setter(class_name, F.name);
- d2["getter"] = ClassDB::get_property_getter(class_name, F.name);
- d2["index"] = ClassDB::get_property_index(class_name, F.name);
+ StringName setter = ClassDB::get_property_setter(class_name, F.name);
+ if (!(setter == "")) {
+ d2["setter"] = setter;
+ }
+ StringName getter = ClassDB::get_property_getter(class_name, F.name);
+ if (!(getter == "")) {
+ d2["getter"] = getter;
+ }
+ int index = ClassDB::get_property_index(class_name, F.name);
+ if (index != -1) {
+ d2["index"] = index;
+ }
properties.push_back(d2);
}