summaryrefslogtreecommitdiff
path: root/core/extension
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-01 18:10:26 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-01 18:10:26 +0100
commit96796c151896929f01a831bbf2ab64ab18004bcd (patch)
tree1dabfa21ef03dd2c441318817c68d82b9647fb59 /core/extension
parentfc2241d5d89802d2a31040e0fae3bc0f68f1de33 (diff)
parenta2e6e996b28fe771c2594010fb3db098f918f49a (diff)
Merge pull request #64427 from touilleMan/gdextension-skip-undefined-field-in-properties
[GDExtension] Skip unset getter/setter/index fields in class property
Diffstat (limited to 'core/extension')
-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 22787a9847..196bb68b2b 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);
}