From f201382a854b5274933e945fc9f9676cea03aa36 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 10 Jan 2021 01:16:56 -0500 Subject: [PATCH] [3.2] Use instance and first arg in Basis is_equal_approx Discards the second argument. --- core/math/basis.h | 4 ++-- core/variant_call.cpp | 5 +++-- doc/classes/Basis.xml | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/math/basis.h b/core/math/basis.h index 7ee562e6e1e..01dbd72a833 100644 --- a/core/math/basis.h +++ b/core/math/basis.h @@ -145,8 +145,8 @@ public: } bool is_equal_approx(const Basis &p_basis) const; - // TODO: Break compatibility in 4.0 by getting rid of this so that it's only an instance method. See also TODO in variant_call.cpp - bool is_equal_approx(const Basis &a, const Basis &b) const { return a.is_equal_approx(b); } + // For complicated reasons, the second argument is always discarded. See #45062. + bool is_equal_approx(const Basis &a, const Basis &b) const { return is_equal_approx(a); } bool is_equal_approx_ratio(const Basis &a, const Basis &b, real_t p_epsilon = UNIT_EPSILON) const; bool operator==(const Basis &p_matrix) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 0a74c5fa2d4..3dd17059ba2 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -846,7 +846,7 @@ struct _VariantCall { VCALL_PTR0R(Basis, get_orthogonal_index); VCALL_PTR0R(Basis, orthonormalized); VCALL_PTR2R(Basis, slerp); - VCALL_PTR2R(Basis, is_equal_approx); // TODO: Break compatibility in 4.0 to change this to an instance method (a.is_equal_approx(b) as VCALL_PTR1R) for consistency. + VCALL_PTR2R(Basis, is_equal_approx); VCALL_PTR0R(Basis, get_rotation_quat); VCALL_PTR0R(Transform, inverse); @@ -1966,7 +1966,8 @@ void register_variant_methods() { ADDFUNC1R(BASIS, VECTOR3, Basis, xform_inv, VECTOR3, "v", varray()); ADDFUNC0R(BASIS, INT, Basis, get_orthogonal_index, varray()); ADDFUNC2R(BASIS, BASIS, Basis, slerp, BASIS, "b", REAL, "t", varray()); - ADDFUNC2R(BASIS, BOOL, Basis, is_equal_approx, BASIS, "b", REAL, "epsilon", varray(CMP_EPSILON)); // TODO: Replace in 4.0, see other TODO. + // For complicated reasons, the epsilon argument is always discarded. See #45062. + ADDFUNC2R(BASIS, BOOL, Basis, is_equal_approx, BASIS, "b", REAL, "epsilon", varray(CMP_EPSILON)); ADDFUNC0R(BASIS, QUAT, Basis, get_rotation_quat, varray()); ADDFUNC0R(TRANSFORM, TRANSFORM, Transform, inverse, varray()); diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index 14ce55548af..aa887284a3c 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -115,6 +115,7 @@ Returns [code]true[/code] if this basis and [code]b[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. + [b]Note:[/b] For complicated reasons, the epsilon argument is always discarded. Don't use the epsilon argument, it does nothing.