diff options
author | clayjohn <claynjohn@gmail.com> | 2018-11-25 20:57:40 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2018-11-28 07:54:22 -0800 |
commit | 928ca2e1f2136f8e5cc723c1d2389b10f59281eb (patch) | |
tree | daac1f825e9bb3c4e0801745f2cfc93ecda191b3 /core | |
parent | 60cbb69c7c40efd72234ef10e77767347d8df6c4 (diff) |
construct transform from transform2d bug
Diffstat (limited to 'core')
-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..eb9f34fee6 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[0][1]; + m.basis.elements[0][1] = t.elements[1][0]; + 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(); } |