diff options
Diffstat (limited to 'core/helper')
-rw-r--r-- | core/helper/math_fieldwise.cpp | 105 |
1 files changed, 55 insertions, 50 deletions
diff --git a/core/helper/math_fieldwise.cpp b/core/helper/math_fieldwise.cpp index 204c431e1d..1ea754b70f 100644 --- a/core/helper/math_fieldwise.cpp +++ b/core/helper/math_fieldwise.cpp @@ -40,12 +40,15 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const switch (p_source.get_type()) { + /* clang-format makes a mess of this macro usage */ + /* clang-format off */ + case Variant::VECTOR2: { SETUP_TYPE(Vector2) - /**/ TRY_TRANSFER_FIELD("x",x) - else TRY_TRANSFER_FIELD("y",y) + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) return target; } @@ -54,10 +57,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Rect2) - /**/ TRY_TRANSFER_FIELD("x",pos.x) - else TRY_TRANSFER_FIELD("y",pos.y) - else TRY_TRANSFER_FIELD("w",size.x) - else TRY_TRANSFER_FIELD("h",size.y) + /**/ TRY_TRANSFER_FIELD("x", pos.x) + else TRY_TRANSFER_FIELD("y", pos.y) + else TRY_TRANSFER_FIELD("w", size.x) + else TRY_TRANSFER_FIELD("h", size.y) return target; } @@ -66,9 +69,9 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Vector3) - /**/ TRY_TRANSFER_FIELD("x",x) - else TRY_TRANSFER_FIELD("y",y) - else TRY_TRANSFER_FIELD("z",z) + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + else TRY_TRANSFER_FIELD("z", z) return target; } @@ -77,10 +80,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Plane) - /**/ TRY_TRANSFER_FIELD("x",normal.x) - else TRY_TRANSFER_FIELD("y",normal.y) - else TRY_TRANSFER_FIELD("z",normal.z) - else TRY_TRANSFER_FIELD("d",d) + /**/ TRY_TRANSFER_FIELD("x", normal.x) + else TRY_TRANSFER_FIELD("y", normal.y) + else TRY_TRANSFER_FIELD("z", normal.z) + else TRY_TRANSFER_FIELD("d", d) return target; } @@ -89,10 +92,10 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Quat) - /**/ TRY_TRANSFER_FIELD("x",x) - else TRY_TRANSFER_FIELD("y",y) - else TRY_TRANSFER_FIELD("z",z) - else TRY_TRANSFER_FIELD("w",w) + /**/ TRY_TRANSFER_FIELD("x", x) + else TRY_TRANSFER_FIELD("y", y) + else TRY_TRANSFER_FIELD("z", z) + else TRY_TRANSFER_FIELD("w", w) return target; } @@ -101,12 +104,12 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Rect3) - /**/ TRY_TRANSFER_FIELD("px",pos.x) - else TRY_TRANSFER_FIELD("py",pos.y) - else TRY_TRANSFER_FIELD("pz",pos.z) - else TRY_TRANSFER_FIELD("sx",size.x) - else TRY_TRANSFER_FIELD("sy",size.y) - else TRY_TRANSFER_FIELD("sz",size.z) + /**/ TRY_TRANSFER_FIELD("px", pos.x) + else TRY_TRANSFER_FIELD("py", pos.y) + else TRY_TRANSFER_FIELD("pz", pos.z) + else TRY_TRANSFER_FIELD("sx", size.x) + else TRY_TRANSFER_FIELD("sy", size.y) + else TRY_TRANSFER_FIELD("sz", size.z) return target; } @@ -115,12 +118,12 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Transform2D) - /**/ TRY_TRANSFER_FIELD("xx",elements[0][0]) - else TRY_TRANSFER_FIELD("xy",elements[0][1]) - else TRY_TRANSFER_FIELD("yx",elements[1][0]) - else TRY_TRANSFER_FIELD("yy",elements[1][1]) - else TRY_TRANSFER_FIELD("ox",elements[2][0]) - else TRY_TRANSFER_FIELD("oy",elements[2][1]) + /**/ TRY_TRANSFER_FIELD("xx", elements[0][0]) + else TRY_TRANSFER_FIELD("xy", elements[0][1]) + else TRY_TRANSFER_FIELD("yx", elements[1][0]) + else TRY_TRANSFER_FIELD("yy", elements[1][1]) + else TRY_TRANSFER_FIELD("ox", elements[2][0]) + else TRY_TRANSFER_FIELD("oy", elements[2][1]) return target; } @@ -129,15 +132,15 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Basis) - /**/ TRY_TRANSFER_FIELD("xx",elements[0][0]) - else TRY_TRANSFER_FIELD("xy",elements[0][1]) - else TRY_TRANSFER_FIELD("xz",elements[0][2]) - else TRY_TRANSFER_FIELD("yx",elements[1][0]) - else TRY_TRANSFER_FIELD("yy",elements[1][1]) - else TRY_TRANSFER_FIELD("yz",elements[1][2]) - else TRY_TRANSFER_FIELD("zx",elements[2][0]) - else TRY_TRANSFER_FIELD("zy",elements[2][1]) - else TRY_TRANSFER_FIELD("zz",elements[2][2]) + /**/ TRY_TRANSFER_FIELD("xx", elements[0][0]) + else TRY_TRANSFER_FIELD("xy", elements[0][1]) + else TRY_TRANSFER_FIELD("xz", elements[0][2]) + else TRY_TRANSFER_FIELD("yx", elements[1][0]) + else TRY_TRANSFER_FIELD("yy", elements[1][1]) + else TRY_TRANSFER_FIELD("yz", elements[1][2]) + else TRY_TRANSFER_FIELD("zx", elements[2][0]) + else TRY_TRANSFER_FIELD("zy", elements[2][1]) + else TRY_TRANSFER_FIELD("zz", elements[2][2]) return target; } @@ -146,18 +149,18 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const SETUP_TYPE(Transform) - /**/ TRY_TRANSFER_FIELD("xx",basis.elements[0][0]) - else TRY_TRANSFER_FIELD("xy",basis.elements[0][1]) - else TRY_TRANSFER_FIELD("xz",basis.elements[0][2]) - else TRY_TRANSFER_FIELD("yx",basis.elements[1][0]) - else TRY_TRANSFER_FIELD("yy",basis.elements[1][1]) - else TRY_TRANSFER_FIELD("yz",basis.elements[1][2]) - else TRY_TRANSFER_FIELD("zx",basis.elements[2][0]) - else TRY_TRANSFER_FIELD("zy",basis.elements[2][1]) - else TRY_TRANSFER_FIELD("zz",basis.elements[2][2]) - else TRY_TRANSFER_FIELD("xo",origin.x) - else TRY_TRANSFER_FIELD("yo",origin.y) - else TRY_TRANSFER_FIELD("zo",origin.z) + /**/ TRY_TRANSFER_FIELD("xx", basis.elements[0][0]) + else TRY_TRANSFER_FIELD("xy", basis.elements[0][1]) + else TRY_TRANSFER_FIELD("xz", basis.elements[0][2]) + else TRY_TRANSFER_FIELD("yx", basis.elements[1][0]) + else TRY_TRANSFER_FIELD("yy", basis.elements[1][1]) + else TRY_TRANSFER_FIELD("yz", basis.elements[1][2]) + else TRY_TRANSFER_FIELD("zx", basis.elements[2][0]) + else TRY_TRANSFER_FIELD("zy", basis.elements[2][1]) + else TRY_TRANSFER_FIELD("zz", basis.elements[2][2]) + else TRY_TRANSFER_FIELD("xo", origin.x) + else TRY_TRANSFER_FIELD("yo", origin.y) + else TRY_TRANSFER_FIELD("zo", origin.z) return target; } @@ -165,6 +168,8 @@ Variant fieldwise_assign(const Variant& p_target, const Variant& p_source, const default: { ERR_FAIL_V(p_target); } + + /* clang-format on */ } } |