@@ -303,123 +303,131 @@ Variant::operator float() const {
303303}
304304
305305Variant::operator String () const {
306- String result;
307- to_type_constructor[STRING](result._native_ptr (), _native_ptr ());
308- return result;
306+ return String (this );
309307}
310308
311309Variant::operator Vector2 () const {
310+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
312311 Vector2 result;
313312 to_type_constructor[VECTOR2]((GDExtensionTypePtr)&result, _native_ptr ());
314313 return result;
315314}
316315
317316Variant::operator Vector2i () const {
317+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
318318 Vector2i result;
319319 to_type_constructor[VECTOR2I]((GDExtensionTypePtr)&result, _native_ptr ());
320320 return result;
321321}
322322
323323Variant::operator Rect2 () const {
324+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
324325 Rect2 result;
325326 to_type_constructor[RECT2]((GDExtensionTypePtr)&result, _native_ptr ());
326327 return result;
327328}
328329
329330Variant::operator Rect2i () const {
331+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
330332 Rect2i result;
331333 to_type_constructor[RECT2I]((GDExtensionTypePtr)&result, _native_ptr ());
332334 return result;
333335}
334336
335337Variant::operator Vector3 () const {
338+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
336339 Vector3 result;
337340 to_type_constructor[VECTOR3]((GDExtensionTypePtr)&result, _native_ptr ());
338341 return result;
339342}
340343
341344Variant::operator Vector3i () const {
345+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
342346 Vector3i result;
343347 to_type_constructor[VECTOR3I]((GDExtensionTypePtr)&result, _native_ptr ());
344348 return result;
345349}
346350
347351Variant::operator Transform2D () const {
352+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
348353 Transform2D result;
349354 to_type_constructor[TRANSFORM2D]((GDExtensionTypePtr)&result, _native_ptr ());
350355 return result;
351356}
352357
353358Variant::operator Vector4 () const {
359+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
354360 Vector4 result;
355361 to_type_constructor[VECTOR4]((GDExtensionTypePtr)&result, _native_ptr ());
356362 return result;
357363}
358364
359365Variant::operator Vector4i () const {
366+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
360367 Vector4i result;
361368 to_type_constructor[VECTOR4I]((GDExtensionTypePtr)&result, _native_ptr ());
362369 return result;
363370}
364371
365372Variant::operator Plane () const {
373+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
366374 Plane result;
367375 to_type_constructor[PLANE]((GDExtensionTypePtr)&result, _native_ptr ());
368376 return result;
369377}
370378
371379Variant::operator Quaternion () const {
380+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
372381 Quaternion result;
373382 to_type_constructor[QUATERNION]((GDExtensionTypePtr)&result, _native_ptr ());
374383 return result;
375384}
376385
377386Variant::operator godot::AABB () const {
387+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
378388 godot::AABB result;
379389 to_type_constructor[AABB]((GDExtensionTypePtr)&result, _native_ptr ());
380390 return result;
381391}
382392
383393Variant::operator Basis () const {
394+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
384395 Basis result;
385396 to_type_constructor[BASIS]((GDExtensionTypePtr)&result, _native_ptr ());
386397 return result;
387398}
388399
389400Variant::operator Transform3D () const {
401+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
390402 Transform3D result;
391403 to_type_constructor[TRANSFORM3D]((GDExtensionTypePtr)&result, _native_ptr ());
392404 return result;
393405}
394406
395407Variant::operator Projection () const {
408+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
396409 Projection result;
397410 to_type_constructor[PROJECTION]((GDExtensionTypePtr)&result, _native_ptr ());
398411 return result;
399412}
400413
401414Variant::operator Color () const {
415+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
402416 Color result;
403417 to_type_constructor[COLOR]((GDExtensionTypePtr)&result, _native_ptr ());
404418 return result;
405419}
406420
407421Variant::operator StringName () const {
408- StringName result;
409- to_type_constructor[STRING_NAME](result._native_ptr (), _native_ptr ());
410- return result;
422+ return StringName (this );
411423}
412424
413425Variant::operator NodePath () const {
414- NodePath result;
415- to_type_constructor[NODE_PATH](result._native_ptr (), _native_ptr ());
416- return result;
426+ return NodePath (this );
417427}
418428
419429Variant::operator godot::RID () const {
420- godot::RID result;
421- to_type_constructor[RID](result._native_ptr (), _native_ptr ());
422- return result;
430+ return godot::RID (this );
423431}
424432
425433Variant::operator Object *() const {
@@ -447,81 +455,55 @@ Variant::operator ObjectID() const {
447455}
448456
449457Variant::operator Callable () const {
450- Callable result;
451- to_type_constructor[CALLABLE](result._native_ptr (), _native_ptr ());
452- return result;
458+ return Callable (this );
453459}
454460
455461Variant::operator Signal () const {
456- Signal result;
457- to_type_constructor[SIGNAL](result._native_ptr (), _native_ptr ());
458- return result;
462+ return Signal (this );
459463}
460464
461465Variant::operator Dictionary () const {
462- Dictionary result;
463- to_type_constructor[DICTIONARY](result._native_ptr (), _native_ptr ());
464- return result;
466+ return Dictionary (this );
465467}
466468
467469Variant::operator Array () const {
468- Array result;
469- to_type_constructor[ARRAY](result._native_ptr (), _native_ptr ());
470- return result;
470+ return Array (this );
471471}
472472
473473Variant::operator PackedByteArray () const {
474- PackedByteArray result;
475- to_type_constructor[PACKED_BYTE_ARRAY](result._native_ptr (), _native_ptr ());
476- return result;
474+ return PackedByteArray (this );
477475}
478476
479477Variant::operator PackedInt32Array () const {
480- PackedInt32Array result;
481- to_type_constructor[PACKED_INT32_ARRAY](result._native_ptr (), _native_ptr ());
482- return result;
478+ return PackedInt32Array (this );
483479}
484480
485481Variant::operator PackedInt64Array () const {
486- PackedInt64Array result;
487- to_type_constructor[PACKED_INT64_ARRAY](result._native_ptr (), _native_ptr ());
488- return result;
482+ return PackedInt64Array (this );
489483}
490484
491485Variant::operator PackedFloat32Array () const {
492- PackedFloat32Array result;
493- to_type_constructor[PACKED_FLOAT32_ARRAY](result._native_ptr (), _native_ptr ());
494- return result;
486+ return PackedFloat32Array (this );
495487}
496488
497489Variant::operator PackedFloat64Array () const {
498- PackedFloat64Array result;
499- to_type_constructor[PACKED_FLOAT64_ARRAY](result._native_ptr (), _native_ptr ());
500- return result;
490+ return PackedFloat64Array (this );
501491}
502492
503493Variant::operator PackedStringArray () const {
504- PackedStringArray result;
505- to_type_constructor[PACKED_STRING_ARRAY](result._native_ptr (), _native_ptr ());
506- return result;
494+ return PackedStringArray (this );
507495}
508496
509497Variant::operator PackedVector2Array () const {
510- PackedVector2Array result;
511- to_type_constructor[PACKED_VECTOR2_ARRAY](result._native_ptr (), _native_ptr ());
512- return result;
498+ return PackedVector2Array (this );
513499}
514500
515501Variant::operator PackedVector3Array () const {
516- PackedVector3Array result;
517- to_type_constructor[PACKED_VECTOR3_ARRAY](result._native_ptr (), _native_ptr ());
518- return result;
502+ return PackedVector3Array (this );
519503}
520504
521505Variant::operator PackedColorArray () const {
522- PackedColorArray result;
523- to_type_constructor[PACKED_COLOR_ARRAY](result._native_ptr (), _native_ptr ());
524- return result;
506+ return PackedColorArray (this );
525507}
526508
527509Variant &Variant::operator =(const Variant &other) {
0 commit comments