summaryrefslogtreecommitdiffstats
path: root/src/classes/wrapped.cpp
diff options
context:
space:
mode:
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