Variant

Godot's tagged union type.

Primitives, Godot core types, and GodotObject-derived classes can be stored in a Variant. Other user-defined D types can be made compatible with Variant by defining to!CustomType(Variant) and to!Variant(CustomType) functions.

Properties and method arguments/returns are passed between Godot and D through Variant, so these must use Variant-compatible types.

struct Variant {}

Constructors

this
this(R input)
Undocumented in source.
this
this(Variant other)
Undocumented in source.
this
this(T nil)
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

DType
alias DType = AliasSeq!(typeof(null), bool, long, double, String, Vector2, Rect2, Vector3, Transform2D, Plane, Quat, AABB, Basis, Transform, Color, NodePath, RID, GodotObject, Dictionary, Array, PoolByteArray, PoolIntArray, PoolRealArray, PoolStringArray, PoolVector2Array, PoolVector3Array, PoolColorArray)

D type that this Variant implementation uses

InternalType
alias InternalType = AliasSeq!(typeof(null), godot_bool, long, double, godot_string, godot_vector2, godot_rect2, godot_vector3, godot_transform2d, godot_plane, godot_quat, godot_aabb, godot_basis, godot_transform, godot_color, godot_node_path, godot_rid, godot_object, godot_dictionary, godot_array, godot_pool_byte_array, godot_pool_int_array, godot_pool_real_array, godot_pool_string_array, godot_pool_vector2_array, godot_pool_vector3_array, godot_pool_color_array)

GDNative type that gets passed to the C functions

conversionFromGodotType
alias conversionFromGodotType(T) = Unqual!(Parameters!(conversionFromGodot!T)[0])
Undocumented in source.
conversionToGodotType
alias conversionToGodotType(T) = Unqual!(ReturnType!(conversionToGodot!T))
Undocumented in source.

Enums

Operator
enum Operator
Type
enum Type

Functions

as
T as()
as
T as()
as
GodotType as()
as
R as()
as
inout(T) as()
Undocumented in source. Be warned that the author may not have intended to support it.
booleanize
bool booleanize()
Undocumented in source. Be warned that the author may not have intended to support it.
exactType
GodotType exactType()

The exact GodotType of the value stored in this Variant.

isType
bool isType(GodotType type)

Is this Variant of the specified type or of a subclass of type?

opAssign
void opAssign(T input)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
void opAssign(T nil)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
void opAssign(T other)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(Variant other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Variant other)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
auto toString()
Undocumented in source. Be warned that the author may not have intended to support it.
type
Type type()
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

from
Array from(T t)
from
Variant from(T t)
nil
Variant nil()
Undocumented in source. Be warned that the author may not have intended to support it.

Templates

compatibleFromGodot
template compatibleFromGodot(T)
Undocumented in source.
compatibleToGodot
template compatibleToGodot(T)
Undocumented in source.
conversionFromGodot
template conversionFromGodot(T)

function to convert a Godot-compatible type to T

conversionToGodot
template conversionToGodot(T)

function to convert T to an equivalent Godot type

getFromVariantFunction
template getFromVariantFunction(T)
Undocumented in source.
variantTypeOf
template variantTypeOf(T)

Get the Variant.Type of a compatible D type. Incompatible types return nil.

Variables

_godot_variant
godot_variant _godot_variant;
Undocumented in source.
compatible
enum bool compatible(R);
Undocumented in source.
convertsFromGodot
enum bool convertsFromGodot(T);
Undocumented in source.
convertsToGodot
enum bool convertsToGodot(T);
Undocumented in source.
directlyCompatible
enum bool directlyCompatible(T);
Undocumented in source.
hasFromVariantFunction
enum bool hasFromVariantFunction(T);
Undocumented in source.
hasToVariantFunction
enum bool hasToVariantFunction(T);
Undocumented in source.
hasVariantConstructor
enum bool hasVariantConstructor(T);
Undocumented in source.

Meta