1
2#ifndef GDVIRTUAL_GEN_H
3#define GDVIRTUAL_GEN_H
4
5#include "core/object/script_instance.h"
6
7
8/* 0 Arguments */
9
10
11#define GDVIRTUAL0( m_name ) \
12StringName _gdvirtual_##m_name##_sn = #m_name;\
13mutable bool _gdvirtual_##m_name##_initialized = false;\
14mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
15template<bool required>\
16_FORCE_INLINE_ bool _gdvirtual_##m_name##_call() { \
17 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
18 if (_script_instance) {\
19 Callable::CallError ce; \
20 \
21 _script_instance->callp(_gdvirtual_##m_name##_sn, nullptr, 0, ce);\
22 if (ce.error == Callable::CallError::CALL_OK) {\
23 \
24 return true;\
25 } \
26 }\
27 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
28 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
29 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
30 _gdvirtual_##m_name##_initialized = true;\
31 }\
32 if (_gdvirtual_##m_name) {\
33 \
34 \
35 _gdvirtual_##m_name(_get_extension_instance(),nullptr,nullptr);\
36 \
37 return true;\
38 }\
39 \
40 if (required) {\
41 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
42 \
43 }\
44\
45 return false;\
46}\
47_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
48 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
49 if (_script_instance) {\
50 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
51 }\
52 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
53 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
54 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
55 _gdvirtual_##m_name##_initialized = true;\
56 }\
57 if (_gdvirtual_##m_name) {\
58 return true;\
59 }\
60 return false;\
61}\
62\
63_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
64 MethodInfo method_info;\
65 method_info.name = #m_name;\
66 method_info.flags = METHOD_FLAG_VIRTUAL;\
67 \
68 return method_info;\
69}
70
71
72#define GDVIRTUAL0R(m_ret, m_name ) \
73StringName _gdvirtual_##m_name##_sn = #m_name;\
74mutable bool _gdvirtual_##m_name##_initialized = false;\
75mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
76template<bool required>\
77_FORCE_INLINE_ bool _gdvirtual_##m_name##_call( m_ret& r_ret) { \
78 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
79 if (_script_instance) {\
80 Callable::CallError ce; \
81 \
82 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, nullptr, 0, ce);\
83 if (ce.error == Callable::CallError::CALL_OK) {\
84 r_ret = VariantCaster<m_ret>::cast(ret);\
85 return true;\
86 } \
87 }\
88 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
89 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
90 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
91 _gdvirtual_##m_name##_initialized = true;\
92 }\
93 if (_gdvirtual_##m_name) {\
94 \
95 PtrToArg<m_ret>::EncodeT ret;\
96 _gdvirtual_##m_name(_get_extension_instance(),nullptr,&ret);\
97 r_ret = (m_ret)ret;\
98 return true;\
99 }\
100 \
101 if (required) {\
102 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
103 (void)r_ret;\
104 }\
105\
106 return false;\
107}\
108_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
109 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
110 if (_script_instance) {\
111 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
112 }\
113 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
114 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
115 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
116 _gdvirtual_##m_name##_initialized = true;\
117 }\
118 if (_gdvirtual_##m_name) {\
119 return true;\
120 }\
121 return false;\
122}\
123\
124_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
125 MethodInfo method_info;\
126 method_info.name = #m_name;\
127 method_info.flags = METHOD_FLAG_VIRTUAL;\
128 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
129 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
130\
131 return method_info;\
132}
133
134
135#define GDVIRTUAL0C( m_name ) \
136StringName _gdvirtual_##m_name##_sn = #m_name;\
137mutable bool _gdvirtual_##m_name##_initialized = false;\
138mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
139template<bool required>\
140_FORCE_INLINE_ bool _gdvirtual_##m_name##_call() const { \
141 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
142 if (_script_instance) {\
143 Callable::CallError ce; \
144 \
145 _script_instance->callp(_gdvirtual_##m_name##_sn, nullptr, 0, ce);\
146 if (ce.error == Callable::CallError::CALL_OK) {\
147 \
148 return true;\
149 } \
150 }\
151 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
152 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
153 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
154 _gdvirtual_##m_name##_initialized = true;\
155 }\
156 if (_gdvirtual_##m_name) {\
157 \
158 \
159 _gdvirtual_##m_name(_get_extension_instance(),nullptr,nullptr);\
160 \
161 return true;\
162 }\
163 \
164 if (required) {\
165 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
166 \
167 }\
168\
169 return false;\
170}\
171_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
172 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
173 if (_script_instance) {\
174 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
175 }\
176 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
177 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
178 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
179 _gdvirtual_##m_name##_initialized = true;\
180 }\
181 if (_gdvirtual_##m_name) {\
182 return true;\
183 }\
184 return false;\
185}\
186\
187_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
188 MethodInfo method_info;\
189 method_info.name = #m_name;\
190 method_info.flags = METHOD_FLAG_VIRTUAL;\
191 method_info.flags|=METHOD_FLAG_CONST;\
192\
193 return method_info;\
194}
195
196
197#define GDVIRTUAL0RC(m_ret, m_name ) \
198StringName _gdvirtual_##m_name##_sn = #m_name;\
199mutable bool _gdvirtual_##m_name##_initialized = false;\
200mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
201template<bool required>\
202_FORCE_INLINE_ bool _gdvirtual_##m_name##_call( m_ret& r_ret) const { \
203 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
204 if (_script_instance) {\
205 Callable::CallError ce; \
206 \
207 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, nullptr, 0, ce);\
208 if (ce.error == Callable::CallError::CALL_OK) {\
209 r_ret = VariantCaster<m_ret>::cast(ret);\
210 return true;\
211 } \
212 }\
213 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
214 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
215 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
216 _gdvirtual_##m_name##_initialized = true;\
217 }\
218 if (_gdvirtual_##m_name) {\
219 \
220 PtrToArg<m_ret>::EncodeT ret;\
221 _gdvirtual_##m_name(_get_extension_instance(),nullptr,&ret);\
222 r_ret = (m_ret)ret;\
223 return true;\
224 }\
225 \
226 if (required) {\
227 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
228 (void)r_ret;\
229 }\
230\
231 return false;\
232}\
233_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
234 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
235 if (_script_instance) {\
236 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
237 }\
238 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
239 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
240 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
241 _gdvirtual_##m_name##_initialized = true;\
242 }\
243 if (_gdvirtual_##m_name) {\
244 return true;\
245 }\
246 return false;\
247}\
248\
249_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
250 MethodInfo method_info;\
251 method_info.name = #m_name;\
252 method_info.flags = METHOD_FLAG_VIRTUAL;\
253 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
254 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
255 method_info.flags|=METHOD_FLAG_CONST;\
256\
257 return method_info;\
258}
259
260/* 1 Arguments */
261
262
263#define GDVIRTUAL1( m_name , m_type1) \
264StringName _gdvirtual_##m_name##_sn = #m_name;\
265mutable bool _gdvirtual_##m_name##_initialized = false;\
266mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
267template<bool required>\
268_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1) { \
269 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
270 if (_script_instance) {\
271 Callable::CallError ce; \
272 Variant vargs[1]={Variant(arg1)};\
273 const Variant *vargptrs[1]={&vargs[0]};\
274\
275 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,1, ce);\
276 if (ce.error == Callable::CallError::CALL_OK) {\
277 \
278 return true;\
279 } \
280 }\
281 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
282 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
283 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
284 _gdvirtual_##m_name##_initialized = true;\
285 }\
286 if (_gdvirtual_##m_name) {\
287 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
288 GDExtensionConstTypePtr argptrs[1]={&argval1};\
289\
290 \
291 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
292 \
293 return true;\
294 }\
295 \
296 if (required) {\
297 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
298 \
299 }\
300\
301 return false;\
302}\
303_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
304 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
305 if (_script_instance) {\
306 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
307 }\
308 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
309 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
310 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
311 _gdvirtual_##m_name##_initialized = true;\
312 }\
313 if (_gdvirtual_##m_name) {\
314 return true;\
315 }\
316 return false;\
317}\
318\
319_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
320 MethodInfo method_info;\
321 method_info.name = #m_name;\
322 method_info.flags = METHOD_FLAG_VIRTUAL;\
323 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
324 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
325\
326 return method_info;\
327}
328
329
330#define GDVIRTUAL1R(m_ret, m_name , m_type1) \
331StringName _gdvirtual_##m_name##_sn = #m_name;\
332mutable bool _gdvirtual_##m_name##_initialized = false;\
333mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
334template<bool required>\
335_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_ret& r_ret) { \
336 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
337 if (_script_instance) {\
338 Callable::CallError ce; \
339 Variant vargs[1]={Variant(arg1)};\
340 const Variant *vargptrs[1]={&vargs[0]};\
341\
342 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,1, ce);\
343 if (ce.error == Callable::CallError::CALL_OK) {\
344 r_ret = VariantCaster<m_ret>::cast(ret);\
345 return true;\
346 } \
347 }\
348 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
349 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
350 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
351 _gdvirtual_##m_name##_initialized = true;\
352 }\
353 if (_gdvirtual_##m_name) {\
354 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
355 GDExtensionConstTypePtr argptrs[1]={&argval1};\
356\
357 PtrToArg<m_ret>::EncodeT ret;\
358 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
359 r_ret = (m_ret)ret;\
360 return true;\
361 }\
362 \
363 if (required) {\
364 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
365 (void)r_ret;\
366 }\
367\
368 return false;\
369}\
370_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
371 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
372 if (_script_instance) {\
373 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
374 }\
375 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
376 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
377 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
378 _gdvirtual_##m_name##_initialized = true;\
379 }\
380 if (_gdvirtual_##m_name) {\
381 return true;\
382 }\
383 return false;\
384}\
385\
386_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
387 MethodInfo method_info;\
388 method_info.name = #m_name;\
389 method_info.flags = METHOD_FLAG_VIRTUAL;\
390 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
391 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
392 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
393 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
394\
395 return method_info;\
396}
397
398
399#define GDVIRTUAL1C( m_name , m_type1) \
400StringName _gdvirtual_##m_name##_sn = #m_name;\
401mutable bool _gdvirtual_##m_name##_initialized = false;\
402mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
403template<bool required>\
404_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1) const { \
405 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
406 if (_script_instance) {\
407 Callable::CallError ce; \
408 Variant vargs[1]={Variant(arg1)};\
409 const Variant *vargptrs[1]={&vargs[0]};\
410\
411 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,1, ce);\
412 if (ce.error == Callable::CallError::CALL_OK) {\
413 \
414 return true;\
415 } \
416 }\
417 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
418 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
419 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
420 _gdvirtual_##m_name##_initialized = true;\
421 }\
422 if (_gdvirtual_##m_name) {\
423 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
424 GDExtensionConstTypePtr argptrs[1]={&argval1};\
425\
426 \
427 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
428 \
429 return true;\
430 }\
431 \
432 if (required) {\
433 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
434 \
435 }\
436\
437 return false;\
438}\
439_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
440 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
441 if (_script_instance) {\
442 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
443 }\
444 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
445 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
446 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
447 _gdvirtual_##m_name##_initialized = true;\
448 }\
449 if (_gdvirtual_##m_name) {\
450 return true;\
451 }\
452 return false;\
453}\
454\
455_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
456 MethodInfo method_info;\
457 method_info.name = #m_name;\
458 method_info.flags = METHOD_FLAG_VIRTUAL;\
459 method_info.flags|=METHOD_FLAG_CONST;\
460 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
461 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
462\
463 return method_info;\
464}
465
466
467#define GDVIRTUAL1RC(m_ret, m_name , m_type1) \
468StringName _gdvirtual_##m_name##_sn = #m_name;\
469mutable bool _gdvirtual_##m_name##_initialized = false;\
470mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
471template<bool required>\
472_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_ret& r_ret) const { \
473 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
474 if (_script_instance) {\
475 Callable::CallError ce; \
476 Variant vargs[1]={Variant(arg1)};\
477 const Variant *vargptrs[1]={&vargs[0]};\
478\
479 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,1, ce);\
480 if (ce.error == Callable::CallError::CALL_OK) {\
481 r_ret = VariantCaster<m_ret>::cast(ret);\
482 return true;\
483 } \
484 }\
485 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
486 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
487 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
488 _gdvirtual_##m_name##_initialized = true;\
489 }\
490 if (_gdvirtual_##m_name) {\
491 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
492 GDExtensionConstTypePtr argptrs[1]={&argval1};\
493\
494 PtrToArg<m_ret>::EncodeT ret;\
495 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
496 r_ret = (m_ret)ret;\
497 return true;\
498 }\
499 \
500 if (required) {\
501 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
502 (void)r_ret;\
503 }\
504\
505 return false;\
506}\
507_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
508 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
509 if (_script_instance) {\
510 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
511 }\
512 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
513 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
514 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
515 _gdvirtual_##m_name##_initialized = true;\
516 }\
517 if (_gdvirtual_##m_name) {\
518 return true;\
519 }\
520 return false;\
521}\
522\
523_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
524 MethodInfo method_info;\
525 method_info.name = #m_name;\
526 method_info.flags = METHOD_FLAG_VIRTUAL;\
527 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
528 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
529 method_info.flags|=METHOD_FLAG_CONST;\
530 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
531 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
532\
533 return method_info;\
534}
535
536/* 2 Arguments */
537
538
539#define GDVIRTUAL2( m_name , m_type1, m_type2) \
540StringName _gdvirtual_##m_name##_sn = #m_name;\
541mutable bool _gdvirtual_##m_name##_initialized = false;\
542mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
543template<bool required>\
544_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2) { \
545 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
546 if (_script_instance) {\
547 Callable::CallError ce; \
548 Variant vargs[2]={Variant(arg1), Variant(arg2)};\
549 const Variant *vargptrs[2]={&vargs[0], &vargs[1]};\
550\
551 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,2, ce);\
552 if (ce.error == Callable::CallError::CALL_OK) {\
553 \
554 return true;\
555 } \
556 }\
557 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
558 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
559 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
560 _gdvirtual_##m_name##_initialized = true;\
561 }\
562 if (_gdvirtual_##m_name) {\
563 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
564 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
565 GDExtensionConstTypePtr argptrs[2]={&argval1, &argval2};\
566\
567 \
568 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
569 \
570 return true;\
571 }\
572 \
573 if (required) {\
574 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
575 \
576 }\
577\
578 return false;\
579}\
580_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
581 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
582 if (_script_instance) {\
583 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
584 }\
585 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
586 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
587 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
588 _gdvirtual_##m_name##_initialized = true;\
589 }\
590 if (_gdvirtual_##m_name) {\
591 return true;\
592 }\
593 return false;\
594}\
595\
596_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
597 MethodInfo method_info;\
598 method_info.name = #m_name;\
599 method_info.flags = METHOD_FLAG_VIRTUAL;\
600 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
601 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
602 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
603 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
604\
605 return method_info;\
606}
607
608
609#define GDVIRTUAL2R(m_ret, m_name , m_type1, m_type2) \
610StringName _gdvirtual_##m_name##_sn = #m_name;\
611mutable bool _gdvirtual_##m_name##_initialized = false;\
612mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
613template<bool required>\
614_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_ret& r_ret) { \
615 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
616 if (_script_instance) {\
617 Callable::CallError ce; \
618 Variant vargs[2]={Variant(arg1), Variant(arg2)};\
619 const Variant *vargptrs[2]={&vargs[0], &vargs[1]};\
620\
621 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,2, ce);\
622 if (ce.error == Callable::CallError::CALL_OK) {\
623 r_ret = VariantCaster<m_ret>::cast(ret);\
624 return true;\
625 } \
626 }\
627 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
628 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
629 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
630 _gdvirtual_##m_name##_initialized = true;\
631 }\
632 if (_gdvirtual_##m_name) {\
633 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
634 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
635 GDExtensionConstTypePtr argptrs[2]={&argval1, &argval2};\
636\
637 PtrToArg<m_ret>::EncodeT ret;\
638 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
639 r_ret = (m_ret)ret;\
640 return true;\
641 }\
642 \
643 if (required) {\
644 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
645 (void)r_ret;\
646 }\
647\
648 return false;\
649}\
650_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
651 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
652 if (_script_instance) {\
653 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
654 }\
655 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
656 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
657 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
658 _gdvirtual_##m_name##_initialized = true;\
659 }\
660 if (_gdvirtual_##m_name) {\
661 return true;\
662 }\
663 return false;\
664}\
665\
666_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
667 MethodInfo method_info;\
668 method_info.name = #m_name;\
669 method_info.flags = METHOD_FLAG_VIRTUAL;\
670 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
671 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
672 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
673 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
674 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
675 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
676\
677 return method_info;\
678}
679
680
681#define GDVIRTUAL2C( m_name , m_type1, m_type2) \
682StringName _gdvirtual_##m_name##_sn = #m_name;\
683mutable bool _gdvirtual_##m_name##_initialized = false;\
684mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
685template<bool required>\
686_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2) const { \
687 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
688 if (_script_instance) {\
689 Callable::CallError ce; \
690 Variant vargs[2]={Variant(arg1), Variant(arg2)};\
691 const Variant *vargptrs[2]={&vargs[0], &vargs[1]};\
692\
693 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,2, ce);\
694 if (ce.error == Callable::CallError::CALL_OK) {\
695 \
696 return true;\
697 } \
698 }\
699 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
700 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
701 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
702 _gdvirtual_##m_name##_initialized = true;\
703 }\
704 if (_gdvirtual_##m_name) {\
705 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
706 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
707 GDExtensionConstTypePtr argptrs[2]={&argval1, &argval2};\
708\
709 \
710 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
711 \
712 return true;\
713 }\
714 \
715 if (required) {\
716 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
717 \
718 }\
719\
720 return false;\
721}\
722_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
723 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
724 if (_script_instance) {\
725 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
726 }\
727 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
728 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
729 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
730 _gdvirtual_##m_name##_initialized = true;\
731 }\
732 if (_gdvirtual_##m_name) {\
733 return true;\
734 }\
735 return false;\
736}\
737\
738_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
739 MethodInfo method_info;\
740 method_info.name = #m_name;\
741 method_info.flags = METHOD_FLAG_VIRTUAL;\
742 method_info.flags|=METHOD_FLAG_CONST;\
743 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
744 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
745 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
746 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
747\
748 return method_info;\
749}
750
751
752#define GDVIRTUAL2RC(m_ret, m_name , m_type1, m_type2) \
753StringName _gdvirtual_##m_name##_sn = #m_name;\
754mutable bool _gdvirtual_##m_name##_initialized = false;\
755mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
756template<bool required>\
757_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_ret& r_ret) const { \
758 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
759 if (_script_instance) {\
760 Callable::CallError ce; \
761 Variant vargs[2]={Variant(arg1), Variant(arg2)};\
762 const Variant *vargptrs[2]={&vargs[0], &vargs[1]};\
763\
764 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,2, ce);\
765 if (ce.error == Callable::CallError::CALL_OK) {\
766 r_ret = VariantCaster<m_ret>::cast(ret);\
767 return true;\
768 } \
769 }\
770 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
771 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
772 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
773 _gdvirtual_##m_name##_initialized = true;\
774 }\
775 if (_gdvirtual_##m_name) {\
776 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
777 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
778 GDExtensionConstTypePtr argptrs[2]={&argval1, &argval2};\
779\
780 PtrToArg<m_ret>::EncodeT ret;\
781 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
782 r_ret = (m_ret)ret;\
783 return true;\
784 }\
785 \
786 if (required) {\
787 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
788 (void)r_ret;\
789 }\
790\
791 return false;\
792}\
793_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
794 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
795 if (_script_instance) {\
796 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
797 }\
798 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
799 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
800 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
801 _gdvirtual_##m_name##_initialized = true;\
802 }\
803 if (_gdvirtual_##m_name) {\
804 return true;\
805 }\
806 return false;\
807}\
808\
809_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
810 MethodInfo method_info;\
811 method_info.name = #m_name;\
812 method_info.flags = METHOD_FLAG_VIRTUAL;\
813 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
814 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
815 method_info.flags|=METHOD_FLAG_CONST;\
816 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
817 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
818 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
819 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
820\
821 return method_info;\
822}
823
824/* 3 Arguments */
825
826
827#define GDVIRTUAL3( m_name , m_type1, m_type2, m_type3) \
828StringName _gdvirtual_##m_name##_sn = #m_name;\
829mutable bool _gdvirtual_##m_name##_initialized = false;\
830mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
831template<bool required>\
832_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3) { \
833 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
834 if (_script_instance) {\
835 Callable::CallError ce; \
836 Variant vargs[3]={Variant(arg1), Variant(arg2), Variant(arg3)};\
837 const Variant *vargptrs[3]={&vargs[0], &vargs[1], &vargs[2]};\
838\
839 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,3, ce);\
840 if (ce.error == Callable::CallError::CALL_OK) {\
841 \
842 return true;\
843 } \
844 }\
845 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
846 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
847 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
848 _gdvirtual_##m_name##_initialized = true;\
849 }\
850 if (_gdvirtual_##m_name) {\
851 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
852 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
853 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
854 GDExtensionConstTypePtr argptrs[3]={&argval1, &argval2, &argval3};\
855\
856 \
857 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
858 \
859 return true;\
860 }\
861 \
862 if (required) {\
863 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
864 \
865 }\
866\
867 return false;\
868}\
869_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
870 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
871 if (_script_instance) {\
872 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
873 }\
874 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
875 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
876 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
877 _gdvirtual_##m_name##_initialized = true;\
878 }\
879 if (_gdvirtual_##m_name) {\
880 return true;\
881 }\
882 return false;\
883}\
884\
885_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
886 MethodInfo method_info;\
887 method_info.name = #m_name;\
888 method_info.flags = METHOD_FLAG_VIRTUAL;\
889 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
890 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
891 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
892 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
893 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
894 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
895\
896 return method_info;\
897}
898
899
900#define GDVIRTUAL3R(m_ret, m_name , m_type1, m_type2, m_type3) \
901StringName _gdvirtual_##m_name##_sn = #m_name;\
902mutable bool _gdvirtual_##m_name##_initialized = false;\
903mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
904template<bool required>\
905_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_ret& r_ret) { \
906 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
907 if (_script_instance) {\
908 Callable::CallError ce; \
909 Variant vargs[3]={Variant(arg1), Variant(arg2), Variant(arg3)};\
910 const Variant *vargptrs[3]={&vargs[0], &vargs[1], &vargs[2]};\
911\
912 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,3, ce);\
913 if (ce.error == Callable::CallError::CALL_OK) {\
914 r_ret = VariantCaster<m_ret>::cast(ret);\
915 return true;\
916 } \
917 }\
918 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
919 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
920 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
921 _gdvirtual_##m_name##_initialized = true;\
922 }\
923 if (_gdvirtual_##m_name) {\
924 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
925 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
926 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
927 GDExtensionConstTypePtr argptrs[3]={&argval1, &argval2, &argval3};\
928\
929 PtrToArg<m_ret>::EncodeT ret;\
930 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
931 r_ret = (m_ret)ret;\
932 return true;\
933 }\
934 \
935 if (required) {\
936 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
937 (void)r_ret;\
938 }\
939\
940 return false;\
941}\
942_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
943 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
944 if (_script_instance) {\
945 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
946 }\
947 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
948 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
949 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
950 _gdvirtual_##m_name##_initialized = true;\
951 }\
952 if (_gdvirtual_##m_name) {\
953 return true;\
954 }\
955 return false;\
956}\
957\
958_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
959 MethodInfo method_info;\
960 method_info.name = #m_name;\
961 method_info.flags = METHOD_FLAG_VIRTUAL;\
962 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
963 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
964 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
965 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
966 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
967 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
968 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
969 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
970\
971 return method_info;\
972}
973
974
975#define GDVIRTUAL3C( m_name , m_type1, m_type2, m_type3) \
976StringName _gdvirtual_##m_name##_sn = #m_name;\
977mutable bool _gdvirtual_##m_name##_initialized = false;\
978mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
979template<bool required>\
980_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3) const { \
981 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
982 if (_script_instance) {\
983 Callable::CallError ce; \
984 Variant vargs[3]={Variant(arg1), Variant(arg2), Variant(arg3)};\
985 const Variant *vargptrs[3]={&vargs[0], &vargs[1], &vargs[2]};\
986\
987 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,3, ce);\
988 if (ce.error == Callable::CallError::CALL_OK) {\
989 \
990 return true;\
991 } \
992 }\
993 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
994 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
995 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
996 _gdvirtual_##m_name##_initialized = true;\
997 }\
998 if (_gdvirtual_##m_name) {\
999 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1000 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1001 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1002 GDExtensionConstTypePtr argptrs[3]={&argval1, &argval2, &argval3};\
1003\
1004 \
1005 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1006 \
1007 return true;\
1008 }\
1009 \
1010 if (required) {\
1011 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1012 \
1013 }\
1014\
1015 return false;\
1016}\
1017_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1018 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1019 if (_script_instance) {\
1020 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1021 }\
1022 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1023 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1024 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1025 _gdvirtual_##m_name##_initialized = true;\
1026 }\
1027 if (_gdvirtual_##m_name) {\
1028 return true;\
1029 }\
1030 return false;\
1031}\
1032\
1033_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1034 MethodInfo method_info;\
1035 method_info.name = #m_name;\
1036 method_info.flags = METHOD_FLAG_VIRTUAL;\
1037 method_info.flags|=METHOD_FLAG_CONST;\
1038 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1039 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1040 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1041 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1042 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1043 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1044\
1045 return method_info;\
1046}
1047
1048
1049#define GDVIRTUAL3RC(m_ret, m_name , m_type1, m_type2, m_type3) \
1050StringName _gdvirtual_##m_name##_sn = #m_name;\
1051mutable bool _gdvirtual_##m_name##_initialized = false;\
1052mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1053template<bool required>\
1054_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_ret& r_ret) const { \
1055 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1056 if (_script_instance) {\
1057 Callable::CallError ce; \
1058 Variant vargs[3]={Variant(arg1), Variant(arg2), Variant(arg3)};\
1059 const Variant *vargptrs[3]={&vargs[0], &vargs[1], &vargs[2]};\
1060\
1061 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,3, ce);\
1062 if (ce.error == Callable::CallError::CALL_OK) {\
1063 r_ret = VariantCaster<m_ret>::cast(ret);\
1064 return true;\
1065 } \
1066 }\
1067 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1068 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1069 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1070 _gdvirtual_##m_name##_initialized = true;\
1071 }\
1072 if (_gdvirtual_##m_name) {\
1073 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1074 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1075 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1076 GDExtensionConstTypePtr argptrs[3]={&argval1, &argval2, &argval3};\
1077\
1078 PtrToArg<m_ret>::EncodeT ret;\
1079 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1080 r_ret = (m_ret)ret;\
1081 return true;\
1082 }\
1083 \
1084 if (required) {\
1085 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1086 (void)r_ret;\
1087 }\
1088\
1089 return false;\
1090}\
1091_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1092 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1093 if (_script_instance) {\
1094 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1095 }\
1096 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1097 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1098 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1099 _gdvirtual_##m_name##_initialized = true;\
1100 }\
1101 if (_gdvirtual_##m_name) {\
1102 return true;\
1103 }\
1104 return false;\
1105}\
1106\
1107_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1108 MethodInfo method_info;\
1109 method_info.name = #m_name;\
1110 method_info.flags = METHOD_FLAG_VIRTUAL;\
1111 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1112 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1113 method_info.flags|=METHOD_FLAG_CONST;\
1114 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1115 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1116 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1117 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1118 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1119 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1120\
1121 return method_info;\
1122}
1123
1124/* 4 Arguments */
1125
1126
1127#define GDVIRTUAL4( m_name , m_type1, m_type2, m_type3, m_type4) \
1128StringName _gdvirtual_##m_name##_sn = #m_name;\
1129mutable bool _gdvirtual_##m_name##_initialized = false;\
1130mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1131template<bool required>\
1132_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4) { \
1133 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1134 if (_script_instance) {\
1135 Callable::CallError ce; \
1136 Variant vargs[4]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4)};\
1137 const Variant *vargptrs[4]={&vargs[0], &vargs[1], &vargs[2], &vargs[3]};\
1138\
1139 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,4, ce);\
1140 if (ce.error == Callable::CallError::CALL_OK) {\
1141 \
1142 return true;\
1143 } \
1144 }\
1145 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1146 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1147 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1148 _gdvirtual_##m_name##_initialized = true;\
1149 }\
1150 if (_gdvirtual_##m_name) {\
1151 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1152 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1153 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1154 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1155 GDExtensionConstTypePtr argptrs[4]={&argval1, &argval2, &argval3, &argval4};\
1156\
1157 \
1158 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1159 \
1160 return true;\
1161 }\
1162 \
1163 if (required) {\
1164 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1165 \
1166 }\
1167\
1168 return false;\
1169}\
1170_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1171 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1172 if (_script_instance) {\
1173 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1174 }\
1175 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1176 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1177 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1178 _gdvirtual_##m_name##_initialized = true;\
1179 }\
1180 if (_gdvirtual_##m_name) {\
1181 return true;\
1182 }\
1183 return false;\
1184}\
1185\
1186_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1187 MethodInfo method_info;\
1188 method_info.name = #m_name;\
1189 method_info.flags = METHOD_FLAG_VIRTUAL;\
1190 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1191 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1192 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1193 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1194 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1195 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1196 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1197 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1198\
1199 return method_info;\
1200}
1201
1202
1203#define GDVIRTUAL4R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4) \
1204StringName _gdvirtual_##m_name##_sn = #m_name;\
1205mutable bool _gdvirtual_##m_name##_initialized = false;\
1206mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1207template<bool required>\
1208_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_ret& r_ret) { \
1209 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1210 if (_script_instance) {\
1211 Callable::CallError ce; \
1212 Variant vargs[4]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4)};\
1213 const Variant *vargptrs[4]={&vargs[0], &vargs[1], &vargs[2], &vargs[3]};\
1214\
1215 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,4, ce);\
1216 if (ce.error == Callable::CallError::CALL_OK) {\
1217 r_ret = VariantCaster<m_ret>::cast(ret);\
1218 return true;\
1219 } \
1220 }\
1221 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1222 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1223 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1224 _gdvirtual_##m_name##_initialized = true;\
1225 }\
1226 if (_gdvirtual_##m_name) {\
1227 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1228 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1229 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1230 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1231 GDExtensionConstTypePtr argptrs[4]={&argval1, &argval2, &argval3, &argval4};\
1232\
1233 PtrToArg<m_ret>::EncodeT ret;\
1234 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1235 r_ret = (m_ret)ret;\
1236 return true;\
1237 }\
1238 \
1239 if (required) {\
1240 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1241 (void)r_ret;\
1242 }\
1243\
1244 return false;\
1245}\
1246_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1247 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1248 if (_script_instance) {\
1249 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1250 }\
1251 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1252 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1253 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1254 _gdvirtual_##m_name##_initialized = true;\
1255 }\
1256 if (_gdvirtual_##m_name) {\
1257 return true;\
1258 }\
1259 return false;\
1260}\
1261\
1262_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1263 MethodInfo method_info;\
1264 method_info.name = #m_name;\
1265 method_info.flags = METHOD_FLAG_VIRTUAL;\
1266 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1267 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1268 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1269 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1270 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1271 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1272 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1273 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1274 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1275 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1276\
1277 return method_info;\
1278}
1279
1280
1281#define GDVIRTUAL4C( m_name , m_type1, m_type2, m_type3, m_type4) \
1282StringName _gdvirtual_##m_name##_sn = #m_name;\
1283mutable bool _gdvirtual_##m_name##_initialized = false;\
1284mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1285template<bool required>\
1286_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4) const { \
1287 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1288 if (_script_instance) {\
1289 Callable::CallError ce; \
1290 Variant vargs[4]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4)};\
1291 const Variant *vargptrs[4]={&vargs[0], &vargs[1], &vargs[2], &vargs[3]};\
1292\
1293 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,4, ce);\
1294 if (ce.error == Callable::CallError::CALL_OK) {\
1295 \
1296 return true;\
1297 } \
1298 }\
1299 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1300 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1301 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1302 _gdvirtual_##m_name##_initialized = true;\
1303 }\
1304 if (_gdvirtual_##m_name) {\
1305 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1306 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1307 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1308 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1309 GDExtensionConstTypePtr argptrs[4]={&argval1, &argval2, &argval3, &argval4};\
1310\
1311 \
1312 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1313 \
1314 return true;\
1315 }\
1316 \
1317 if (required) {\
1318 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1319 \
1320 }\
1321\
1322 return false;\
1323}\
1324_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1325 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1326 if (_script_instance) {\
1327 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1328 }\
1329 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1330 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1331 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1332 _gdvirtual_##m_name##_initialized = true;\
1333 }\
1334 if (_gdvirtual_##m_name) {\
1335 return true;\
1336 }\
1337 return false;\
1338}\
1339\
1340_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1341 MethodInfo method_info;\
1342 method_info.name = #m_name;\
1343 method_info.flags = METHOD_FLAG_VIRTUAL;\
1344 method_info.flags|=METHOD_FLAG_CONST;\
1345 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1346 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1347 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1348 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1349 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1350 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1351 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1352 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1353\
1354 return method_info;\
1355}
1356
1357
1358#define GDVIRTUAL4RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4) \
1359StringName _gdvirtual_##m_name##_sn = #m_name;\
1360mutable bool _gdvirtual_##m_name##_initialized = false;\
1361mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1362template<bool required>\
1363_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_ret& r_ret) const { \
1364 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1365 if (_script_instance) {\
1366 Callable::CallError ce; \
1367 Variant vargs[4]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4)};\
1368 const Variant *vargptrs[4]={&vargs[0], &vargs[1], &vargs[2], &vargs[3]};\
1369\
1370 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,4, ce);\
1371 if (ce.error == Callable::CallError::CALL_OK) {\
1372 r_ret = VariantCaster<m_ret>::cast(ret);\
1373 return true;\
1374 } \
1375 }\
1376 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1377 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1378 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1379 _gdvirtual_##m_name##_initialized = true;\
1380 }\
1381 if (_gdvirtual_##m_name) {\
1382 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1383 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1384 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1385 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1386 GDExtensionConstTypePtr argptrs[4]={&argval1, &argval2, &argval3, &argval4};\
1387\
1388 PtrToArg<m_ret>::EncodeT ret;\
1389 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1390 r_ret = (m_ret)ret;\
1391 return true;\
1392 }\
1393 \
1394 if (required) {\
1395 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1396 (void)r_ret;\
1397 }\
1398\
1399 return false;\
1400}\
1401_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1402 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1403 if (_script_instance) {\
1404 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1405 }\
1406 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1407 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1408 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1409 _gdvirtual_##m_name##_initialized = true;\
1410 }\
1411 if (_gdvirtual_##m_name) {\
1412 return true;\
1413 }\
1414 return false;\
1415}\
1416\
1417_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1418 MethodInfo method_info;\
1419 method_info.name = #m_name;\
1420 method_info.flags = METHOD_FLAG_VIRTUAL;\
1421 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1422 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1423 method_info.flags|=METHOD_FLAG_CONST;\
1424 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1425 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1426 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1427 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1428 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1429 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1430 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1431 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1432\
1433 return method_info;\
1434}
1435
1436/* 5 Arguments */
1437
1438
1439#define GDVIRTUAL5( m_name , m_type1, m_type2, m_type3, m_type4, m_type5) \
1440StringName _gdvirtual_##m_name##_sn = #m_name;\
1441mutable bool _gdvirtual_##m_name##_initialized = false;\
1442mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1443template<bool required>\
1444_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5) { \
1445 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1446 if (_script_instance) {\
1447 Callable::CallError ce; \
1448 Variant vargs[5]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5)};\
1449 const Variant *vargptrs[5]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4]};\
1450\
1451 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,5, ce);\
1452 if (ce.error == Callable::CallError::CALL_OK) {\
1453 \
1454 return true;\
1455 } \
1456 }\
1457 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1458 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1459 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1460 _gdvirtual_##m_name##_initialized = true;\
1461 }\
1462 if (_gdvirtual_##m_name) {\
1463 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1464 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1465 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1466 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1467 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1468 GDExtensionConstTypePtr argptrs[5]={&argval1, &argval2, &argval3, &argval4, &argval5};\
1469\
1470 \
1471 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1472 \
1473 return true;\
1474 }\
1475 \
1476 if (required) {\
1477 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1478 \
1479 }\
1480\
1481 return false;\
1482}\
1483_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1484 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1485 if (_script_instance) {\
1486 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1487 }\
1488 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1489 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1490 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1491 _gdvirtual_##m_name##_initialized = true;\
1492 }\
1493 if (_gdvirtual_##m_name) {\
1494 return true;\
1495 }\
1496 return false;\
1497}\
1498\
1499_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1500 MethodInfo method_info;\
1501 method_info.name = #m_name;\
1502 method_info.flags = METHOD_FLAG_VIRTUAL;\
1503 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1504 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1505 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1506 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1507 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1508 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1509 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1510 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1511 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1512 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1513\
1514 return method_info;\
1515}
1516
1517
1518#define GDVIRTUAL5R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5) \
1519StringName _gdvirtual_##m_name##_sn = #m_name;\
1520mutable bool _gdvirtual_##m_name##_initialized = false;\
1521mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1522template<bool required>\
1523_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_ret& r_ret) { \
1524 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1525 if (_script_instance) {\
1526 Callable::CallError ce; \
1527 Variant vargs[5]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5)};\
1528 const Variant *vargptrs[5]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4]};\
1529\
1530 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,5, ce);\
1531 if (ce.error == Callable::CallError::CALL_OK) {\
1532 r_ret = VariantCaster<m_ret>::cast(ret);\
1533 return true;\
1534 } \
1535 }\
1536 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1537 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1538 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1539 _gdvirtual_##m_name##_initialized = true;\
1540 }\
1541 if (_gdvirtual_##m_name) {\
1542 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1543 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1544 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1545 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1546 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1547 GDExtensionConstTypePtr argptrs[5]={&argval1, &argval2, &argval3, &argval4, &argval5};\
1548\
1549 PtrToArg<m_ret>::EncodeT ret;\
1550 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1551 r_ret = (m_ret)ret;\
1552 return true;\
1553 }\
1554 \
1555 if (required) {\
1556 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1557 (void)r_ret;\
1558 }\
1559\
1560 return false;\
1561}\
1562_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1563 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1564 if (_script_instance) {\
1565 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1566 }\
1567 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1568 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1569 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1570 _gdvirtual_##m_name##_initialized = true;\
1571 }\
1572 if (_gdvirtual_##m_name) {\
1573 return true;\
1574 }\
1575 return false;\
1576}\
1577\
1578_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1579 MethodInfo method_info;\
1580 method_info.name = #m_name;\
1581 method_info.flags = METHOD_FLAG_VIRTUAL;\
1582 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1583 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1584 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1585 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1586 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1587 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1588 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1589 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1590 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1591 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1592 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1593 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1594\
1595 return method_info;\
1596}
1597
1598
1599#define GDVIRTUAL5C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5) \
1600StringName _gdvirtual_##m_name##_sn = #m_name;\
1601mutable bool _gdvirtual_##m_name##_initialized = false;\
1602mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1603template<bool required>\
1604_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5) const { \
1605 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1606 if (_script_instance) {\
1607 Callable::CallError ce; \
1608 Variant vargs[5]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5)};\
1609 const Variant *vargptrs[5]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4]};\
1610\
1611 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,5, ce);\
1612 if (ce.error == Callable::CallError::CALL_OK) {\
1613 \
1614 return true;\
1615 } \
1616 }\
1617 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1618 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1619 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1620 _gdvirtual_##m_name##_initialized = true;\
1621 }\
1622 if (_gdvirtual_##m_name) {\
1623 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1624 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1625 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1626 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1627 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1628 GDExtensionConstTypePtr argptrs[5]={&argval1, &argval2, &argval3, &argval4, &argval5};\
1629\
1630 \
1631 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1632 \
1633 return true;\
1634 }\
1635 \
1636 if (required) {\
1637 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1638 \
1639 }\
1640\
1641 return false;\
1642}\
1643_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1644 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1645 if (_script_instance) {\
1646 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1647 }\
1648 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1649 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1650 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1651 _gdvirtual_##m_name##_initialized = true;\
1652 }\
1653 if (_gdvirtual_##m_name) {\
1654 return true;\
1655 }\
1656 return false;\
1657}\
1658\
1659_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1660 MethodInfo method_info;\
1661 method_info.name = #m_name;\
1662 method_info.flags = METHOD_FLAG_VIRTUAL;\
1663 method_info.flags|=METHOD_FLAG_CONST;\
1664 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1665 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1666 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1667 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1668 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1669 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1670 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1671 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1672 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1673 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1674\
1675 return method_info;\
1676}
1677
1678
1679#define GDVIRTUAL5RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5) \
1680StringName _gdvirtual_##m_name##_sn = #m_name;\
1681mutable bool _gdvirtual_##m_name##_initialized = false;\
1682mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1683template<bool required>\
1684_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_ret& r_ret) const { \
1685 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1686 if (_script_instance) {\
1687 Callable::CallError ce; \
1688 Variant vargs[5]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5)};\
1689 const Variant *vargptrs[5]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4]};\
1690\
1691 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,5, ce);\
1692 if (ce.error == Callable::CallError::CALL_OK) {\
1693 r_ret = VariantCaster<m_ret>::cast(ret);\
1694 return true;\
1695 } \
1696 }\
1697 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1698 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1699 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1700 _gdvirtual_##m_name##_initialized = true;\
1701 }\
1702 if (_gdvirtual_##m_name) {\
1703 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1704 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1705 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1706 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1707 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1708 GDExtensionConstTypePtr argptrs[5]={&argval1, &argval2, &argval3, &argval4, &argval5};\
1709\
1710 PtrToArg<m_ret>::EncodeT ret;\
1711 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1712 r_ret = (m_ret)ret;\
1713 return true;\
1714 }\
1715 \
1716 if (required) {\
1717 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1718 (void)r_ret;\
1719 }\
1720\
1721 return false;\
1722}\
1723_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1724 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1725 if (_script_instance) {\
1726 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1727 }\
1728 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1729 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1730 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1731 _gdvirtual_##m_name##_initialized = true;\
1732 }\
1733 if (_gdvirtual_##m_name) {\
1734 return true;\
1735 }\
1736 return false;\
1737}\
1738\
1739_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1740 MethodInfo method_info;\
1741 method_info.name = #m_name;\
1742 method_info.flags = METHOD_FLAG_VIRTUAL;\
1743 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1744 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1745 method_info.flags|=METHOD_FLAG_CONST;\
1746 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1747 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1748 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1749 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1750 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1751 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1752 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1753 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1754 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1755 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1756\
1757 return method_info;\
1758}
1759
1760/* 6 Arguments */
1761
1762
1763#define GDVIRTUAL6( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
1764StringName _gdvirtual_##m_name##_sn = #m_name;\
1765mutable bool _gdvirtual_##m_name##_initialized = false;\
1766mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1767template<bool required>\
1768_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6) { \
1769 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1770 if (_script_instance) {\
1771 Callable::CallError ce; \
1772 Variant vargs[6]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6)};\
1773 const Variant *vargptrs[6]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5]};\
1774\
1775 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,6, ce);\
1776 if (ce.error == Callable::CallError::CALL_OK) {\
1777 \
1778 return true;\
1779 } \
1780 }\
1781 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1782 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1783 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1784 _gdvirtual_##m_name##_initialized = true;\
1785 }\
1786 if (_gdvirtual_##m_name) {\
1787 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1788 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1789 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1790 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1791 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1792 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
1793 GDExtensionConstTypePtr argptrs[6]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6};\
1794\
1795 \
1796 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1797 \
1798 return true;\
1799 }\
1800 \
1801 if (required) {\
1802 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1803 \
1804 }\
1805\
1806 return false;\
1807}\
1808_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1809 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1810 if (_script_instance) {\
1811 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1812 }\
1813 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1814 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1815 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1816 _gdvirtual_##m_name##_initialized = true;\
1817 }\
1818 if (_gdvirtual_##m_name) {\
1819 return true;\
1820 }\
1821 return false;\
1822}\
1823\
1824_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1825 MethodInfo method_info;\
1826 method_info.name = #m_name;\
1827 method_info.flags = METHOD_FLAG_VIRTUAL;\
1828 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1829 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1830 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1831 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1832 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1833 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1834 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1835 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1836 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1837 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1838 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
1839 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
1840\
1841 return method_info;\
1842}
1843
1844
1845#define GDVIRTUAL6R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
1846StringName _gdvirtual_##m_name##_sn = #m_name;\
1847mutable bool _gdvirtual_##m_name##_initialized = false;\
1848mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1849template<bool required>\
1850_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_ret& r_ret) { \
1851 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1852 if (_script_instance) {\
1853 Callable::CallError ce; \
1854 Variant vargs[6]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6)};\
1855 const Variant *vargptrs[6]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5]};\
1856\
1857 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,6, ce);\
1858 if (ce.error == Callable::CallError::CALL_OK) {\
1859 r_ret = VariantCaster<m_ret>::cast(ret);\
1860 return true;\
1861 } \
1862 }\
1863 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1864 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1865 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1866 _gdvirtual_##m_name##_initialized = true;\
1867 }\
1868 if (_gdvirtual_##m_name) {\
1869 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1870 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1871 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1872 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1873 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1874 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
1875 GDExtensionConstTypePtr argptrs[6]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6};\
1876\
1877 PtrToArg<m_ret>::EncodeT ret;\
1878 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
1879 r_ret = (m_ret)ret;\
1880 return true;\
1881 }\
1882 \
1883 if (required) {\
1884 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1885 (void)r_ret;\
1886 }\
1887\
1888 return false;\
1889}\
1890_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1891 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1892 if (_script_instance) {\
1893 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1894 }\
1895 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1896 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1897 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1898 _gdvirtual_##m_name##_initialized = true;\
1899 }\
1900 if (_gdvirtual_##m_name) {\
1901 return true;\
1902 }\
1903 return false;\
1904}\
1905\
1906_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1907 MethodInfo method_info;\
1908 method_info.name = #m_name;\
1909 method_info.flags = METHOD_FLAG_VIRTUAL;\
1910 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
1911 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
1912 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1913 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1914 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1915 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1916 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
1917 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
1918 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
1919 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
1920 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
1921 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
1922 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
1923 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
1924\
1925 return method_info;\
1926}
1927
1928
1929#define GDVIRTUAL6C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
1930StringName _gdvirtual_##m_name##_sn = #m_name;\
1931mutable bool _gdvirtual_##m_name##_initialized = false;\
1932mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
1933template<bool required>\
1934_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6) const { \
1935 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1936 if (_script_instance) {\
1937 Callable::CallError ce; \
1938 Variant vargs[6]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6)};\
1939 const Variant *vargptrs[6]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5]};\
1940\
1941 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,6, ce);\
1942 if (ce.error == Callable::CallError::CALL_OK) {\
1943 \
1944 return true;\
1945 } \
1946 }\
1947 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1948 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1949 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1950 _gdvirtual_##m_name##_initialized = true;\
1951 }\
1952 if (_gdvirtual_##m_name) {\
1953 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
1954 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
1955 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
1956 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
1957 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
1958 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
1959 GDExtensionConstTypePtr argptrs[6]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6};\
1960\
1961 \
1962 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
1963 \
1964 return true;\
1965 }\
1966 \
1967 if (required) {\
1968 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
1969 \
1970 }\
1971\
1972 return false;\
1973}\
1974_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
1975 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
1976 if (_script_instance) {\
1977 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
1978 }\
1979 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
1980 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
1981 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
1982 _gdvirtual_##m_name##_initialized = true;\
1983 }\
1984 if (_gdvirtual_##m_name) {\
1985 return true;\
1986 }\
1987 return false;\
1988}\
1989\
1990_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
1991 MethodInfo method_info;\
1992 method_info.name = #m_name;\
1993 method_info.flags = METHOD_FLAG_VIRTUAL;\
1994 method_info.flags|=METHOD_FLAG_CONST;\
1995 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
1996 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
1997 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
1998 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
1999 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2000 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2001 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2002 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2003 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2004 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2005 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2006 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2007\
2008 return method_info;\
2009}
2010
2011
2012#define GDVIRTUAL6RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6) \
2013StringName _gdvirtual_##m_name##_sn = #m_name;\
2014mutable bool _gdvirtual_##m_name##_initialized = false;\
2015mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2016template<bool required>\
2017_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_ret& r_ret) const { \
2018 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2019 if (_script_instance) {\
2020 Callable::CallError ce; \
2021 Variant vargs[6]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6)};\
2022 const Variant *vargptrs[6]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5]};\
2023\
2024 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,6, ce);\
2025 if (ce.error == Callable::CallError::CALL_OK) {\
2026 r_ret = VariantCaster<m_ret>::cast(ret);\
2027 return true;\
2028 } \
2029 }\
2030 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2031 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2032 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2033 _gdvirtual_##m_name##_initialized = true;\
2034 }\
2035 if (_gdvirtual_##m_name) {\
2036 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2037 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2038 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2039 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2040 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2041 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2042 GDExtensionConstTypePtr argptrs[6]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6};\
2043\
2044 PtrToArg<m_ret>::EncodeT ret;\
2045 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2046 r_ret = (m_ret)ret;\
2047 return true;\
2048 }\
2049 \
2050 if (required) {\
2051 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2052 (void)r_ret;\
2053 }\
2054\
2055 return false;\
2056}\
2057_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2058 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2059 if (_script_instance) {\
2060 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2061 }\
2062 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2063 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2064 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2065 _gdvirtual_##m_name##_initialized = true;\
2066 }\
2067 if (_gdvirtual_##m_name) {\
2068 return true;\
2069 }\
2070 return false;\
2071}\
2072\
2073_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2074 MethodInfo method_info;\
2075 method_info.name = #m_name;\
2076 method_info.flags = METHOD_FLAG_VIRTUAL;\
2077 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2078 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2079 method_info.flags|=METHOD_FLAG_CONST;\
2080 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2081 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2082 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2083 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2084 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2085 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2086 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2087 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2088 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2089 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2090 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2091 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2092\
2093 return method_info;\
2094}
2095
2096/* 7 Arguments */
2097
2098
2099#define GDVIRTUAL7( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7) \
2100StringName _gdvirtual_##m_name##_sn = #m_name;\
2101mutable bool _gdvirtual_##m_name##_initialized = false;\
2102mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2103template<bool required>\
2104_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7) { \
2105 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2106 if (_script_instance) {\
2107 Callable::CallError ce; \
2108 Variant vargs[7]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7)};\
2109 const Variant *vargptrs[7]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6]};\
2110\
2111 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,7, ce);\
2112 if (ce.error == Callable::CallError::CALL_OK) {\
2113 \
2114 return true;\
2115 } \
2116 }\
2117 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2118 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2119 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2120 _gdvirtual_##m_name##_initialized = true;\
2121 }\
2122 if (_gdvirtual_##m_name) {\
2123 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2124 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2125 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2126 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2127 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2128 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2129 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2130 GDExtensionConstTypePtr argptrs[7]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7};\
2131\
2132 \
2133 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
2134 \
2135 return true;\
2136 }\
2137 \
2138 if (required) {\
2139 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2140 \
2141 }\
2142\
2143 return false;\
2144}\
2145_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2146 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2147 if (_script_instance) {\
2148 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2149 }\
2150 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2151 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2152 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2153 _gdvirtual_##m_name##_initialized = true;\
2154 }\
2155 if (_gdvirtual_##m_name) {\
2156 return true;\
2157 }\
2158 return false;\
2159}\
2160\
2161_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2162 MethodInfo method_info;\
2163 method_info.name = #m_name;\
2164 method_info.flags = METHOD_FLAG_VIRTUAL;\
2165 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2166 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2167 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2168 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2169 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2170 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2171 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2172 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2173 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2174 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2175 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2176 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2177 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2178 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2179\
2180 return method_info;\
2181}
2182
2183
2184#define GDVIRTUAL7R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7) \
2185StringName _gdvirtual_##m_name##_sn = #m_name;\
2186mutable bool _gdvirtual_##m_name##_initialized = false;\
2187mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2188template<bool required>\
2189_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_ret& r_ret) { \
2190 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2191 if (_script_instance) {\
2192 Callable::CallError ce; \
2193 Variant vargs[7]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7)};\
2194 const Variant *vargptrs[7]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6]};\
2195\
2196 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,7, ce);\
2197 if (ce.error == Callable::CallError::CALL_OK) {\
2198 r_ret = VariantCaster<m_ret>::cast(ret);\
2199 return true;\
2200 } \
2201 }\
2202 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2203 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2204 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2205 _gdvirtual_##m_name##_initialized = true;\
2206 }\
2207 if (_gdvirtual_##m_name) {\
2208 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2209 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2210 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2211 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2212 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2213 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2214 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2215 GDExtensionConstTypePtr argptrs[7]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7};\
2216\
2217 PtrToArg<m_ret>::EncodeT ret;\
2218 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2219 r_ret = (m_ret)ret;\
2220 return true;\
2221 }\
2222 \
2223 if (required) {\
2224 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2225 (void)r_ret;\
2226 }\
2227\
2228 return false;\
2229}\
2230_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2231 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2232 if (_script_instance) {\
2233 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2234 }\
2235 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2236 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2237 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2238 _gdvirtual_##m_name##_initialized = true;\
2239 }\
2240 if (_gdvirtual_##m_name) {\
2241 return true;\
2242 }\
2243 return false;\
2244}\
2245\
2246_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2247 MethodInfo method_info;\
2248 method_info.name = #m_name;\
2249 method_info.flags = METHOD_FLAG_VIRTUAL;\
2250 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2251 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2252 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2253 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2254 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2255 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2256 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2257 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2258 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2259 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2260 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2261 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2262 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2263 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2264 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2265 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2266\
2267 return method_info;\
2268}
2269
2270
2271#define GDVIRTUAL7C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7) \
2272StringName _gdvirtual_##m_name##_sn = #m_name;\
2273mutable bool _gdvirtual_##m_name##_initialized = false;\
2274mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2275template<bool required>\
2276_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7) const { \
2277 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2278 if (_script_instance) {\
2279 Callable::CallError ce; \
2280 Variant vargs[7]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7)};\
2281 const Variant *vargptrs[7]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6]};\
2282\
2283 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,7, ce);\
2284 if (ce.error == Callable::CallError::CALL_OK) {\
2285 \
2286 return true;\
2287 } \
2288 }\
2289 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2290 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2291 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2292 _gdvirtual_##m_name##_initialized = true;\
2293 }\
2294 if (_gdvirtual_##m_name) {\
2295 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2296 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2297 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2298 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2299 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2300 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2301 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2302 GDExtensionConstTypePtr argptrs[7]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7};\
2303\
2304 \
2305 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
2306 \
2307 return true;\
2308 }\
2309 \
2310 if (required) {\
2311 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2312 \
2313 }\
2314\
2315 return false;\
2316}\
2317_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2318 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2319 if (_script_instance) {\
2320 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2321 }\
2322 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2323 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2324 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2325 _gdvirtual_##m_name##_initialized = true;\
2326 }\
2327 if (_gdvirtual_##m_name) {\
2328 return true;\
2329 }\
2330 return false;\
2331}\
2332\
2333_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2334 MethodInfo method_info;\
2335 method_info.name = #m_name;\
2336 method_info.flags = METHOD_FLAG_VIRTUAL;\
2337 method_info.flags|=METHOD_FLAG_CONST;\
2338 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2339 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2340 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2341 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2342 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2343 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2344 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2345 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2346 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2347 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2348 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2349 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2350 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2351 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2352\
2353 return method_info;\
2354}
2355
2356
2357#define GDVIRTUAL7RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7) \
2358StringName _gdvirtual_##m_name##_sn = #m_name;\
2359mutable bool _gdvirtual_##m_name##_initialized = false;\
2360mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2361template<bool required>\
2362_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_ret& r_ret) const { \
2363 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2364 if (_script_instance) {\
2365 Callable::CallError ce; \
2366 Variant vargs[7]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7)};\
2367 const Variant *vargptrs[7]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6]};\
2368\
2369 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,7, ce);\
2370 if (ce.error == Callable::CallError::CALL_OK) {\
2371 r_ret = VariantCaster<m_ret>::cast(ret);\
2372 return true;\
2373 } \
2374 }\
2375 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2376 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2377 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2378 _gdvirtual_##m_name##_initialized = true;\
2379 }\
2380 if (_gdvirtual_##m_name) {\
2381 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2382 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2383 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2384 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2385 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2386 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2387 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2388 GDExtensionConstTypePtr argptrs[7]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7};\
2389\
2390 PtrToArg<m_ret>::EncodeT ret;\
2391 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2392 r_ret = (m_ret)ret;\
2393 return true;\
2394 }\
2395 \
2396 if (required) {\
2397 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2398 (void)r_ret;\
2399 }\
2400\
2401 return false;\
2402}\
2403_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2404 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2405 if (_script_instance) {\
2406 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2407 }\
2408 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2409 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2410 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2411 _gdvirtual_##m_name##_initialized = true;\
2412 }\
2413 if (_gdvirtual_##m_name) {\
2414 return true;\
2415 }\
2416 return false;\
2417}\
2418\
2419_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2420 MethodInfo method_info;\
2421 method_info.name = #m_name;\
2422 method_info.flags = METHOD_FLAG_VIRTUAL;\
2423 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2424 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2425 method_info.flags|=METHOD_FLAG_CONST;\
2426 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2427 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2428 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2429 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2430 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2431 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2432 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2433 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2434 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2435 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2436 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2437 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2438 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2439 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2440\
2441 return method_info;\
2442}
2443
2444/* 8 Arguments */
2445
2446
2447#define GDVIRTUAL8( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8) \
2448StringName _gdvirtual_##m_name##_sn = #m_name;\
2449mutable bool _gdvirtual_##m_name##_initialized = false;\
2450mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2451template<bool required>\
2452_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8) { \
2453 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2454 if (_script_instance) {\
2455 Callable::CallError ce; \
2456 Variant vargs[8]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8)};\
2457 const Variant *vargptrs[8]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7]};\
2458\
2459 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,8, ce);\
2460 if (ce.error == Callable::CallError::CALL_OK) {\
2461 \
2462 return true;\
2463 } \
2464 }\
2465 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2466 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2467 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2468 _gdvirtual_##m_name##_initialized = true;\
2469 }\
2470 if (_gdvirtual_##m_name) {\
2471 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2472 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2473 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2474 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2475 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2476 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2477 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2478 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2479 GDExtensionConstTypePtr argptrs[8]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8};\
2480\
2481 \
2482 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
2483 \
2484 return true;\
2485 }\
2486 \
2487 if (required) {\
2488 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2489 \
2490 }\
2491\
2492 return false;\
2493}\
2494_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2495 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2496 if (_script_instance) {\
2497 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2498 }\
2499 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2500 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2501 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2502 _gdvirtual_##m_name##_initialized = true;\
2503 }\
2504 if (_gdvirtual_##m_name) {\
2505 return true;\
2506 }\
2507 return false;\
2508}\
2509\
2510_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2511 MethodInfo method_info;\
2512 method_info.name = #m_name;\
2513 method_info.flags = METHOD_FLAG_VIRTUAL;\
2514 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2515 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2516 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2517 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2518 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2519 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2520 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2521 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2522 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2523 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2524 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2525 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2526 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2527 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2528 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2529 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2530\
2531 return method_info;\
2532}
2533
2534
2535#define GDVIRTUAL8R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8) \
2536StringName _gdvirtual_##m_name##_sn = #m_name;\
2537mutable bool _gdvirtual_##m_name##_initialized = false;\
2538mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2539template<bool required>\
2540_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_ret& r_ret) { \
2541 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2542 if (_script_instance) {\
2543 Callable::CallError ce; \
2544 Variant vargs[8]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8)};\
2545 const Variant *vargptrs[8]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7]};\
2546\
2547 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,8, ce);\
2548 if (ce.error == Callable::CallError::CALL_OK) {\
2549 r_ret = VariantCaster<m_ret>::cast(ret);\
2550 return true;\
2551 } \
2552 }\
2553 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2554 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2555 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2556 _gdvirtual_##m_name##_initialized = true;\
2557 }\
2558 if (_gdvirtual_##m_name) {\
2559 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2560 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2561 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2562 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2563 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2564 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2565 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2566 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2567 GDExtensionConstTypePtr argptrs[8]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8};\
2568\
2569 PtrToArg<m_ret>::EncodeT ret;\
2570 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2571 r_ret = (m_ret)ret;\
2572 return true;\
2573 }\
2574 \
2575 if (required) {\
2576 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2577 (void)r_ret;\
2578 }\
2579\
2580 return false;\
2581}\
2582_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2583 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2584 if (_script_instance) {\
2585 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2586 }\
2587 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2588 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2589 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2590 _gdvirtual_##m_name##_initialized = true;\
2591 }\
2592 if (_gdvirtual_##m_name) {\
2593 return true;\
2594 }\
2595 return false;\
2596}\
2597\
2598_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2599 MethodInfo method_info;\
2600 method_info.name = #m_name;\
2601 method_info.flags = METHOD_FLAG_VIRTUAL;\
2602 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2603 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2604 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2605 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2606 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2607 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2608 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2609 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2610 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2611 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2612 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2613 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2614 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2615 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2616 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2617 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2618 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2619 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2620\
2621 return method_info;\
2622}
2623
2624
2625#define GDVIRTUAL8C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8) \
2626StringName _gdvirtual_##m_name##_sn = #m_name;\
2627mutable bool _gdvirtual_##m_name##_initialized = false;\
2628mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2629template<bool required>\
2630_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8) const { \
2631 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2632 if (_script_instance) {\
2633 Callable::CallError ce; \
2634 Variant vargs[8]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8)};\
2635 const Variant *vargptrs[8]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7]};\
2636\
2637 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,8, ce);\
2638 if (ce.error == Callable::CallError::CALL_OK) {\
2639 \
2640 return true;\
2641 } \
2642 }\
2643 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2644 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2645 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2646 _gdvirtual_##m_name##_initialized = true;\
2647 }\
2648 if (_gdvirtual_##m_name) {\
2649 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2650 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2651 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2652 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2653 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2654 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2655 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2656 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2657 GDExtensionConstTypePtr argptrs[8]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8};\
2658\
2659 \
2660 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
2661 \
2662 return true;\
2663 }\
2664 \
2665 if (required) {\
2666 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2667 \
2668 }\
2669\
2670 return false;\
2671}\
2672_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2673 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2674 if (_script_instance) {\
2675 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2676 }\
2677 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2678 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2679 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2680 _gdvirtual_##m_name##_initialized = true;\
2681 }\
2682 if (_gdvirtual_##m_name) {\
2683 return true;\
2684 }\
2685 return false;\
2686}\
2687\
2688_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2689 MethodInfo method_info;\
2690 method_info.name = #m_name;\
2691 method_info.flags = METHOD_FLAG_VIRTUAL;\
2692 method_info.flags|=METHOD_FLAG_CONST;\
2693 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2694 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2695 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2696 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2697 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2698 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2699 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2700 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2701 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2702 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2703 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2704 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2705 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2706 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2707 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2708 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2709\
2710 return method_info;\
2711}
2712
2713
2714#define GDVIRTUAL8RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8) \
2715StringName _gdvirtual_##m_name##_sn = #m_name;\
2716mutable bool _gdvirtual_##m_name##_initialized = false;\
2717mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2718template<bool required>\
2719_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_ret& r_ret) const { \
2720 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2721 if (_script_instance) {\
2722 Callable::CallError ce; \
2723 Variant vargs[8]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8)};\
2724 const Variant *vargptrs[8]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7]};\
2725\
2726 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,8, ce);\
2727 if (ce.error == Callable::CallError::CALL_OK) {\
2728 r_ret = VariantCaster<m_ret>::cast(ret);\
2729 return true;\
2730 } \
2731 }\
2732 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2733 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2734 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2735 _gdvirtual_##m_name##_initialized = true;\
2736 }\
2737 if (_gdvirtual_##m_name) {\
2738 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2739 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2740 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2741 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2742 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2743 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2744 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2745 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2746 GDExtensionConstTypePtr argptrs[8]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8};\
2747\
2748 PtrToArg<m_ret>::EncodeT ret;\
2749 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2750 r_ret = (m_ret)ret;\
2751 return true;\
2752 }\
2753 \
2754 if (required) {\
2755 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2756 (void)r_ret;\
2757 }\
2758\
2759 return false;\
2760}\
2761_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2762 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2763 if (_script_instance) {\
2764 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2765 }\
2766 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2767 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2768 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2769 _gdvirtual_##m_name##_initialized = true;\
2770 }\
2771 if (_gdvirtual_##m_name) {\
2772 return true;\
2773 }\
2774 return false;\
2775}\
2776\
2777_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2778 MethodInfo method_info;\
2779 method_info.name = #m_name;\
2780 method_info.flags = METHOD_FLAG_VIRTUAL;\
2781 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2782 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2783 method_info.flags|=METHOD_FLAG_CONST;\
2784 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2785 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2786 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2787 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2788 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2789 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2790 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2791 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2792 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2793 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2794 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2795 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2796 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2797 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2798 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2799 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2800\
2801 return method_info;\
2802}
2803
2804/* 9 Arguments */
2805
2806
2807#define GDVIRTUAL9( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9) \
2808StringName _gdvirtual_##m_name##_sn = #m_name;\
2809mutable bool _gdvirtual_##m_name##_initialized = false;\
2810mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2811template<bool required>\
2812_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9) { \
2813 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2814 if (_script_instance) {\
2815 Callable::CallError ce; \
2816 Variant vargs[9]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9)};\
2817 const Variant *vargptrs[9]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8]};\
2818\
2819 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,9, ce);\
2820 if (ce.error == Callable::CallError::CALL_OK) {\
2821 \
2822 return true;\
2823 } \
2824 }\
2825 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2826 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2827 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2828 _gdvirtual_##m_name##_initialized = true;\
2829 }\
2830 if (_gdvirtual_##m_name) {\
2831 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2832 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2833 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2834 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2835 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2836 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2837 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2838 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2839 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
2840 GDExtensionConstTypePtr argptrs[9]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9};\
2841\
2842 \
2843 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
2844 \
2845 return true;\
2846 }\
2847 \
2848 if (required) {\
2849 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2850 \
2851 }\
2852\
2853 return false;\
2854}\
2855_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2856 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2857 if (_script_instance) {\
2858 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2859 }\
2860 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2861 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2862 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2863 _gdvirtual_##m_name##_initialized = true;\
2864 }\
2865 if (_gdvirtual_##m_name) {\
2866 return true;\
2867 }\
2868 return false;\
2869}\
2870\
2871_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2872 MethodInfo method_info;\
2873 method_info.name = #m_name;\
2874 method_info.flags = METHOD_FLAG_VIRTUAL;\
2875 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2876 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2877 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2878 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2879 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2880 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2881 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2882 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2883 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2884 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2885 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2886 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2887 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2888 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2889 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2890 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2891 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
2892 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
2893\
2894 return method_info;\
2895}
2896
2897
2898#define GDVIRTUAL9R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9) \
2899StringName _gdvirtual_##m_name##_sn = #m_name;\
2900mutable bool _gdvirtual_##m_name##_initialized = false;\
2901mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2902template<bool required>\
2903_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_ret& r_ret) { \
2904 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2905 if (_script_instance) {\
2906 Callable::CallError ce; \
2907 Variant vargs[9]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9)};\
2908 const Variant *vargptrs[9]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8]};\
2909\
2910 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,9, ce);\
2911 if (ce.error == Callable::CallError::CALL_OK) {\
2912 r_ret = VariantCaster<m_ret>::cast(ret);\
2913 return true;\
2914 } \
2915 }\
2916 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2917 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2918 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2919 _gdvirtual_##m_name##_initialized = true;\
2920 }\
2921 if (_gdvirtual_##m_name) {\
2922 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
2923 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
2924 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
2925 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
2926 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
2927 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
2928 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
2929 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
2930 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
2931 GDExtensionConstTypePtr argptrs[9]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9};\
2932\
2933 PtrToArg<m_ret>::EncodeT ret;\
2934 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
2935 r_ret = (m_ret)ret;\
2936 return true;\
2937 }\
2938 \
2939 if (required) {\
2940 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
2941 (void)r_ret;\
2942 }\
2943\
2944 return false;\
2945}\
2946_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
2947 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2948 if (_script_instance) {\
2949 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
2950 }\
2951 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
2952 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
2953 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
2954 _gdvirtual_##m_name##_initialized = true;\
2955 }\
2956 if (_gdvirtual_##m_name) {\
2957 return true;\
2958 }\
2959 return false;\
2960}\
2961\
2962_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
2963 MethodInfo method_info;\
2964 method_info.name = #m_name;\
2965 method_info.flags = METHOD_FLAG_VIRTUAL;\
2966 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
2967 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
2968 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
2969 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
2970 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
2971 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
2972 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
2973 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
2974 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
2975 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
2976 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
2977 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
2978 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
2979 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
2980 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
2981 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
2982 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
2983 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
2984 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
2985 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
2986\
2987 return method_info;\
2988}
2989
2990
2991#define GDVIRTUAL9C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9) \
2992StringName _gdvirtual_##m_name##_sn = #m_name;\
2993mutable bool _gdvirtual_##m_name##_initialized = false;\
2994mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
2995template<bool required>\
2996_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9) const { \
2997 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
2998 if (_script_instance) {\
2999 Callable::CallError ce; \
3000 Variant vargs[9]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9)};\
3001 const Variant *vargptrs[9]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8]};\
3002\
3003 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,9, ce);\
3004 if (ce.error == Callable::CallError::CALL_OK) {\
3005 \
3006 return true;\
3007 } \
3008 }\
3009 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3010 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3011 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3012 _gdvirtual_##m_name##_initialized = true;\
3013 }\
3014 if (_gdvirtual_##m_name) {\
3015 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3016 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3017 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3018 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3019 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3020 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3021 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3022 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3023 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3024 GDExtensionConstTypePtr argptrs[9]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9};\
3025\
3026 \
3027 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3028 \
3029 return true;\
3030 }\
3031 \
3032 if (required) {\
3033 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3034 \
3035 }\
3036\
3037 return false;\
3038}\
3039_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3040 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3041 if (_script_instance) {\
3042 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3043 }\
3044 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3045 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3046 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3047 _gdvirtual_##m_name##_initialized = true;\
3048 }\
3049 if (_gdvirtual_##m_name) {\
3050 return true;\
3051 }\
3052 return false;\
3053}\
3054\
3055_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3056 MethodInfo method_info;\
3057 method_info.name = #m_name;\
3058 method_info.flags = METHOD_FLAG_VIRTUAL;\
3059 method_info.flags|=METHOD_FLAG_CONST;\
3060 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3061 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3062 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3063 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3064 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3065 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3066 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3067 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3068 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3069 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3070 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3071 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3072 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3073 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3074 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3075 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3076 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3077 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3078\
3079 return method_info;\
3080}
3081
3082
3083#define GDVIRTUAL9RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9) \
3084StringName _gdvirtual_##m_name##_sn = #m_name;\
3085mutable bool _gdvirtual_##m_name##_initialized = false;\
3086mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3087template<bool required>\
3088_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_ret& r_ret) const { \
3089 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3090 if (_script_instance) {\
3091 Callable::CallError ce; \
3092 Variant vargs[9]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9)};\
3093 const Variant *vargptrs[9]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8]};\
3094\
3095 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,9, ce);\
3096 if (ce.error == Callable::CallError::CALL_OK) {\
3097 r_ret = VariantCaster<m_ret>::cast(ret);\
3098 return true;\
3099 } \
3100 }\
3101 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3102 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3103 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3104 _gdvirtual_##m_name##_initialized = true;\
3105 }\
3106 if (_gdvirtual_##m_name) {\
3107 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3108 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3109 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3110 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3111 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3112 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3113 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3114 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3115 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3116 GDExtensionConstTypePtr argptrs[9]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9};\
3117\
3118 PtrToArg<m_ret>::EncodeT ret;\
3119 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
3120 r_ret = (m_ret)ret;\
3121 return true;\
3122 }\
3123 \
3124 if (required) {\
3125 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3126 (void)r_ret;\
3127 }\
3128\
3129 return false;\
3130}\
3131_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3132 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3133 if (_script_instance) {\
3134 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3135 }\
3136 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3137 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3138 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3139 _gdvirtual_##m_name##_initialized = true;\
3140 }\
3141 if (_gdvirtual_##m_name) {\
3142 return true;\
3143 }\
3144 return false;\
3145}\
3146\
3147_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3148 MethodInfo method_info;\
3149 method_info.name = #m_name;\
3150 method_info.flags = METHOD_FLAG_VIRTUAL;\
3151 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
3152 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
3153 method_info.flags|=METHOD_FLAG_CONST;\
3154 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3155 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3156 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3157 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3158 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3159 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3160 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3161 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3162 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3163 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3164 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3165 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3166 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3167 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3168 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3169 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3170 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3171 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3172\
3173 return method_info;\
3174}
3175
3176/* 10 Arguments */
3177
3178
3179#define GDVIRTUAL10( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10) \
3180StringName _gdvirtual_##m_name##_sn = #m_name;\
3181mutable bool _gdvirtual_##m_name##_initialized = false;\
3182mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3183template<bool required>\
3184_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10) { \
3185 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3186 if (_script_instance) {\
3187 Callable::CallError ce; \
3188 Variant vargs[10]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10)};\
3189 const Variant *vargptrs[10]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9]};\
3190\
3191 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,10, ce);\
3192 if (ce.error == Callable::CallError::CALL_OK) {\
3193 \
3194 return true;\
3195 } \
3196 }\
3197 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3198 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3199 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3200 _gdvirtual_##m_name##_initialized = true;\
3201 }\
3202 if (_gdvirtual_##m_name) {\
3203 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3204 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3205 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3206 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3207 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3208 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3209 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3210 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3211 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3212 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3213 GDExtensionConstTypePtr argptrs[10]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10};\
3214\
3215 \
3216 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3217 \
3218 return true;\
3219 }\
3220 \
3221 if (required) {\
3222 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3223 \
3224 }\
3225\
3226 return false;\
3227}\
3228_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3229 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3230 if (_script_instance) {\
3231 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3232 }\
3233 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3234 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3235 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3236 _gdvirtual_##m_name##_initialized = true;\
3237 }\
3238 if (_gdvirtual_##m_name) {\
3239 return true;\
3240 }\
3241 return false;\
3242}\
3243\
3244_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3245 MethodInfo method_info;\
3246 method_info.name = #m_name;\
3247 method_info.flags = METHOD_FLAG_VIRTUAL;\
3248 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3249 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3250 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3251 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3252 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3253 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3254 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3255 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3256 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3257 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3258 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3259 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3260 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3261 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3262 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3263 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3264 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3265 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3266 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3267 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3268\
3269 return method_info;\
3270}
3271
3272
3273#define GDVIRTUAL10R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10) \
3274StringName _gdvirtual_##m_name##_sn = #m_name;\
3275mutable bool _gdvirtual_##m_name##_initialized = false;\
3276mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3277template<bool required>\
3278_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_ret& r_ret) { \
3279 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3280 if (_script_instance) {\
3281 Callable::CallError ce; \
3282 Variant vargs[10]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10)};\
3283 const Variant *vargptrs[10]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9]};\
3284\
3285 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,10, ce);\
3286 if (ce.error == Callable::CallError::CALL_OK) {\
3287 r_ret = VariantCaster<m_ret>::cast(ret);\
3288 return true;\
3289 } \
3290 }\
3291 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3292 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3293 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3294 _gdvirtual_##m_name##_initialized = true;\
3295 }\
3296 if (_gdvirtual_##m_name) {\
3297 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3298 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3299 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3300 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3301 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3302 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3303 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3304 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3305 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3306 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3307 GDExtensionConstTypePtr argptrs[10]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10};\
3308\
3309 PtrToArg<m_ret>::EncodeT ret;\
3310 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
3311 r_ret = (m_ret)ret;\
3312 return true;\
3313 }\
3314 \
3315 if (required) {\
3316 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3317 (void)r_ret;\
3318 }\
3319\
3320 return false;\
3321}\
3322_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3323 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3324 if (_script_instance) {\
3325 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3326 }\
3327 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3328 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3329 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3330 _gdvirtual_##m_name##_initialized = true;\
3331 }\
3332 if (_gdvirtual_##m_name) {\
3333 return true;\
3334 }\
3335 return false;\
3336}\
3337\
3338_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3339 MethodInfo method_info;\
3340 method_info.name = #m_name;\
3341 method_info.flags = METHOD_FLAG_VIRTUAL;\
3342 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
3343 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
3344 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3345 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3346 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3347 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3348 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3349 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3350 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3351 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3352 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3353 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3354 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3355 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3356 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3357 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3358 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3359 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3360 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3361 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3362 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3363 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3364\
3365 return method_info;\
3366}
3367
3368
3369#define GDVIRTUAL10C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10) \
3370StringName _gdvirtual_##m_name##_sn = #m_name;\
3371mutable bool _gdvirtual_##m_name##_initialized = false;\
3372mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3373template<bool required>\
3374_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10) const { \
3375 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3376 if (_script_instance) {\
3377 Callable::CallError ce; \
3378 Variant vargs[10]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10)};\
3379 const Variant *vargptrs[10]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9]};\
3380\
3381 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,10, ce);\
3382 if (ce.error == Callable::CallError::CALL_OK) {\
3383 \
3384 return true;\
3385 } \
3386 }\
3387 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3388 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3389 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3390 _gdvirtual_##m_name##_initialized = true;\
3391 }\
3392 if (_gdvirtual_##m_name) {\
3393 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3394 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3395 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3396 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3397 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3398 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3399 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3400 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3401 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3402 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3403 GDExtensionConstTypePtr argptrs[10]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10};\
3404\
3405 \
3406 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3407 \
3408 return true;\
3409 }\
3410 \
3411 if (required) {\
3412 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3413 \
3414 }\
3415\
3416 return false;\
3417}\
3418_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3419 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3420 if (_script_instance) {\
3421 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3422 }\
3423 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3424 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3425 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3426 _gdvirtual_##m_name##_initialized = true;\
3427 }\
3428 if (_gdvirtual_##m_name) {\
3429 return true;\
3430 }\
3431 return false;\
3432}\
3433\
3434_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3435 MethodInfo method_info;\
3436 method_info.name = #m_name;\
3437 method_info.flags = METHOD_FLAG_VIRTUAL;\
3438 method_info.flags|=METHOD_FLAG_CONST;\
3439 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3440 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3441 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3442 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3443 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3444 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3445 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3446 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3447 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3448 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3449 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3450 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3451 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3452 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3453 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3454 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3455 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3456 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3457 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3458 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3459\
3460 return method_info;\
3461}
3462
3463
3464#define GDVIRTUAL10RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10) \
3465StringName _gdvirtual_##m_name##_sn = #m_name;\
3466mutable bool _gdvirtual_##m_name##_initialized = false;\
3467mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3468template<bool required>\
3469_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_ret& r_ret) const { \
3470 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3471 if (_script_instance) {\
3472 Callable::CallError ce; \
3473 Variant vargs[10]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10)};\
3474 const Variant *vargptrs[10]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9]};\
3475\
3476 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,10, ce);\
3477 if (ce.error == Callable::CallError::CALL_OK) {\
3478 r_ret = VariantCaster<m_ret>::cast(ret);\
3479 return true;\
3480 } \
3481 }\
3482 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3483 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3484 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3485 _gdvirtual_##m_name##_initialized = true;\
3486 }\
3487 if (_gdvirtual_##m_name) {\
3488 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3489 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3490 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3491 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3492 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3493 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3494 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3495 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3496 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3497 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3498 GDExtensionConstTypePtr argptrs[10]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10};\
3499\
3500 PtrToArg<m_ret>::EncodeT ret;\
3501 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
3502 r_ret = (m_ret)ret;\
3503 return true;\
3504 }\
3505 \
3506 if (required) {\
3507 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3508 (void)r_ret;\
3509 }\
3510\
3511 return false;\
3512}\
3513_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3514 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3515 if (_script_instance) {\
3516 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3517 }\
3518 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3519 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3520 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3521 _gdvirtual_##m_name##_initialized = true;\
3522 }\
3523 if (_gdvirtual_##m_name) {\
3524 return true;\
3525 }\
3526 return false;\
3527}\
3528\
3529_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3530 MethodInfo method_info;\
3531 method_info.name = #m_name;\
3532 method_info.flags = METHOD_FLAG_VIRTUAL;\
3533 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
3534 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
3535 method_info.flags|=METHOD_FLAG_CONST;\
3536 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3537 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3538 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3539 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3540 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3541 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3542 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3543 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3544 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3545 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3546 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3547 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3548 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3549 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3550 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3551 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3552 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3553 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3554 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3555 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3556\
3557 return method_info;\
3558}
3559
3560/* 11 Arguments */
3561
3562
3563#define GDVIRTUAL11( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \
3564StringName _gdvirtual_##m_name##_sn = #m_name;\
3565mutable bool _gdvirtual_##m_name##_initialized = false;\
3566mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3567template<bool required>\
3568_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) { \
3569 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3570 if (_script_instance) {\
3571 Callable::CallError ce; \
3572 Variant vargs[11]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11)};\
3573 const Variant *vargptrs[11]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10]};\
3574\
3575 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,11, ce);\
3576 if (ce.error == Callable::CallError::CALL_OK) {\
3577 \
3578 return true;\
3579 } \
3580 }\
3581 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3582 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3583 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3584 _gdvirtual_##m_name##_initialized = true;\
3585 }\
3586 if (_gdvirtual_##m_name) {\
3587 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3588 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3589 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3590 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3591 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3592 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3593 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3594 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3595 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3596 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3597 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
3598 GDExtensionConstTypePtr argptrs[11]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11};\
3599\
3600 \
3601 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3602 \
3603 return true;\
3604 }\
3605 \
3606 if (required) {\
3607 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3608 \
3609 }\
3610\
3611 return false;\
3612}\
3613_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3614 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3615 if (_script_instance) {\
3616 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3617 }\
3618 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3619 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3620 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3621 _gdvirtual_##m_name##_initialized = true;\
3622 }\
3623 if (_gdvirtual_##m_name) {\
3624 return true;\
3625 }\
3626 return false;\
3627}\
3628\
3629_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3630 MethodInfo method_info;\
3631 method_info.name = #m_name;\
3632 method_info.flags = METHOD_FLAG_VIRTUAL;\
3633 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3634 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3635 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3636 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3637 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3638 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3639 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3640 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3641 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3642 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3643 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3644 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3645 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3646 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3647 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3648 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3649 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3650 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3651 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3652 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3653 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
3654 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
3655\
3656 return method_info;\
3657}
3658
3659
3660#define GDVIRTUAL11R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \
3661StringName _gdvirtual_##m_name##_sn = #m_name;\
3662mutable bool _gdvirtual_##m_name##_initialized = false;\
3663mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3664template<bool required>\
3665_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_ret& r_ret) { \
3666 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3667 if (_script_instance) {\
3668 Callable::CallError ce; \
3669 Variant vargs[11]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11)};\
3670 const Variant *vargptrs[11]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10]};\
3671\
3672 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,11, ce);\
3673 if (ce.error == Callable::CallError::CALL_OK) {\
3674 r_ret = VariantCaster<m_ret>::cast(ret);\
3675 return true;\
3676 } \
3677 }\
3678 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3679 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3680 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3681 _gdvirtual_##m_name##_initialized = true;\
3682 }\
3683 if (_gdvirtual_##m_name) {\
3684 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3685 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3686 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3687 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3688 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3689 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3690 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3691 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3692 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3693 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3694 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
3695 GDExtensionConstTypePtr argptrs[11]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11};\
3696\
3697 PtrToArg<m_ret>::EncodeT ret;\
3698 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
3699 r_ret = (m_ret)ret;\
3700 return true;\
3701 }\
3702 \
3703 if (required) {\
3704 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3705 (void)r_ret;\
3706 }\
3707\
3708 return false;\
3709}\
3710_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3711 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3712 if (_script_instance) {\
3713 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3714 }\
3715 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3716 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3717 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3718 _gdvirtual_##m_name##_initialized = true;\
3719 }\
3720 if (_gdvirtual_##m_name) {\
3721 return true;\
3722 }\
3723 return false;\
3724}\
3725\
3726_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3727 MethodInfo method_info;\
3728 method_info.name = #m_name;\
3729 method_info.flags = METHOD_FLAG_VIRTUAL;\
3730 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
3731 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
3732 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3733 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3734 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3735 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3736 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3737 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3738 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3739 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3740 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3741 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3742 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3743 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3744 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3745 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3746 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3747 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3748 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3749 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3750 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3751 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3752 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
3753 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
3754\
3755 return method_info;\
3756}
3757
3758
3759#define GDVIRTUAL11C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \
3760StringName _gdvirtual_##m_name##_sn = #m_name;\
3761mutable bool _gdvirtual_##m_name##_initialized = false;\
3762mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3763template<bool required>\
3764_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11) const { \
3765 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3766 if (_script_instance) {\
3767 Callable::CallError ce; \
3768 Variant vargs[11]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11)};\
3769 const Variant *vargptrs[11]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10]};\
3770\
3771 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,11, ce);\
3772 if (ce.error == Callable::CallError::CALL_OK) {\
3773 \
3774 return true;\
3775 } \
3776 }\
3777 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3778 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3779 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3780 _gdvirtual_##m_name##_initialized = true;\
3781 }\
3782 if (_gdvirtual_##m_name) {\
3783 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3784 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3785 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3786 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3787 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3788 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3789 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3790 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3791 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3792 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3793 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
3794 GDExtensionConstTypePtr argptrs[11]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11};\
3795\
3796 \
3797 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3798 \
3799 return true;\
3800 }\
3801 \
3802 if (required) {\
3803 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3804 \
3805 }\
3806\
3807 return false;\
3808}\
3809_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3810 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3811 if (_script_instance) {\
3812 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3813 }\
3814 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3815 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3816 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3817 _gdvirtual_##m_name##_initialized = true;\
3818 }\
3819 if (_gdvirtual_##m_name) {\
3820 return true;\
3821 }\
3822 return false;\
3823}\
3824\
3825_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3826 MethodInfo method_info;\
3827 method_info.name = #m_name;\
3828 method_info.flags = METHOD_FLAG_VIRTUAL;\
3829 method_info.flags|=METHOD_FLAG_CONST;\
3830 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3831 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3832 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3833 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3834 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3835 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3836 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3837 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3838 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3839 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3840 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3841 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3842 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3843 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3844 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3845 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3846 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3847 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3848 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3849 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3850 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
3851 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
3852\
3853 return method_info;\
3854}
3855
3856
3857#define GDVIRTUAL11RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11) \
3858StringName _gdvirtual_##m_name##_sn = #m_name;\
3859mutable bool _gdvirtual_##m_name##_initialized = false;\
3860mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3861template<bool required>\
3862_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_ret& r_ret) const { \
3863 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3864 if (_script_instance) {\
3865 Callable::CallError ce; \
3866 Variant vargs[11]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11)};\
3867 const Variant *vargptrs[11]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10]};\
3868\
3869 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,11, ce);\
3870 if (ce.error == Callable::CallError::CALL_OK) {\
3871 r_ret = VariantCaster<m_ret>::cast(ret);\
3872 return true;\
3873 } \
3874 }\
3875 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3876 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3877 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3878 _gdvirtual_##m_name##_initialized = true;\
3879 }\
3880 if (_gdvirtual_##m_name) {\
3881 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3882 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3883 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3884 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3885 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3886 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3887 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3888 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3889 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3890 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3891 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
3892 GDExtensionConstTypePtr argptrs[11]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11};\
3893\
3894 PtrToArg<m_ret>::EncodeT ret;\
3895 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
3896 r_ret = (m_ret)ret;\
3897 return true;\
3898 }\
3899 \
3900 if (required) {\
3901 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
3902 (void)r_ret;\
3903 }\
3904\
3905 return false;\
3906}\
3907_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
3908 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3909 if (_script_instance) {\
3910 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
3911 }\
3912 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3913 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3914 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3915 _gdvirtual_##m_name##_initialized = true;\
3916 }\
3917 if (_gdvirtual_##m_name) {\
3918 return true;\
3919 }\
3920 return false;\
3921}\
3922\
3923_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
3924 MethodInfo method_info;\
3925 method_info.name = #m_name;\
3926 method_info.flags = METHOD_FLAG_VIRTUAL;\
3927 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
3928 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
3929 method_info.flags|=METHOD_FLAG_CONST;\
3930 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
3931 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
3932 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
3933 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
3934 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
3935 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
3936 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
3937 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
3938 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
3939 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
3940 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
3941 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
3942 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
3943 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
3944 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
3945 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
3946 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
3947 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
3948 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
3949 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
3950 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
3951 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
3952\
3953 return method_info;\
3954}
3955
3956/* 12 Arguments */
3957
3958
3959#define GDVIRTUAL12( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
3960StringName _gdvirtual_##m_name##_sn = #m_name;\
3961mutable bool _gdvirtual_##m_name##_initialized = false;\
3962mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
3963template<bool required>\
3964_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) { \
3965 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
3966 if (_script_instance) {\
3967 Callable::CallError ce; \
3968 Variant vargs[12]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11), Variant(arg12)};\
3969 const Variant *vargptrs[12]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10], &vargs[11]};\
3970\
3971 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,12, ce);\
3972 if (ce.error == Callable::CallError::CALL_OK) {\
3973 \
3974 return true;\
3975 } \
3976 }\
3977 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
3978 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
3979 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
3980 _gdvirtual_##m_name##_initialized = true;\
3981 }\
3982 if (_gdvirtual_##m_name) {\
3983 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
3984 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
3985 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
3986 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
3987 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
3988 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
3989 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
3990 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
3991 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
3992 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
3993 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
3994 PtrToArg<m_type12>::EncodeT argval12 = arg12;\
3995 GDExtensionConstTypePtr argptrs[12]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11, &argval12};\
3996\
3997 \
3998 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
3999 \
4000 return true;\
4001 }\
4002 \
4003 if (required) {\
4004 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
4005 \
4006 }\
4007\
4008 return false;\
4009}\
4010_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
4011 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4012 if (_script_instance) {\
4013 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
4014 }\
4015 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4016 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4017 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4018 _gdvirtual_##m_name##_initialized = true;\
4019 }\
4020 if (_gdvirtual_##m_name) {\
4021 return true;\
4022 }\
4023 return false;\
4024}\
4025\
4026_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
4027 MethodInfo method_info;\
4028 method_info.name = #m_name;\
4029 method_info.flags = METHOD_FLAG_VIRTUAL;\
4030 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
4031 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
4032 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
4033 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
4034 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
4035 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
4036 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
4037 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
4038 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
4039 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
4040 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
4041 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
4042 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
4043 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
4044 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
4045 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
4046 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
4047 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
4048 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
4049 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
4050 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
4051 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
4052 method_info.arguments.push_back(GetTypeInfo<m_type12>::get_class_info());\
4053 method_info.arguments_metadata.push_back(GetTypeInfo<m_type12>::METADATA);\
4054\
4055 return method_info;\
4056}
4057
4058
4059#define GDVIRTUAL12R(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
4060StringName _gdvirtual_##m_name##_sn = #m_name;\
4061mutable bool _gdvirtual_##m_name##_initialized = false;\
4062mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
4063template<bool required>\
4064_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12, m_ret& r_ret) { \
4065 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4066 if (_script_instance) {\
4067 Callable::CallError ce; \
4068 Variant vargs[12]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11), Variant(arg12)};\
4069 const Variant *vargptrs[12]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10], &vargs[11]};\
4070\
4071 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,12, ce);\
4072 if (ce.error == Callable::CallError::CALL_OK) {\
4073 r_ret = VariantCaster<m_ret>::cast(ret);\
4074 return true;\
4075 } \
4076 }\
4077 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4078 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4079 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4080 _gdvirtual_##m_name##_initialized = true;\
4081 }\
4082 if (_gdvirtual_##m_name) {\
4083 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
4084 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
4085 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
4086 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
4087 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
4088 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
4089 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
4090 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
4091 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
4092 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
4093 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
4094 PtrToArg<m_type12>::EncodeT argval12 = arg12;\
4095 GDExtensionConstTypePtr argptrs[12]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11, &argval12};\
4096\
4097 PtrToArg<m_ret>::EncodeT ret;\
4098 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
4099 r_ret = (m_ret)ret;\
4100 return true;\
4101 }\
4102 \
4103 if (required) {\
4104 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
4105 (void)r_ret;\
4106 }\
4107\
4108 return false;\
4109}\
4110_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
4111 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4112 if (_script_instance) {\
4113 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
4114 }\
4115 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4116 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4117 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4118 _gdvirtual_##m_name##_initialized = true;\
4119 }\
4120 if (_gdvirtual_##m_name) {\
4121 return true;\
4122 }\
4123 return false;\
4124}\
4125\
4126_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
4127 MethodInfo method_info;\
4128 method_info.name = #m_name;\
4129 method_info.flags = METHOD_FLAG_VIRTUAL;\
4130 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
4131 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
4132 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
4133 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
4134 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
4135 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
4136 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
4137 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
4138 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
4139 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
4140 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
4141 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
4142 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
4143 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
4144 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
4145 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
4146 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
4147 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
4148 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
4149 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
4150 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
4151 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
4152 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
4153 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
4154 method_info.arguments.push_back(GetTypeInfo<m_type12>::get_class_info());\
4155 method_info.arguments_metadata.push_back(GetTypeInfo<m_type12>::METADATA);\
4156\
4157 return method_info;\
4158}
4159
4160
4161#define GDVIRTUAL12C( m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
4162StringName _gdvirtual_##m_name##_sn = #m_name;\
4163mutable bool _gdvirtual_##m_name##_initialized = false;\
4164mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
4165template<bool required>\
4166_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12) const { \
4167 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4168 if (_script_instance) {\
4169 Callable::CallError ce; \
4170 Variant vargs[12]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11), Variant(arg12)};\
4171 const Variant *vargptrs[12]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10], &vargs[11]};\
4172\
4173 _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,12, ce);\
4174 if (ce.error == Callable::CallError::CALL_OK) {\
4175 \
4176 return true;\
4177 } \
4178 }\
4179 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4180 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4181 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4182 _gdvirtual_##m_name##_initialized = true;\
4183 }\
4184 if (_gdvirtual_##m_name) {\
4185 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
4186 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
4187 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
4188 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
4189 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
4190 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
4191 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
4192 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
4193 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
4194 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
4195 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
4196 PtrToArg<m_type12>::EncodeT argval12 = arg12;\
4197 GDExtensionConstTypePtr argptrs[12]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11, &argval12};\
4198\
4199 \
4200 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),nullptr);\
4201 \
4202 return true;\
4203 }\
4204 \
4205 if (required) {\
4206 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
4207 \
4208 }\
4209\
4210 return false;\
4211}\
4212_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
4213 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4214 if (_script_instance) {\
4215 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
4216 }\
4217 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4218 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4219 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4220 _gdvirtual_##m_name##_initialized = true;\
4221 }\
4222 if (_gdvirtual_##m_name) {\
4223 return true;\
4224 }\
4225 return false;\
4226}\
4227\
4228_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
4229 MethodInfo method_info;\
4230 method_info.name = #m_name;\
4231 method_info.flags = METHOD_FLAG_VIRTUAL;\
4232 method_info.flags|=METHOD_FLAG_CONST;\
4233 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
4234 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
4235 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
4236 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
4237 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
4238 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
4239 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
4240 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
4241 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
4242 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
4243 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
4244 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
4245 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
4246 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
4247 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
4248 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
4249 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
4250 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
4251 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
4252 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
4253 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
4254 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
4255 method_info.arguments.push_back(GetTypeInfo<m_type12>::get_class_info());\
4256 method_info.arguments_metadata.push_back(GetTypeInfo<m_type12>::METADATA);\
4257\
4258 return method_info;\
4259}
4260
4261
4262#define GDVIRTUAL12RC(m_ret, m_name , m_type1, m_type2, m_type3, m_type4, m_type5, m_type6, m_type7, m_type8, m_type9, m_type10, m_type11, m_type12) \
4263StringName _gdvirtual_##m_name##_sn = #m_name;\
4264mutable bool _gdvirtual_##m_name##_initialized = false;\
4265mutable GDExtensionClassCallVirtual _gdvirtual_##m_name = nullptr;\
4266template<bool required>\
4267_FORCE_INLINE_ bool _gdvirtual_##m_name##_call(m_type1 arg1, m_type2 arg2, m_type3 arg3, m_type4 arg4, m_type5 arg5, m_type6 arg6, m_type7 arg7, m_type8 arg8, m_type9 arg9, m_type10 arg10, m_type11 arg11, m_type12 arg12, m_ret& r_ret) const { \
4268 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4269 if (_script_instance) {\
4270 Callable::CallError ce; \
4271 Variant vargs[12]={Variant(arg1), Variant(arg2), Variant(arg3), Variant(arg4), Variant(arg5), Variant(arg6), Variant(arg7), Variant(arg8), Variant(arg9), Variant(arg10), Variant(arg11), Variant(arg12)};\
4272 const Variant *vargptrs[12]={&vargs[0], &vargs[1], &vargs[2], &vargs[3], &vargs[4], &vargs[5], &vargs[6], &vargs[7], &vargs[8], &vargs[9], &vargs[10], &vargs[11]};\
4273\
4274 Variant ret = _script_instance->callp(_gdvirtual_##m_name##_sn, (const Variant **)vargptrs,12, ce);\
4275 if (ce.error == Callable::CallError::CALL_OK) {\
4276 r_ret = VariantCaster<m_ret>::cast(ret);\
4277 return true;\
4278 } \
4279 }\
4280 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4281 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4282 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4283 _gdvirtual_##m_name##_initialized = true;\
4284 }\
4285 if (_gdvirtual_##m_name) {\
4286 PtrToArg<m_type1>::EncodeT argval1 = arg1;\
4287 PtrToArg<m_type2>::EncodeT argval2 = arg2;\
4288 PtrToArg<m_type3>::EncodeT argval3 = arg3;\
4289 PtrToArg<m_type4>::EncodeT argval4 = arg4;\
4290 PtrToArg<m_type5>::EncodeT argval5 = arg5;\
4291 PtrToArg<m_type6>::EncodeT argval6 = arg6;\
4292 PtrToArg<m_type7>::EncodeT argval7 = arg7;\
4293 PtrToArg<m_type8>::EncodeT argval8 = arg8;\
4294 PtrToArg<m_type9>::EncodeT argval9 = arg9;\
4295 PtrToArg<m_type10>::EncodeT argval10 = arg10;\
4296 PtrToArg<m_type11>::EncodeT argval11 = arg11;\
4297 PtrToArg<m_type12>::EncodeT argval12 = arg12;\
4298 GDExtensionConstTypePtr argptrs[12]={&argval1, &argval2, &argval3, &argval4, &argval5, &argval6, &argval7, &argval8, &argval9, &argval10, &argval11, &argval12};\
4299\
4300 PtrToArg<m_ret>::EncodeT ret;\
4301 _gdvirtual_##m_name(_get_extension_instance(),reinterpret_cast<GDExtensionConstTypePtr*>(argptrs),&ret);\
4302 r_ret = (m_ret)ret;\
4303 return true;\
4304 }\
4305 \
4306 if (required) {\
4307 ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");\
4308 (void)r_ret;\
4309 }\
4310\
4311 return false;\
4312}\
4313_FORCE_INLINE_ bool _gdvirtual_##m_name##_overridden() const { \
4314 ScriptInstance *_script_instance = ((Object*)(this))->get_script_instance();\
4315 if (_script_instance) {\
4316 return _script_instance->has_method(_gdvirtual_##m_name##_sn);\
4317 }\
4318 if (unlikely(_get_extension() && !_gdvirtual_##m_name##_initialized)) {\
4319 /* TODO: C-style cast because GDExtensionStringNamePtr's const qualifier is broken (see https://github.com/godotengine/godot/pull/67751) */\
4320 _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, (GDExtensionStringNamePtr)&_gdvirtual_##m_name##_sn) : (GDExtensionClassCallVirtual) nullptr;\
4321 _gdvirtual_##m_name##_initialized = true;\
4322 }\
4323 if (_gdvirtual_##m_name) {\
4324 return true;\
4325 }\
4326 return false;\
4327}\
4328\
4329_FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \
4330 MethodInfo method_info;\
4331 method_info.name = #m_name;\
4332 method_info.flags = METHOD_FLAG_VIRTUAL;\
4333 method_info.return_val = GetTypeInfo<m_ret>::get_class_info();\
4334 method_info.return_val_metadata = GetTypeInfo<m_ret>::METADATA;\
4335 method_info.flags|=METHOD_FLAG_CONST;\
4336 method_info.arguments.push_back(GetTypeInfo<m_type1>::get_class_info());\
4337 method_info.arguments_metadata.push_back(GetTypeInfo<m_type1>::METADATA);\
4338 method_info.arguments.push_back(GetTypeInfo<m_type2>::get_class_info());\
4339 method_info.arguments_metadata.push_back(GetTypeInfo<m_type2>::METADATA);\
4340 method_info.arguments.push_back(GetTypeInfo<m_type3>::get_class_info());\
4341 method_info.arguments_metadata.push_back(GetTypeInfo<m_type3>::METADATA);\
4342 method_info.arguments.push_back(GetTypeInfo<m_type4>::get_class_info());\
4343 method_info.arguments_metadata.push_back(GetTypeInfo<m_type4>::METADATA);\
4344 method_info.arguments.push_back(GetTypeInfo<m_type5>::get_class_info());\
4345 method_info.arguments_metadata.push_back(GetTypeInfo<m_type5>::METADATA);\
4346 method_info.arguments.push_back(GetTypeInfo<m_type6>::get_class_info());\
4347 method_info.arguments_metadata.push_back(GetTypeInfo<m_type6>::METADATA);\
4348 method_info.arguments.push_back(GetTypeInfo<m_type7>::get_class_info());\
4349 method_info.arguments_metadata.push_back(GetTypeInfo<m_type7>::METADATA);\
4350 method_info.arguments.push_back(GetTypeInfo<m_type8>::get_class_info());\
4351 method_info.arguments_metadata.push_back(GetTypeInfo<m_type8>::METADATA);\
4352 method_info.arguments.push_back(GetTypeInfo<m_type9>::get_class_info());\
4353 method_info.arguments_metadata.push_back(GetTypeInfo<m_type9>::METADATA);\
4354 method_info.arguments.push_back(GetTypeInfo<m_type10>::get_class_info());\
4355 method_info.arguments_metadata.push_back(GetTypeInfo<m_type10>::METADATA);\
4356 method_info.arguments.push_back(GetTypeInfo<m_type11>::get_class_info());\
4357 method_info.arguments_metadata.push_back(GetTypeInfo<m_type11>::METADATA);\
4358 method_info.arguments.push_back(GetTypeInfo<m_type12>::get_class_info());\
4359 method_info.arguments_metadata.push_back(GetTypeInfo<m_type12>::METADATA);\
4360\
4361 return method_info;\
4362}
4363
4364#endif