diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-28 15:14:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 15:14:02 +0100 |
commit | 348708cad30c2fa60e7bba6d62f0104c56fb9e1c (patch) | |
tree | 45792bab543c1576474f4d13fde4c2d1ff2e3907 | |
parent | c7dd58a4d5d9e6ba6a6e24167f4527ef94a3e35e (diff) | |
parent | d22bc7413c083b11e9ee0ae8532e5aadd8aa0375 (diff) |
Merge pull request #23976 from clayjohn/transform_bug
Construct Transform from Transform2D
-rw-r--r-- | core/variant.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index edbe66ba31..7a84c953d4 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1662,7 +1662,17 @@ Variant::operator Transform() const { return Transform(*_data._basis, Vector3()); else if (type == QUAT) return Transform(Basis(*reinterpret_cast<const Quat *>(_data._mem)), Vector3()); - else + else if (type == TRANSFORM2D) { + const Transform2D &t = *_data._transform2d; + Transform m; + m.basis.elements[0][0] = t.elements[0][0]; + m.basis.elements[1][0] = t.elements[1][0]; + m.basis.elements[0][1] = t.elements[0][1]; + m.basis.elements[1][1] = t.elements[1][1]; + m.origin[0] = t.elements[2][0]; + m.origin[1] = t.elements[2][1]; + return m; + } else return Transform(); } |