diff options
author | Pierre-Thomas Meisels <meisels27@yahoo.fr> | 2022-04-18 20:17:03 +0200 |
---|---|---|
committer | Pierre-Thomas Meisels <meisels27@yahoo.fr> | 2022-06-23 19:19:22 +0200 |
commit | c28936ba6d109b9880d34e9b1f41d409428d109b (patch) | |
tree | 867c8b07521918663cd43249a1e378e9dd03ad4e /core/extension | |
parent | 462127eff08c8ca60a1e4a476153bdb60d63b890 (diff) |
Add core types enums description to extension api json
Diffstat (limited to 'core/extension')
-rw-r--r-- | core/extension/extension_api_dump.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index edd48cf9cd..9d846f87c2 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -474,6 +474,38 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { } } { + //enums + Array enums; + + List<StringName> enum_names; + Variant::get_enums_for_type(type, &enum_names); + for (const StringName &enum_name : enum_names) { + Dictionary enum_dict; + enum_dict["name"] = String(enum_name); + + List<StringName> enumeration_names; + Variant::get_enumerations_for_enum(type, enum_name, &enumeration_names); + + Array values; + + for (const StringName &enumeration : enumeration_names) { + Dictionary values_dict; + values_dict["name"] = String(enumeration); + values_dict["value"] = Variant::get_enum_value(type, enum_name, enumeration); + values.push_back(values_dict); + } + + if (values.size()) { + enum_dict["values"] = values; + } + enums.push_back(enum_dict); + } + + if (enums.size()) { + d["enums"] = enums; + } + } + { //operators Array operators; |