diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-11-22 01:20:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-22 01:20:14 +0100 |
commit | 3b7e9df2553f17f7d6eef5c7cb63b14d58d99d9f (patch) | |
tree | c2890ecaa769cb635054f0cdc2b3bcc35689f197 /core/variant.cpp | |
parent | f8fd9a4a62e32a34dc6ae888884eea115dcd75b4 (diff) | |
parent | a3f8dde502dbd8d164cb1a87d7a29cbe6ce64fde (diff) |
Merge pull request #13151 from akien-mga/basis-vector3-constructor
Properly implement Basis constructor using Vector3 of Euler angles
Diffstat (limited to 'core/variant.cpp')
-rw-r--r-- | core/variant.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index d4143b8d84..0f97b98a6f 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -66,7 +66,7 @@ String Variant::get_type_name(Variant::Type p_type) { return "String"; } break; - // math types + // math types case VECTOR2: { @@ -513,6 +513,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type static const Type valid[] = { QUAT, + VECTOR3, NIL }; @@ -723,7 +724,7 @@ bool Variant::is_zero() const { } break; - // math types + // math types case VECTOR2: { @@ -932,7 +933,7 @@ void Variant::reference(const Variant &p_variant) { memnew_placement(_data._mem, String(*reinterpret_cast<const String *>(p_variant._data._mem))); } break; - // math types + // math types case VECTOR2: { @@ -1632,7 +1633,9 @@ Variant::operator Basis() const { return *_data._basis; else if (type == QUAT) return *reinterpret_cast<const Quat *>(_data._mem); - else if (type == TRANSFORM) + else if (type == VECTOR3) { + return Basis(*reinterpret_cast<const Vector3 *>(_data._mem)); + } else if (type == TRANSFORM) // unexposed in Variant::can_convert? return _data._transform->basis; else return Basis(); @@ -2502,7 +2505,7 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast<String *>(_data._mem) = *reinterpret_cast<const String *>(p_variant._data._mem); } break; - // math types + // math types case VECTOR2: { @@ -2642,7 +2645,7 @@ uint32_t Variant::hash() const { return reinterpret_cast<const String *>(_data._mem)->hash(); } break; - // math types + // math types case VECTOR2: { |