@@ -60,8 +60,66 @@ Object *get_object_instance_binding(GodotObject *p_engine_object) {
60
60
return reinterpret_cast <Object *>(gdextension_interface_object_get_instance_binding (p_engine_object, token, binding_callbacks));
61
61
}
62
62
63
+ TypedArray<Dictionary> convert_property_list (const std::vector<PropertyInfo> &p_list) {
64
+ TypedArray<Dictionary> va;
65
+ for (const PropertyInfo &pi : p_list) {
66
+ va.push_back (Dictionary (pi ));
67
+ }
68
+ return va;
69
+ }
70
+
63
71
} // namespace internal
64
72
73
+ MethodInfo::operator Dictionary () const {
74
+ Dictionary dict;
75
+ dict[" name" ] = name;
76
+ dict[" args" ] = internal::convert_property_list (arguments);
77
+ Array da;
78
+ for (int i = 0 ; i < default_arguments.size (); i++) {
79
+ da.push_back (default_arguments[i]);
80
+ }
81
+ dict[" default_args" ] = da;
82
+ dict[" flags" ] = flags;
83
+ dict[" id" ] = id;
84
+ Dictionary r = return_val;
85
+ dict[" return" ] = r;
86
+ return dict;
87
+ }
88
+
89
+ MethodInfo MethodInfo::from_dict (const Dictionary& p_dict) {
90
+ MethodInfo mi;
91
+
92
+ if (p_dict.has (" name" )) {
93
+ mi.name = p_dict[" name" ];
94
+ }
95
+ Array args;
96
+ if (p_dict.has (" args" )) {
97
+ args = p_dict[" args" ];
98
+ }
99
+
100
+ for (int i = 0 ; i < args.size (); i++) {
101
+ Dictionary d = args[i];
102
+ mi.arguments .push_back (PropertyInfo::from_dict (d));
103
+ }
104
+ Array defargs;
105
+ if (p_dict.has (" default_args" )) {
106
+ defargs = p_dict[" default_args" ];
107
+ }
108
+ for (int i = 0 ; i < defargs.size (); i++) {
109
+ mi.default_arguments .push_back (defargs[i]);
110
+ }
111
+
112
+ if (p_dict.has (" return" )) {
113
+ mi.return_val = PropertyInfo::from_dict (p_dict[" return" ]);
114
+ }
115
+
116
+ if (p_dict.has (" flags" )) {
117
+ mi.flags = p_dict[" flags" ];
118
+ }
119
+
120
+ return mi;
121
+ }
122
+
65
123
MethodInfo::MethodInfo () :
66
124
flags (GDEXTENSION_METHOD_FLAG_NORMAL) {}
67
125
0 commit comments