Remove redundant "== false" code
Some of this code has been re-organized. f
This commit is contained in:
parent
37386f112b
commit
4f7b33cdcf
33 changed files with 81 additions and 73 deletions
|
@ -145,6 +145,11 @@ bool Dictionary::operator==(const Dictionary &p_dictionary) const {
|
||||||
return _p == p_dictionary._p;
|
return _p == p_dictionary._p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Dictionary::operator!=(const Dictionary &p_dictionary) const {
|
||||||
|
|
||||||
|
return _p != p_dictionary._p;
|
||||||
|
}
|
||||||
|
|
||||||
void Dictionary::_ref(const Dictionary &p_from) const {
|
void Dictionary::_ref(const Dictionary &p_from) const {
|
||||||
|
|
||||||
//make a copy first (thread safe)
|
//make a copy first (thread safe)
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
bool erase(const Variant &p_key);
|
bool erase(const Variant &p_key);
|
||||||
|
|
||||||
bool operator==(const Dictionary &p_dictionary) const;
|
bool operator==(const Dictionary &p_dictionary) const;
|
||||||
|
bool operator!=(const Dictionary &p_dictionary) const;
|
||||||
|
|
||||||
uint32_t hash() const;
|
uint32_t hash() const;
|
||||||
void operator=(const Dictionary &p_dictionary);
|
void operator=(const Dictionary &p_dictionary);
|
||||||
|
|
|
@ -209,7 +209,7 @@ class PoolVector {
|
||||||
if (!alloc)
|
if (!alloc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (alloc->refcount.unref() == false) {
|
if (!alloc->refcount.unref()) {
|
||||||
alloc = NULL;
|
alloc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ bool MultiplayerAPI::_send_confirm_path(NodePath p_path, PathSentCache *psc, int
|
||||||
|
|
||||||
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
|
Map<int, bool>::Element *F = psc->confirmed_peers.find(E->get());
|
||||||
|
|
||||||
if (!F || F->get() == false) {
|
if (!F || !F->get()) {
|
||||||
// Path was not cached, or was cached but is unconfirmed.
|
// Path was not cached, or was cached but is unconfirmed.
|
||||||
if (!F) {
|
if (!F) {
|
||||||
// Not cached at all, take note.
|
// Not cached at all, take note.
|
||||||
|
|
|
@ -299,14 +299,14 @@ Vector3 Basis::rotref_posscale_decomposition(Basis &rotref) const {
|
||||||
ERR_FAIL_COND_V(determinant() == 0, Vector3());
|
ERR_FAIL_COND_V(determinant() == 0, Vector3());
|
||||||
|
|
||||||
Basis m = transposed() * (*this);
|
Basis m = transposed() * (*this);
|
||||||
ERR_FAIL_COND_V(m.is_diagonal() == false, Vector3());
|
ERR_FAIL_COND_V(!m.is_diagonal(), Vector3());
|
||||||
#endif
|
#endif
|
||||||
Vector3 scale = get_scale();
|
Vector3 scale = get_scale();
|
||||||
Basis inv_scale = Basis().scaled(scale.inverse()); // this will also absorb the sign of scale
|
Basis inv_scale = Basis().scaled(scale.inverse()); // this will also absorb the sign of scale
|
||||||
rotref = (*this) * inv_scale;
|
rotref = (*this) * inv_scale;
|
||||||
|
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(rotref.is_orthogonal() == false, Vector3());
|
ERR_FAIL_COND_V(!rotref.is_orthogonal(), Vector3());
|
||||||
#endif
|
#endif
|
||||||
return scale.abs();
|
return scale.abs();
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ Vector3 Basis::get_euler_xyz() const {
|
||||||
|
|
||||||
Vector3 euler;
|
Vector3 euler;
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, euler);
|
ERR_FAIL_COND_V(!is_rotation(), euler);
|
||||||
#endif
|
#endif
|
||||||
real_t sy = elements[0][2];
|
real_t sy = elements[0][2];
|
||||||
if (sy < 1.0) {
|
if (sy < 1.0) {
|
||||||
|
@ -497,7 +497,7 @@ Vector3 Basis::get_euler_yxz() const {
|
||||||
|
|
||||||
Vector3 euler;
|
Vector3 euler;
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, euler);
|
ERR_FAIL_COND_V(!is_rotation(), euler);
|
||||||
#endif
|
#endif
|
||||||
real_t m12 = elements[1][2];
|
real_t m12 = elements[1][2];
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ bool Basis::is_equal_approx(const Basis &a, const Basis &b) const {
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int j = 0; j < 3; j++) {
|
for (int j = 0; j < 3; j++) {
|
||||||
if (Math::is_equal_approx(a.elements[i][j], b.elements[i][j]) == false)
|
if (!Math::is_equal_approx(a.elements[i][j], b.elements[i][j]))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ Basis::operator String() const {
|
||||||
|
|
||||||
Quat Basis::get_quat() const {
|
Quat Basis::get_quat() const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, Quat());
|
ERR_FAIL_COND_V(!is_rotation(), Quat());
|
||||||
#endif
|
#endif
|
||||||
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
|
real_t trace = elements[0][0] + elements[1][1] + elements[2][2];
|
||||||
real_t temp[4];
|
real_t temp[4];
|
||||||
|
@ -697,7 +697,7 @@ void Basis::set_orthogonal_index(int p_index) {
|
||||||
|
|
||||||
void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
|
void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND(is_rotation() == false);
|
ERR_FAIL_COND(!is_rotation());
|
||||||
#endif
|
#endif
|
||||||
real_t angle, x, y, z; // variables for result
|
real_t angle, x, y, z; // variables for result
|
||||||
real_t epsilon = 0.01; // margin to allow for rounding errors
|
real_t epsilon = 0.01; // margin to allow for rounding errors
|
||||||
|
@ -785,7 +785,7 @@ void Basis::set_quat(const Quat &p_quat) {
|
||||||
void Basis::set_axis_angle(const Vector3 &p_axis, real_t p_phi) {
|
void Basis::set_axis_angle(const Vector3 &p_axis, real_t p_phi) {
|
||||||
// Rotation matrix from axis and angle, see https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_angle
|
// Rotation matrix from axis and angle, see https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_angle
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND(p_axis.is_normalized() == false);
|
ERR_FAIL_COND(!p_axis.is_normalized());
|
||||||
#endif
|
#endif
|
||||||
Vector3 axis_sq(p_axis.x * p_axis.x, p_axis.y * p_axis.y, p_axis.z * p_axis.z);
|
Vector3 axis_sq(p_axis.x * p_axis.x, p_axis.y * p_axis.y, p_axis.z * p_axis.z);
|
||||||
|
|
||||||
|
@ -837,8 +837,8 @@ void Basis::set_diagonal(const Vector3 p_diag) {
|
||||||
Basis Basis::slerp(const Basis &target, const real_t &t) const {
|
Basis Basis::slerp(const Basis &target, const real_t &t) const {
|
||||||
// TODO: implement this directly without using quaternions to make it more efficient
|
// TODO: implement this directly without using quaternions to make it more efficient
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_rotation() == false, Basis());
|
ERR_FAIL_COND_V(!is_rotation(), Basis());
|
||||||
ERR_FAIL_COND_V(target.is_rotation() == false, Basis());
|
ERR_FAIL_COND_V(!target.is_rotation(), Basis());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Quat from(*this);
|
Quat from(*this);
|
||||||
|
|
|
@ -100,7 +100,7 @@ void Quat::set_euler_yxz(const Vector3 &p_euler) {
|
||||||
// This implementation uses YXZ convention (Z is the first rotation).
|
// This implementation uses YXZ convention (Z is the first rotation).
|
||||||
Vector3 Quat::get_euler_yxz() const {
|
Vector3 Quat::get_euler_yxz() const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Vector3(0, 0, 0));
|
ERR_FAIL_COND_V(!is_normalized(), Vector3(0, 0, 0));
|
||||||
#endif
|
#endif
|
||||||
Basis m(*this);
|
Basis m(*this);
|
||||||
return m.get_euler_yxz();
|
return m.get_euler_yxz();
|
||||||
|
@ -140,15 +140,15 @@ bool Quat::is_normalized() const {
|
||||||
|
|
||||||
Quat Quat::inverse() const {
|
Quat Quat::inverse() const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!is_normalized(), Quat());
|
||||||
#endif
|
#endif
|
||||||
return Quat(-x, -y, -z, w);
|
return Quat(-x, -y, -z, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
Quat Quat::slerp(const Quat &q, const real_t &t) const {
|
Quat Quat::slerp(const Quat &q, const real_t &t) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
||||||
#endif
|
#endif
|
||||||
Quat to1;
|
Quat to1;
|
||||||
real_t omega, cosom, sinom, scale0, scale1;
|
real_t omega, cosom, sinom, scale0, scale1;
|
||||||
|
@ -194,8 +194,8 @@ Quat Quat::slerp(const Quat &q, const real_t &t) const {
|
||||||
|
|
||||||
Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
||||||
#endif
|
#endif
|
||||||
const Quat &from = *this;
|
const Quat &from = *this;
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
||||||
|
|
||||||
Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const {
|
Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(q.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
||||||
#endif
|
#endif
|
||||||
//the only way to do slerp :|
|
//the only way to do slerp :|
|
||||||
real_t t2 = (1.0 - t) * t * 2;
|
real_t t2 = (1.0 - t) * t * 2;
|
||||||
|
@ -233,7 +233,7 @@ Quat::operator String() const {
|
||||||
|
|
||||||
void Quat::set_axis_angle(const Vector3 &axis, const real_t &angle) {
|
void Quat::set_axis_angle(const Vector3 &axis, const real_t &angle) {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND(axis.is_normalized() == false);
|
ERR_FAIL_COND(!axis.is_normalized());
|
||||||
#endif
|
#endif
|
||||||
real_t d = axis.length();
|
real_t d = axis.length();
|
||||||
if (d == 0)
|
if (d == 0)
|
||||||
|
|
|
@ -87,7 +87,7 @@ public:
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3 xform(const Vector3 &v) const {
|
_FORCE_INLINE_ Vector3 xform(const Vector3 &v) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, v);
|
ERR_FAIL_COND_V(!is_normalized(), v);
|
||||||
#endif
|
#endif
|
||||||
Vector3 u(x, y, z);
|
Vector3 u(x, y, z);
|
||||||
Vector3 uv = u.cross(v);
|
Vector3 uv = u.cross(v);
|
||||||
|
|
|
@ -167,7 +167,7 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
|
||||||
// slide returns the component of the vector along the given plane, specified by its normal vector.
|
// slide returns the component of the vector along the given plane, specified by its normal vector.
|
||||||
Vector2 Vector2::slide(const Vector2 &p_normal) const {
|
Vector2 Vector2::slide(const Vector2 &p_normal) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
|
ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector2());
|
||||||
#endif
|
#endif
|
||||||
return *this - p_normal * this->dot(p_normal);
|
return *this - p_normal * this->dot(p_normal);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ Vector2 Vector2::bounce(const Vector2 &p_normal) const {
|
||||||
|
|
||||||
Vector2 Vector2::reflect(const Vector2 &p_normal) const {
|
Vector2 Vector2::reflect(const Vector2 &p_normal) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
|
ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector2());
|
||||||
#endif
|
#endif
|
||||||
return 2.0 * p_normal * this->dot(p_normal) - *this;
|
return 2.0 * p_normal * this->dot(p_normal) - *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ Vector2 Vector2::linear_interpolate(const Vector2 &p_b, real_t p_t) const {
|
||||||
|
|
||||||
Vector2 Vector2::slerp(const Vector2 &p_b, real_t p_t) const {
|
Vector2 Vector2::slerp(const Vector2 &p_b, real_t p_t) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Vector2());
|
ERR_FAIL_COND_V(!is_normalized(), Vector2());
|
||||||
#endif
|
#endif
|
||||||
real_t theta = angle_to(p_b);
|
real_t theta = angle_to(p_b);
|
||||||
return rotated(theta * p_t);
|
return rotated(theta * p_t);
|
||||||
|
|
|
@ -218,7 +218,7 @@ Vector3 Vector3::linear_interpolate(const Vector3 &p_b, real_t p_t) const {
|
||||||
|
|
||||||
Vector3 Vector3::slerp(const Vector3 &p_b, real_t p_t) const {
|
Vector3 Vector3::slerp(const Vector3 &p_b, real_t p_t) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(is_normalized() == false, Vector3());
|
ERR_FAIL_COND_V(!is_normalized(), Vector3());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
real_t theta = angle_to(p_b);
|
real_t theta = angle_to(p_b);
|
||||||
|
@ -430,7 +430,7 @@ void Vector3::zero() {
|
||||||
// slide returns the component of the vector along the given plane, specified by its normal vector.
|
// slide returns the component of the vector along the given plane, specified by its normal vector.
|
||||||
Vector3 Vector3::slide(const Vector3 &p_normal) const {
|
Vector3 Vector3::slide(const Vector3 &p_normal) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
|
ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector3());
|
||||||
#endif
|
#endif
|
||||||
return *this - p_normal * this->dot(p_normal);
|
return *this - p_normal * this->dot(p_normal);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ Vector3 Vector3::bounce(const Vector3 &p_normal) const {
|
||||||
|
|
||||||
Vector3 Vector3::reflect(const Vector3 &p_normal) const {
|
Vector3 Vector3::reflect(const Vector3 &p_normal) const {
|
||||||
#ifdef MATH_CHECKS
|
#ifdef MATH_CHECKS
|
||||||
ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
|
ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector3());
|
||||||
#endif
|
#endif
|
||||||
return 2.0 * p_normal * this->dot(p_normal) - *this;
|
return 2.0 * p_normal * this->dot(p_normal) - *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,7 +521,7 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
|
||||||
const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
|
const Dictionary *arr_a = reinterpret_cast<const Dictionary *>(p_a._data._mem);
|
||||||
const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
|
const Dictionary *arr_b = reinterpret_cast<const Dictionary *>(p_b._data._mem);
|
||||||
|
|
||||||
_RETURN((*arr_a == *arr_b) == false);
|
_RETURN(*arr_a != *arr_b);
|
||||||
}
|
}
|
||||||
|
|
||||||
CASE_TYPE(math, OP_NOT_EQUAL, ARRAY) {
|
CASE_TYPE(math, OP_NOT_EQUAL, ARRAY) {
|
||||||
|
|
|
@ -6841,7 +6841,7 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level);
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glColorMask(1, 1, 1, 1);
|
glColorMask(1, 1, 1, 1);
|
||||||
if (rt->buffers.active == false) {
|
if (!rt->buffers.active) {
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -796,14 +796,13 @@ Error AudioDriverWASAPI::capture_start() {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (audio_input.active == false) {
|
if (audio_input.active) {
|
||||||
audio_input.audio_client->Start();
|
return FAILED;
|
||||||
audio_input.active = true;
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FAILED;
|
audio_input.audio_client->Start();
|
||||||
|
audio_input.active = true;
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error AudioDriverWASAPI::capture_stop() {
|
Error AudioDriverWASAPI::capture_stop() {
|
||||||
|
|
|
@ -501,7 +501,7 @@ void EditorFileDialog::_items_clear_selection() {
|
||||||
case MODE_OPEN_FILE:
|
case MODE_OPEN_FILE:
|
||||||
case MODE_OPEN_FILES:
|
case MODE_OPEN_FILES:
|
||||||
get_ok()->set_text(TTR("Open"));
|
get_ok()->set_text(TTR("Open"));
|
||||||
get_ok()->set_disabled(item_list->is_anything_selected() == false);
|
get_ok()->set_disabled(!item_list->is_anything_selected());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MODE_OPEN_DIR:
|
case MODE_OPEN_DIR:
|
||||||
|
|
|
@ -3889,7 +3889,7 @@ void EditorNode::_scene_tab_closed(int p_tab) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_scene_tab_hover(int p_tab) {
|
void EditorNode::_scene_tab_hover(int p_tab) {
|
||||||
if (bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover")) == false) {
|
if (!bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int current_tab = scene_tabs->get_current_tab();
|
int current_tab = scene_tabs->get_current_tab();
|
||||||
|
|
|
@ -257,7 +257,7 @@ void EditorProfiler::_update_plot() {
|
||||||
|
|
||||||
//get
|
//get
|
||||||
const Metric &m = frame_metrics[idx];
|
const Metric &m = frame_metrics[idx];
|
||||||
if (m.valid == false)
|
if (!m.valid)
|
||||||
continue; //skip because invalid
|
continue; //skip because invalid
|
||||||
|
|
||||||
float value = 0;
|
float value = 0;
|
||||||
|
|
|
@ -1793,22 +1793,22 @@ template <>
|
||||||
struct EditorSceneImporterGLTFInterpolate<Quat> {
|
struct EditorSceneImporterGLTFInterpolate<Quat> {
|
||||||
|
|
||||||
Quat lerp(const Quat &a, const Quat &b, float c) const {
|
Quat lerp(const Quat &a, const Quat &b, float c) const {
|
||||||
ERR_FAIL_COND_V(a.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!a.is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(b.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!b.is_normalized(), Quat());
|
||||||
|
|
||||||
return a.slerp(b, c).normalized();
|
return a.slerp(b, c).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
Quat catmull_rom(const Quat &p0, const Quat &p1, const Quat &p2, const Quat &p3, float c) {
|
Quat catmull_rom(const Quat &p0, const Quat &p1, const Quat &p2, const Quat &p3, float c) {
|
||||||
ERR_FAIL_COND_V(p1.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!p1.is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(p2.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!p2.is_normalized(), Quat());
|
||||||
|
|
||||||
return p1.slerp(p2, c).normalized();
|
return p1.slerp(p2, c).normalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
Quat bezier(Quat start, Quat control_1, Quat control_2, Quat end, float t) {
|
Quat bezier(Quat start, Quat control_1, Quat control_2, Quat end, float t) {
|
||||||
ERR_FAIL_COND_V(start.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!start.is_normalized(), Quat());
|
||||||
ERR_FAIL_COND_V(end.is_normalized() == false, Quat());
|
ERR_FAIL_COND_V(!end.is_normalized(), Quat());
|
||||||
|
|
||||||
return start.slerp(end, t).normalized();
|
return start.slerp(end, t).normalized();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5113,7 +5113,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
|
||||||
type == "AtlasTexture" ||
|
type == "AtlasTexture" ||
|
||||||
type == "LargeTexture") {
|
type == "LargeTexture") {
|
||||||
Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res));
|
Ref<Texture> texture = Ref<Texture>(Object::cast_to<Texture>(*res));
|
||||||
if (texture.is_valid() == false) {
|
if (!texture.is_valid()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -638,10 +638,10 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
|
||||||
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
|
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
|
||||||
|
|
||||||
TreeItem *subdir = include_files->create_item(p_item);
|
TreeItem *subdir = include_files->create_item(p_item);
|
||||||
if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes) == false) {
|
if (_fill_tree(p_dir->get_subdir(i), subdir, current, p_only_scenes)) {
|
||||||
memdelete(subdir);
|
|
||||||
} else {
|
|
||||||
used = true;
|
used = true;
|
||||||
|
} else {
|
||||||
|
memdelete(subdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -679,7 +679,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
||||||
|
|
||||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
|
if (tokenizer->get_token() == GDScriptTokenizer::TK_BUILT_IN_TYPE) {
|
||||||
Variant::Type ct = tokenizer->get_token_type();
|
Variant::Type ct = tokenizer->get_token_type();
|
||||||
if (p_parsing_constant == false) {
|
if (!p_parsing_constant) {
|
||||||
if (ct == Variant::ARRAY) {
|
if (ct == Variant::ARRAY) {
|
||||||
if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
|
if (tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
|
||||||
ArrayNode *arr = alloc_node<ArrayNode>();
|
ArrayNode *arr = alloc_node<ArrayNode>();
|
||||||
|
|
|
@ -1468,7 +1468,7 @@ void CSharpInstance::mono_object_disposed(MonoObject *p_obj) {
|
||||||
void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_owner_deleted) {
|
void CSharpInstance::mono_object_disposed_baseref(MonoObject *p_obj, bool p_is_finalizer, bool &r_owner_deleted) {
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
CRASH_COND(base_ref == false);
|
CRASH_COND(!base_ref);
|
||||||
CRASH_COND(gchandle.is_null());
|
CRASH_COND(gchandle.is_null());
|
||||||
#endif
|
#endif
|
||||||
if (_unreference_owner_unsafe()) {
|
if (_unreference_owner_unsafe()) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ void MonoBottomPanel::_update_build_tabs_list() {
|
||||||
item_tooltip += "Running";
|
item_tooltip += "Running";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tab->build_exited || !tab->build_result == MonoBuildTab::RESULT_SUCCESS) {
|
if (!tab->build_exited || tab->build_result == MonoBuildTab::RESULT_ERROR) {
|
||||||
item_tooltip += "\nErrors: " + itos(tab->error_count);
|
item_tooltip += "\nErrors: " + itos(tab->error_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2816,7 +2816,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
||||||
|
|
||||||
void VisualScriptEditor::connect_seq(Ref<VisualScriptNode> vnode_old, Ref<VisualScriptNode> vnode_new, int new_id) {
|
void VisualScriptEditor::connect_seq(Ref<VisualScriptNode> vnode_old, Ref<VisualScriptNode> vnode_new, int new_id) {
|
||||||
VisualScriptOperator *vnode_operator = Object::cast_to<VisualScriptOperator>(vnode_new.ptr());
|
VisualScriptOperator *vnode_operator = Object::cast_to<VisualScriptOperator>(vnode_new.ptr());
|
||||||
if (vnode_operator != NULL && vnode_operator->has_input_sequence_port() == false) {
|
if (vnode_operator != NULL && !vnode_operator->has_input_sequence_port()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VisualScriptConstructor *vnode_constructor = Object::cast_to<VisualScriptConstructor>(vnode_new.ptr());
|
VisualScriptConstructor *vnode_constructor = Object::cast_to<VisualScriptConstructor>(vnode_new.ptr());
|
||||||
|
@ -2826,7 +2826,7 @@ void VisualScriptEditor::connect_seq(Ref<VisualScriptNode> vnode_old, Ref<Visual
|
||||||
if (vnode_old->get_output_sequence_port_count() <= 0) {
|
if (vnode_old->get_output_sequence_port_count() <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (vnode_new->has_input_sequence_port() == false) {
|
if (!vnode_new->has_input_sequence_port()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -853,7 +853,7 @@ public:
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (instance->get_variable(variable, p_outputs[0]) == false) {
|
if (!instance->get_variable(variable, p_outputs[0])) {
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'";
|
r_error_str = RTR("VariableGet not found in script: ") + "'" + String(variable) + "'";
|
||||||
return false;
|
return false;
|
||||||
|
@ -975,7 +975,7 @@ public:
|
||||||
|
|
||||||
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Variant::CallError &r_error, String &r_error_str) {
|
||||||
|
|
||||||
if (instance->set_variable(variable, *p_inputs[0]) == false) {
|
if (!instance->set_variable(variable, *p_inputs[0])) {
|
||||||
|
|
||||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
|
||||||
r_error_str = RTR("VariableSet not found in script: ") + "'" + String(variable) + "'";
|
r_error_str = RTR("VariableSet not found in script: ") + "'" + String(variable) + "'";
|
||||||
|
|
|
@ -149,7 +149,7 @@ void VisualScriptPropertySelector::_update_search() {
|
||||||
Control::get_icon("PoolColorArray", "EditorIcons")
|
Control::get_icon("PoolColorArray", "EditorIcons")
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!seq_connect && visual_script_generic == false) {
|
if (!seq_connect && !visual_script_generic) {
|
||||||
get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box);
|
get_visual_node_names("flow_control/type_cast", Set<String>(), found, root, search_box);
|
||||||
get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box);
|
get_visual_node_names("functions/built_in/print", Set<String>(), found, root, search_box);
|
||||||
get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box);
|
get_visual_node_names("functions/by_type/" + Variant::get_type_name(type), Set<String>(), found, root, search_box);
|
||||||
|
@ -228,7 +228,7 @@ void VisualScriptPropertySelector::_update_search() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seq_connect && visual_script_generic == false) {
|
if (seq_connect && !visual_script_generic) {
|
||||||
String text = search_box->get_text();
|
String text = search_box->get_text();
|
||||||
create_visualscript_item(String("VisualScriptCondition"), root, text, String("Condition"));
|
create_visualscript_item(String("VisualScriptCondition"), root, text, String("Condition"));
|
||||||
create_visualscript_item(String("VisualScriptSwitch"), root, text, String("Switch"));
|
create_visualscript_item(String("VisualScriptSwitch"), root, text, String("Switch"));
|
||||||
|
|
|
@ -1744,7 +1744,7 @@ void OS_Windows::set_window_size(const Size2 p_size) {
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GetWindowRect(hWnd, &rect);
|
GetWindowRect(hWnd, &rect);
|
||||||
|
|
||||||
if (video_mode.borderless_window == false) {
|
if (!video_mode.borderless_window) {
|
||||||
RECT crect;
|
RECT crect;
|
||||||
GetClientRect(hWnd, &crect);
|
GetClientRect(hWnd, &crect);
|
||||||
|
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ void OS_X11::set_window_size(const Size2 p_size) {
|
||||||
int old_h = xwa.height;
|
int old_h = xwa.height;
|
||||||
|
|
||||||
// If window resizable is disabled we need to update the attributes first
|
// If window resizable is disabled we need to update the attributes first
|
||||||
if (is_window_resizable() == false) {
|
if (!is_window_resizable()) {
|
||||||
XSizeHints *xsh;
|
XSizeHints *xsh;
|
||||||
xsh = XAllocSizeHints();
|
xsh = XAllocSizeHints();
|
||||||
xsh->flags = PMinSize | PMaxSize;
|
xsh->flags = PMinSize | PMaxSize;
|
||||||
|
@ -1688,7 +1688,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//ignore
|
//ignore
|
||||||
if (last_is_pressed == false) {
|
if (!last_is_pressed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ BaseButton::DrawMode BaseButton::get_draw_mode() const {
|
||||||
return DRAW_DISABLED;
|
return DRAW_DISABLED;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (status.press_attempt == false && status.hovering) {
|
if (!status.press_attempt && status.hovering) {
|
||||||
if (status.pressed)
|
if (status.pressed)
|
||||||
return DRAW_HOVER_PRESSED;
|
return DRAW_HOVER_PRESSED;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ int G6DOFRotationalLimitMotorSW::testLimitValue(real_t test_value) {
|
||||||
real_t G6DOFRotationalLimitMotorSW::solveAngularLimits(
|
real_t G6DOFRotationalLimitMotorSW::solveAngularLimits(
|
||||||
real_t timeStep, Vector3 &axis, real_t jacDiagABInv,
|
real_t timeStep, Vector3 &axis, real_t jacDiagABInv,
|
||||||
BodySW *body0, BodySW *body1) {
|
BodySW *body0, BodySW *body1) {
|
||||||
if (needApplyTorques() == false) return 0.0f;
|
if (!needApplyTorques()) return 0.0f;
|
||||||
|
|
||||||
real_t target_velocity = m_targetVelocity;
|
real_t target_velocity = m_targetVelocity;
|
||||||
real_t maxMotorForce = m_maxMotorForce;
|
real_t maxMotorForce = m_maxMotorForce;
|
||||||
|
|
|
@ -118,14 +118,12 @@ public:
|
||||||
|
|
||||||
//! Is limited
|
//! Is limited
|
||||||
bool isLimited() {
|
bool isLimited() {
|
||||||
if (m_loLimit >= m_hiLimit) return false;
|
return (m_loLimit < m_hiLimit);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Need apply correction
|
//! Need apply correction
|
||||||
bool needApplyTorques() {
|
bool needApplyTorques() {
|
||||||
if (m_currentLimit == 0 && m_enableMotor == false) return false;
|
return (m_enableMotor || m_currentLimit != 0);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! calculates error
|
//! calculates error
|
||||||
|
|
|
@ -138,7 +138,7 @@ void BodyPair2DSW::_validate_contacts() {
|
||||||
Contact &c = contacts[i];
|
Contact &c = contacts[i];
|
||||||
|
|
||||||
bool erase = false;
|
bool erase = false;
|
||||||
if (c.reused == false) {
|
if (!c.reused) {
|
||||||
//was left behind in previous frame
|
//was left behind in previous frame
|
||||||
erase = true;
|
erase = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2831,7 +2831,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
|
||||||
RID rid = E->key();
|
RID rid = E->key();
|
||||||
const InstanceGIProbeData::LightCache &lc = E->get();
|
const InstanceGIProbeData::LightCache &lc = E->get();
|
||||||
|
|
||||||
if ((!probe_data->dynamic.light_cache_changes.has(rid) || !(probe_data->dynamic.light_cache_changes[rid] == lc)) && lc.visible) {
|
if ((!probe_data->dynamic.light_cache_changes.has(rid) || probe_data->dynamic.light_cache_changes[rid] != lc) && lc.visible) {
|
||||||
//erase light data
|
//erase light data
|
||||||
|
|
||||||
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1);
|
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, -1);
|
||||||
|
@ -2844,7 +2844,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) {
|
||||||
RID rid = E->key();
|
RID rid = E->key();
|
||||||
const InstanceGIProbeData::LightCache &lc = E->get();
|
const InstanceGIProbeData::LightCache &lc = E->get();
|
||||||
|
|
||||||
if ((!probe_data->dynamic.light_cache.has(rid) || !(probe_data->dynamic.light_cache[rid] == lc)) && lc.visible) {
|
if ((!probe_data->dynamic.light_cache.has(rid) || probe_data->dynamic.light_cache[rid] != lc) && lc.visible) {
|
||||||
//add light data
|
//add light data
|
||||||
|
|
||||||
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1);
|
_bake_gi_probe_light(header, cells, local_data, leaves, leaf_count, lc, 1);
|
||||||
|
@ -3061,7 +3061,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
||||||
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
||||||
lc.visible = E->get()->visible;
|
lc.visible = E->get()->visible;
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
if (!probe_data->dynamic.light_cache.has(E->get()->self) || probe_data->dynamic.light_cache[E->get()->self] != lc) {
|
||||||
all_equal = false;
|
all_equal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3081,7 +3081,7 @@ bool VisualServerScene::_check_gi_probe(Instance *p_gi_probe) {
|
||||||
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
lc.transform = probe_data->dynamic.light_to_cell_xform * E->get()->transform;
|
||||||
lc.visible = E->get()->visible;
|
lc.visible = E->get()->visible;
|
||||||
|
|
||||||
if (!probe_data->dynamic.light_cache.has(E->get()->self) || !(probe_data->dynamic.light_cache[E->get()->self] == lc)) {
|
if (!probe_data->dynamic.light_cache.has(E->get()->self) || probe_data->dynamic.light_cache[E->get()->self] != lc) {
|
||||||
all_equal = false;
|
all_equal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3164,7 +3164,7 @@ void VisualServerScene::render_probes() {
|
||||||
force_lighting = true;
|
force_lighting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probe->invalid == false && probe->dynamic.enabled) {
|
if (!probe->invalid && probe->dynamic.enabled) {
|
||||||
|
|
||||||
switch (probe->dynamic.updating_stage) {
|
switch (probe->dynamic.updating_stage) {
|
||||||
case GI_UPDATE_STAGE_CHECK: {
|
case GI_UPDATE_STAGE_CHECK: {
|
||||||
|
|
|
@ -355,6 +355,11 @@ public:
|
||||||
visible == p_cache.visible);
|
visible == p_cache.visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator!=(const LightCache &p_cache) {
|
||||||
|
|
||||||
|
return !operator==(p_cache);
|
||||||
|
}
|
||||||
|
|
||||||
LightCache() {
|
LightCache() {
|
||||||
|
|
||||||
type = VS::LIGHT_DIRECTIONAL;
|
type = VS::LIGHT_DIRECTIONAL;
|
||||||
|
|
Loading…
Reference in a new issue