@@ -303,123 +303,131 @@ Variant::operator float() const {
303
303
}
304
304
305
305
Variant::operator String () const {
306
- String result;
307
- to_type_constructor[STRING](result._native_ptr (), _native_ptr ());
308
- return result;
306
+ return String (this );
309
307
}
310
308
311
309
Variant::operator Vector2 () const {
310
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
312
311
Vector2 result;
313
312
to_type_constructor[VECTOR2]((GDExtensionTypePtr)&result, _native_ptr ());
314
313
return result;
315
314
}
316
315
317
316
Variant::operator Vector2i () const {
317
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
318
318
Vector2i result;
319
319
to_type_constructor[VECTOR2I]((GDExtensionTypePtr)&result, _native_ptr ());
320
320
return result;
321
321
}
322
322
323
323
Variant::operator Rect2 () const {
324
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
324
325
Rect2 result;
325
326
to_type_constructor[RECT2]((GDExtensionTypePtr)&result, _native_ptr ());
326
327
return result;
327
328
}
328
329
329
330
Variant::operator Rect2i () const {
331
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
330
332
Rect2i result;
331
333
to_type_constructor[RECT2I]((GDExtensionTypePtr)&result, _native_ptr ());
332
334
return result;
333
335
}
334
336
335
337
Variant::operator Vector3 () const {
338
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
336
339
Vector3 result;
337
340
to_type_constructor[VECTOR3]((GDExtensionTypePtr)&result, _native_ptr ());
338
341
return result;
339
342
}
340
343
341
344
Variant::operator Vector3i () const {
345
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
342
346
Vector3i result;
343
347
to_type_constructor[VECTOR3I]((GDExtensionTypePtr)&result, _native_ptr ());
344
348
return result;
345
349
}
346
350
347
351
Variant::operator Transform2D () const {
352
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
348
353
Transform2D result;
349
354
to_type_constructor[TRANSFORM2D]((GDExtensionTypePtr)&result, _native_ptr ());
350
355
return result;
351
356
}
352
357
353
358
Variant::operator Vector4 () const {
359
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
354
360
Vector4 result;
355
361
to_type_constructor[VECTOR4]((GDExtensionTypePtr)&result, _native_ptr ());
356
362
return result;
357
363
}
358
364
359
365
Variant::operator Vector4i () const {
366
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
360
367
Vector4i result;
361
368
to_type_constructor[VECTOR4I]((GDExtensionTypePtr)&result, _native_ptr ());
362
369
return result;
363
370
}
364
371
365
372
Variant::operator Plane () const {
373
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
366
374
Plane result;
367
375
to_type_constructor[PLANE]((GDExtensionTypePtr)&result, _native_ptr ());
368
376
return result;
369
377
}
370
378
371
379
Variant::operator Quaternion () const {
380
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
372
381
Quaternion result;
373
382
to_type_constructor[QUATERNION]((GDExtensionTypePtr)&result, _native_ptr ());
374
383
return result;
375
384
}
376
385
377
386
Variant::operator godot::AABB () const {
387
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
378
388
godot::AABB result;
379
389
to_type_constructor[AABB]((GDExtensionTypePtr)&result, _native_ptr ());
380
390
return result;
381
391
}
382
392
383
393
Variant::operator Basis () const {
394
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
384
395
Basis result;
385
396
to_type_constructor[BASIS]((GDExtensionTypePtr)&result, _native_ptr ());
386
397
return result;
387
398
}
388
399
389
400
Variant::operator Transform3D () const {
401
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
390
402
Transform3D result;
391
403
to_type_constructor[TRANSFORM3D]((GDExtensionTypePtr)&result, _native_ptr ());
392
404
return result;
393
405
}
394
406
395
407
Variant::operator Projection () const {
408
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
396
409
Projection result;
397
410
to_type_constructor[PROJECTION]((GDExtensionTypePtr)&result, _native_ptr ());
398
411
return result;
399
412
}
400
413
401
414
Variant::operator Color () const {
415
+ // @todo Avoid initializing result before calling constructor (which will initialize it again)
402
416
Color result;
403
417
to_type_constructor[COLOR]((GDExtensionTypePtr)&result, _native_ptr ());
404
418
return result;
405
419
}
406
420
407
421
Variant::operator StringName () const {
408
- StringName result;
409
- to_type_constructor[STRING_NAME](result._native_ptr (), _native_ptr ());
410
- return result;
422
+ return StringName (this );
411
423
}
412
424
413
425
Variant::operator NodePath () const {
414
- NodePath result;
415
- to_type_constructor[NODE_PATH](result._native_ptr (), _native_ptr ());
416
- return result;
426
+ return NodePath (this );
417
427
}
418
428
419
429
Variant::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 );
423
431
}
424
432
425
433
Variant::operator Object *() const {
@@ -447,81 +455,55 @@ Variant::operator ObjectID() const {
447
455
}
448
456
449
457
Variant::operator Callable () const {
450
- Callable result;
451
- to_type_constructor[CALLABLE](result._native_ptr (), _native_ptr ());
452
- return result;
458
+ return Callable (this );
453
459
}
454
460
455
461
Variant::operator Signal () const {
456
- Signal result;
457
- to_type_constructor[SIGNAL](result._native_ptr (), _native_ptr ());
458
- return result;
462
+ return Signal (this );
459
463
}
460
464
461
465
Variant::operator Dictionary () const {
462
- Dictionary result;
463
- to_type_constructor[DICTIONARY](result._native_ptr (), _native_ptr ());
464
- return result;
466
+ return Dictionary (this );
465
467
}
466
468
467
469
Variant::operator Array () const {
468
- Array result;
469
- to_type_constructor[ARRAY](result._native_ptr (), _native_ptr ());
470
- return result;
470
+ return Array (this );
471
471
}
472
472
473
473
Variant::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 );
477
475
}
478
476
479
477
Variant::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 );
483
479
}
484
480
485
481
Variant::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 );
489
483
}
490
484
491
485
Variant::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 );
495
487
}
496
488
497
489
Variant::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 );
501
491
}
502
492
503
493
Variant::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 );
507
495
}
508
496
509
497
Variant::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 );
513
499
}
514
500
515
501
Variant::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 );
519
503
}
520
504
521
505
Variant::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 );
525
507
}
526
508
527
509
Variant &Variant::operator =(const Variant &other) {
0 commit comments