From a3f8dde502dbd8d164cb1a87d7a29cbe6ce64fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 20 Nov 2017 22:41:22 +0100 Subject: Properly implement Basis constructor using Vector3 of Euler angles Fixes #13104. --- core/variant.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'core/variant.cpp') 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(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(_data._mem); - else if (type == TRANSFORM) + else if (type == VECTOR3) { + return Basis(*reinterpret_cast(_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(_data._mem) = *reinterpret_cast(p_variant._data._mem); } break; - // math types + // math types case VECTOR2: { @@ -2642,7 +2645,7 @@ uint32_t Variant::hash() const { return reinterpret_cast(_data._mem)->hash(); } break; - // math types + // math types case VECTOR2: { -- cgit v1.2.3