summaryrefslogtreecommitdiffstats
path: root/src/classes/wrapped.cpp
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-07-26 15:31:15 -0500
committerGitHub <noreply@github.com>2023-07-26 15:31:15 -0500
commit1d49bef0966aed58249aaed2c468306493e884bf (patch)
tree15c53f66edef46597fd7a52bf4fc97d42718d5dc /src/classes/wrapped.cpp
parentd15550fdee5ce28c0e6aac8745fe515e849eea06 (diff)
parentbaf0b9e0f73d10dfab07189fc12c4ed0906eedf0 (diff)
downloadredot-cpp-1d49bef0966aed58249aaed2c468306493e884bf.tar.gz
Merge pull request #1184 from Zylann/fix_get_property_list_calling_parent
Don't call parent _get_property_list when a class doesn't define it (for internal binding).
Diffstat (limited to 'src/classes/wrapped.cpp')
-rw-r--r--src/classes/wrapped.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/classes/wrapped.cpp b/src/classes/wrapped.cpp
index 62088a5..1e9239c 100644
--- a/src/classes/wrapped.cpp
+++ b/src/classes/wrapped.cpp
@@ -60,4 +60,33 @@ void postinitialize_handler(Wrapped *p_wrapped) {
p_wrapped->_postinitialize();
}
+namespace internal {
+
+GDExtensionPropertyInfo *create_c_property_list(const ::godot::List<::godot::PropertyInfo> &plist_cpp, uint32_t *r_size) {
+ GDExtensionPropertyInfo *plist = nullptr;
+ // Linked list size can be expensive to get so we cache it
+ const uint32_t plist_size = plist_cpp.size();
+ if (r_size != nullptr) {
+ *r_size = plist_size;
+ }
+ plist = reinterpret_cast<GDExtensionPropertyInfo *>(memalloc(sizeof(GDExtensionPropertyInfo) * plist_size));
+ unsigned int i = 0;
+ for (const ::godot::PropertyInfo &E : plist_cpp) {
+ plist[i].type = static_cast<GDExtensionVariantType>(E.type);
+ plist[i].name = E.name._native_ptr();
+ plist[i].hint = E.hint;
+ plist[i].hint_string = E.hint_string._native_ptr();
+ plist[i].class_name = E.class_name._native_ptr();
+ plist[i].usage = E.usage;
+ ++i;
+ }
+ return plist;
+}
+
+void free_c_property_list(GDExtensionPropertyInfo *plist) {
+ memfree(plist);
+}
+
+} // namespace internal
+
} // namespace godot