diff --git a/.clang-format b/.clang-format index 982a74c5ade..518492c4734 100644 --- a/.clang-format +++ b/.clang-format @@ -12,7 +12,7 @@ AlignAfterOpenBracket: DontAlign # AlignConsecutiveBitFields: None # AlignConsecutiveDeclarations: None # AlignEscapedNewlines: Right -# AlignOperands: Align +AlignOperands: DontAlign AlignTrailingComments: false # AllowAllArgumentsOnNextLine: true # AllowAllConstructorInitializersOnNextLine: true diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 9f614ed3eec..297644620d0 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -239,7 +239,7 @@ bool AStar::are_points_connected(int p_id, int p_with_id, bool bidirectional) co const Set::Element *element = segments.find(s); return element != nullptr && - (bidirectional || (element->get().direction & s.direction) == s.direction); + (bidirectional || (element->get().direction & s.direction) == s.direction); } void AStar::clear() { diff --git a/core/math/aabb.h b/core/math/aabb.h index 1e7933bef2f..14c0ebf6959 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -183,7 +183,7 @@ Vector3 AABB::get_support(const Vector3 &p_normal) const { (p_normal.x > 0) ? -half_extents.x : half_extents.x, (p_normal.y > 0) ? -half_extents.y : half_extents.y, (p_normal.z > 0) ? -half_extents.z : half_extents.z) + - ofs; + ofs; } Vector3 AABB::get_endpoint(int p_point) const { diff --git a/core/math/basis.cpp b/core/math/basis.cpp index e95838a06a4..85dbf01386e 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -58,8 +58,8 @@ void Basis::invert() { cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1) }; real_t det = elements[0][0] * co[0] + - elements[0][1] * co[1] + - elements[0][2] * co[2]; + elements[0][1] * co[1] + + elements[0][2] * co[2]; #ifdef MATH_CHECKS ERR_FAIL_COND(det == 0); #endif @@ -272,10 +272,7 @@ Vector3 Basis::get_scale() const { // // The rotation part of this decomposition is returned by get_rotation* functions. real_t det_sign = SGN(determinant()); - return det_sign * Vector3( - Vector3(elements[0][0], elements[1][0], elements[2][0]).length(), - Vector3(elements[0][1], elements[1][1], elements[2][1]).length(), - Vector3(elements[0][2], elements[1][2], elements[2][2]).length()); + return det_sign * get_scale_abs(); } // Decomposes a Basis into a rotation-reflection matrix (an element of the group O(3)) and a positive scaling matrix as B = O.S. @@ -785,8 +782,8 @@ Quat Basis::get_quat() const { temp[2] = ((m.elements[1][0] - m.elements[0][1]) * s); } else { int i = m.elements[0][0] < m.elements[1][1] ? - (m.elements[1][1] < m.elements[2][2] ? 2 : 1) : - (m.elements[0][0] < m.elements[2][2] ? 2 : 0); + (m.elements[1][1] < m.elements[2][2] ? 2 : 1) : + (m.elements[0][0] < m.elements[2][2] ? 2 : 0); int j = (i + 1) % 3; int k = (i + 2) % 3; diff --git a/core/math/basis.h b/core/math/basis.h index b65dff84de6..ebd9e7725cf 100644 --- a/core/math/basis.h +++ b/core/math/basis.h @@ -323,7 +323,7 @@ Vector3 Basis::xform_inv(const Vector3 &p_vector) const { real_t Basis::determinant() const { return elements[0][0] * (elements[1][1] * elements[2][2] - elements[2][1] * elements[1][2]) - - elements[1][0] * (elements[0][1] * elements[2][2] - elements[2][1] * elements[0][2]) + - elements[2][0] * (elements[0][1] * elements[1][2] - elements[1][1] * elements[0][2]); + elements[1][0] * (elements[0][1] * elements[2][2] - elements[2][1] * elements[0][2]) + + elements[2][0] * (elements[0][1] * elements[1][2] - elements[1][1] * elements[0][2]); } #endif // BASIS_H diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 3e6d861f083..d0a7589dbbf 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -156,7 +156,7 @@ public: } ieee754; ieee754.f = p_val; return ((unsigned)(ieee754.u >> 32) & 0x7fffffff) == 0x7ff00000 && - ((unsigned)ieee754.u == 0); + ((unsigned)ieee754.u == 0); #else return isinf(p_val); #endif @@ -454,7 +454,7 @@ public: mantissa = 0; } hf = (((uint16_t)sign) << 15) | (uint16_t)((0x1F << 10)) | - (uint16_t)(mantissa >> 13); + (uint16_t)(mantissa >> 13); } // check if exponent is <= -15 else if (exp <= 0x38000000) { @@ -467,8 +467,8 @@ public: hf = 0; //denormals do not work for 3D, convert to zero } else { hf = (((uint16_t)sign) << 15) | - (uint16_t)((exp - 0x38000000) >> 13) | - (uint16_t)(mantissa >> 13); + (uint16_t)((exp - 0x38000000) >> 13) | + (uint16_t)(mantissa >> 13); } return hf; diff --git a/core/math/plane.cpp b/core/math/plane.cpp index 87710f9dea7..3f5a2294a91 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -91,7 +91,7 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r *r_result = ((vec3_cross(normal1, normal2) * p_plane0.d) + (vec3_cross(normal2, normal0) * p_plane1.d) + (vec3_cross(normal0, normal1) * p_plane2.d)) / - denom; + denom; } return true; diff --git a/core/math/rect2.h b/core/math/rect2.h index 7727d44dc49..65773cec67d 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -116,8 +116,8 @@ struct Rect2 { inline bool encloses(const Rect2 &p_rect) const { return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && - ((p_rect.position.x + p_rect.size.x) <= (position.x + size.x)) && - ((p_rect.position.y + p_rect.size.y) <= (position.y + size.y)); + ((p_rect.position.x + p_rect.size.x) <= (position.x + size.x)) && + ((p_rect.position.y + p_rect.size.y) <= (position.y + size.y)); } _FORCE_INLINE_ bool has_no_area() const { @@ -287,8 +287,8 @@ struct Rect2i { inline bool encloses(const Rect2i &p_rect) const { return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) && - ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && - ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); + ((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) && + ((p_rect.position.y + p_rect.size.y) < (position.y + size.y)); } _FORCE_INLINE_ bool has_no_area() const { diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index e8a1fed2303..2fa39796e0a 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -149,7 +149,7 @@ Vector2 Transform2D::xform(const Vector2 &p_vec) const { return Vector2( tdotx(p_vec), tdoty(p_vec)) + - elements[2]; + elements[2]; } Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const { Vector2 v = p_vec - elements[2]; diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index e27e02589c2..eea9975b687 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -149,10 +149,11 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c real_t t3 = t2 * t; Vector2 out; - out = 0.5 * ((p1 * 2.0) + - (-p0 + p2) * t + - (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + - (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); + out = 0.5 * + ((p1 * 2.0) + + (-p0 + p2) * t + + (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + + (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); return out; } diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index e4e4e0f51b1..17eebaad0f0 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -88,10 +88,11 @@ Vector3 Vector3::cubic_interpolaten(const Vector3 &p_b, const Vector3 &p_pre_a, real_t t3 = t2 * t; Vector3 out; - out = 0.5 * ((p1 * 2.0) + - (-p0 + p2) * t + - (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + - (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); + out = 0.5 * + ((p1 * 2.0) + + (-p0 + p2) * t + + (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + + (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); return out; } @@ -106,10 +107,11 @@ Vector3 Vector3::cubic_interpolate(const Vector3 &p_b, const Vector3 &p_pre_a, c real_t t3 = t2 * t; Vector3 out; - out = 0.5 * ((p1 * 2.0) + - (-p0 + p2) * t + - (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + - (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); + out = 0.5 * + ((p1 * 2.0) + + (-p0 + p2) * t + + (2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 + + (-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3); return out; } diff --git a/core/object.cpp b/core/object.cpp index 424e7c3a258..e81524bd9bb 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1526,9 +1526,10 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const Signal *s = signal_map.getptr(p_signal); if (!s) { bool signal_is_valid = ClassDB::has_signal(get_class_name(), p_signal) || - (!script.is_null() && Ref\n"; + p_name + ".service.worker.js');}});\n"; } // Replaces HTML string diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 92e5522abf3..3346c1ce1bb 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -343,10 +343,10 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { } // Xbox controller hat values start at 1 rather than 0. p_joy->offset_hat = vendor == 0x45e && - (product_id == 0x0b05 || - product_id == 0x02e0 || - product_id == 0x02fd || - product_id == 0x0b13); + (product_id == 0x0b05 || + product_id == 0x02e0 || + product_id == 0x02fd || + product_id == 0x0b13); return true; } diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index cb742b62dcc..e3fdf8efebb 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -131,8 +131,7 @@ void App::SetWindow(CoreWindow ^ p_window) { window->PointerWheelChanged += ref new TypedEventHandler(this, &App::OnPointerWheelChanged); - mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler( - this, &App::OnMouseModeChanged)); + mouseChangedNotifier = SignalNotifier::AttachToEvent(L"os_mouse_mode_changed", ref new SignalHandler(this, &App::OnMouseModeChanged)); mouseChangedNotifier->Enable(); diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp index a5feb8147af..d84e156ab6b 100644 --- a/platform/windows/key_mapping_windows.cpp +++ b/platform/windows/key_mapping_windows.cpp @@ -414,13 +414,13 @@ unsigned int KeyMappingWindows::get_scansym(unsigned int p_code, bool p_extended bool KeyMappingWindows::is_extended_key(unsigned int p_code) { return p_code == VK_INSERT || - p_code == VK_DELETE || - p_code == VK_HOME || - p_code == VK_END || - p_code == VK_PRIOR || - p_code == VK_NEXT || - p_code == VK_LEFT || - p_code == VK_UP || - p_code == VK_RIGHT || - p_code == VK_DOWN; + p_code == VK_DELETE || + p_code == VK_HOME || + p_code == VK_END || + p_code == VK_PRIOR || + p_code == VK_NEXT || + p_code == VK_LEFT || + p_code == VK_UP || + p_code == VK_RIGHT || + p_code == VK_DOWN; } diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index a24f0a27e93..0dc6524fff3 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -426,18 +426,18 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a XSetWindowAttributes new_attr; new_attr.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | - ButtonReleaseMask | EnterWindowMask | - LeaveWindowMask | PointerMotionMask | - Button1MotionMask | - Button2MotionMask | Button3MotionMask | - Button4MotionMask | Button5MotionMask | - ButtonMotionMask | KeymapStateMask | - ExposureMask | VisibilityChangeMask | - StructureNotifyMask | - SubstructureNotifyMask | SubstructureRedirectMask | - FocusChangeMask | PropertyChangeMask | - ColormapChangeMask | OwnerGrabButtonMask | - im_event_mask; + ButtonReleaseMask | EnterWindowMask | + LeaveWindowMask | PointerMotionMask | + Button1MotionMask | + Button2MotionMask | Button3MotionMask | + Button4MotionMask | Button5MotionMask | + ButtonMotionMask | KeymapStateMask | + ExposureMask | VisibilityChangeMask | + StructureNotifyMask | + SubstructureNotifyMask | SubstructureRedirectMask | + FocusChangeMask | PropertyChangeMask | + ColormapChangeMask | OwnerGrabButtonMask | + im_event_mask; XChangeWindowAttributes(x11_display, x11_window, CWEventMask, &new_attr); @@ -2115,11 +2115,11 @@ Atom OS_X11::_process_selection_request_target(Atom p_target, Window p_requestor 0); return p_property; } else if (p_target == XInternAtom(x11_display, "UTF8_STRING", 0) || - p_target == XInternAtom(x11_display, "COMPOUND_TEXT", 0) || - p_target == XInternAtom(x11_display, "TEXT", 0) || - p_target == XA_STRING || - p_target == XInternAtom(x11_display, "text/plain;charset=utf-8", 0) || - p_target == XInternAtom(x11_display, "text/plain", 0)) { + p_target == XInternAtom(x11_display, "COMPOUND_TEXT", 0) || + p_target == XInternAtom(x11_display, "TEXT", 0) || + p_target == XA_STRING || + p_target == XInternAtom(x11_display, "text/plain;charset=utf-8", 0) || + p_target == XInternAtom(x11_display, "text/plain", 0)) { // Directly using internal clipboard because we know our window // is the owner during a selection request. CharString clip = OS::get_clipboard().utf8(); @@ -2410,7 +2410,7 @@ void OS_X11::process_xevents() { if (pen_pressure_range != Vector2()) { xi.pressure_supported = true; xi.pressure = (*values - pen_pressure_range[0]) / - (pen_pressure_range[1] - pen_pressure_range[0]); + (pen_pressure_range[1] - pen_pressure_range[0]); } } @@ -3115,7 +3115,7 @@ String OS_X11::get_clipboard() const { Bool OS_X11::_predicate_clipboard_save_targets(Display *display, XEvent *event, XPointer arg) { if (event->xany.window == *(Window *)arg) { return (event->type == SelectionRequest) || - (event->type == SelectionNotify); + (event->type == SelectionNotify); } else { return False; } diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index b0a1d42c633..ed516645049 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -142,9 +142,9 @@ void LineBuilder::build() { _interpolate_color = gradient != nullptr; bool retrieve_curve = curve != nullptr; bool distance_required = _interpolate_color || - retrieve_curve || - texture_mode == Line2D::LINE_TEXTURE_TILE || - texture_mode == Line2D::LINE_TEXTURE_STRETCH; + retrieve_curve || + texture_mode == Line2D::LINE_TEXTURE_TILE || + texture_mode == Line2D::LINE_TEXTURE_STRETCH; if (distance_required) { total_distance = calculate_total_distance(points); //Adjust totalDistance. diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 3eb3062282f..4626f08ebaf 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -202,8 +202,7 @@ String CPUParticles::get_configuration_warning() const { warnings += "- " + TTR("Nothing is visible because no mesh has been assigned."); } - if (!anim_material_found && (get_param(PARAM_ANIM_SPEED) != 0.0 || get_param(PARAM_ANIM_OFFSET) != 0.0 || - get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) { + if (!anim_material_found && (get_param(PARAM_ANIM_SPEED) != 0.0 || get_param(PARAM_ANIM_OFFSET) != 0.0 || get_param_curve(PARAM_ANIM_SPEED).is_valid() || get_param_curve(PARAM_ANIM_OFFSET).is_valid())) { if (warnings != String()) { warnings += "\n"; } diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 9184f327be9..7d814f74526 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -123,7 +123,7 @@ void VehicleWheel::_update(PhysicsDirectBodyState *s) { Vector3 relpos = m_raycastInfo.m_contactPointWS - s->get_transform().origin; chassis_velocity_at_contactPoint = s->get_linear_velocity() + - (s->get_angular_velocity()).cross(relpos); // * mPos); + (s->get_angular_velocity()).cross(relpos); // * mPos); real_t projVel = m_raycastInfo.m_contactNormalWS.dot(chassis_velocity_at_contactPoint); if (project >= real_t(-0.1)) { @@ -460,7 +460,7 @@ real_t VehicleBody::_ray_cast(int p_idx, PhysicsDirectBodyState *s) { //chassis_velocity_at_contactPoint = getRigidBody()->getVelocityInLocalPoint(relpos); chassis_velocity_at_contactPoint = s->get_linear_velocity() + - (s->get_angular_velocity()).cross(wheel.m_raycastInfo.m_contactPointWS - s->get_transform().origin); // * mPos); + (s->get_angular_velocity()).cross(wheel.m_raycastInfo.m_contactPointWS - s->get_transform().origin); // * mPos); real_t projVel = wheel.m_raycastInfo.m_contactNormalWS.dot(chassis_velocity_at_contactPoint); @@ -788,7 +788,7 @@ void VehicleBody::_update_friction(PhysicsDirectBodyState *s) { VehicleWheel &wheelInfo = *wheels[wheel]; Vector3 rel_pos = wheelInfo.m_raycastInfo.m_contactPointWS - - s->get_transform().origin; + s->get_transform().origin; if (m_forwardImpulse[wheel] != real_t(0.)) { s->apply_impulse(rel_pos, m_forwardWS[wheel] * (m_forwardImpulse[wheel])); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 83056e43d01..b9f666d8820 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -70,8 +70,8 @@ Dictionary Control::_edit_get_state() const { void Control::_edit_set_state(const Dictionary &p_state) { ERR_FAIL_COND((p_state.size() <= 0) || - !p_state.has("rotation") || !p_state.has("scale") || - !p_state.has("pivot") || !p_state.has("anchors") || !p_state.has("margins")); + !p_state.has("rotation") || !p_state.has("scale") || + !p_state.has("pivot") || !p_state.has("anchors") || !p_state.has("margins")); Dictionary state = p_state; set_rotation(state["rotation"]); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 2d8b2fef206..31b7a0a5667 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -306,7 +306,7 @@ bool FileDialog::_is_open_should_be_disabled() { // Opening a file, but selected a folder? Forbidden. return ((mode == MODE_OPEN_FILE || mode == MODE_OPEN_FILES) && d["dir"]) || // Flipped case, also forbidden. - (mode == MODE_OPEN_DIR && !d["dir"]); + (mode == MODE_OPEN_DIR && !d["dir"]); } void FileDialog::_go_up() { diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index e54ba0b7bcb..f3688d08758 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -401,13 +401,13 @@ void Label::regenerate_word_cache() { // if your language is not well supported, consider helping improve // the unicode support in Godot. bool separatable = (current >= 0x2E08 && current <= 0x9FFF) || // CJK scripts and symbols. - (current >= 0xAC00 && current <= 0xD7FF) || // Hangul Syllables and Hangul Jamo Extended-B. - (current >= 0xF900 && current <= 0xFAFF) || // CJK Compatibility Ideographs. - (current >= 0xFE30 && current <= 0xFE4F) || // CJK Compatibility Forms. - (current >= 0xFF65 && current <= 0xFF9F) || // Halfwidth forms of katakana - (current >= 0xFFA0 && current <= 0xFFDC) || // Halfwidth forms of compatibility jamo characters for Hangul - (current >= 0x20000 && current <= 0x2FA1F) || // CJK Unified Ideographs Extension B ~ F and CJK Compatibility Ideographs Supplement. - (current >= 0x30000 && current <= 0x3134F); // CJK Unified Ideographs Extension G. + (current >= 0xAC00 && current <= 0xD7FF) || // Hangul Syllables and Hangul Jamo Extended-B. + (current >= 0xF900 && current <= 0xFAFF) || // CJK Compatibility Ideographs. + (current >= 0xFE30 && current <= 0xFE4F) || // CJK Compatibility Forms. + (current >= 0xFF65 && current <= 0xFF9F) || // Halfwidth forms of katakana + (current >= 0xFFA0 && current <= 0xFFDC) || // Halfwidth forms of compatibility jamo characters for Hangul + (current >= 0x20000 && current <= 0x2FA1F) || // CJK Unified Ideographs Extension B ~ F and CJK Compatibility Ideographs Supplement. + (current >= 0x30000 && current <= 0x3134F); // CJK Unified Ideographs Extension G. bool insert_newline = false; real_t char_width = 0; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 38545d094d2..7cdcbaea574 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -420,13 +420,13 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & // For info about the unicode range, see Label::regenerate_word_cache. const CharType current = c[end]; const bool separatable = (current >= 0x2E08 && current <= 0x9FFF) || // CJK scripts and symbols. - (current >= 0xAC00 && current <= 0xD7FF) || // Hangul Syllables and Hangul Jamo Extended-B. - (current >= 0xF900 && current <= 0xFAFF) || // CJK Compatibility Ideographs. - (current >= 0xFE30 && current <= 0xFE4F) || // CJK Compatibility Forms. - (current >= 0xFF65 && current <= 0xFF9F) || // Halfwidth forms of katakana - (current >= 0xFFA0 && current <= 0xFFDC) || // Halfwidth forms of compatibility jamo characters for Hangul - (current >= 0x20000 && current <= 0x2FA1F) || // CJK Unified Ideographs Extension B ~ F and CJK Compatibility Ideographs Supplement. - (current >= 0x30000 && current <= 0x3134F); // CJK Unified Ideographs Extension G. + (current >= 0xAC00 && current <= 0xD7FF) || // Hangul Syllables and Hangul Jamo Extended-B. + (current >= 0xF900 && current <= 0xFAFF) || // CJK Compatibility Ideographs. + (current >= 0xFE30 && current <= 0xFE4F) || // CJK Compatibility Forms. + (current >= 0xFF65 && current <= 0xFF9F) || // Halfwidth forms of katakana + (current >= 0xFFA0 && current <= 0xFFDC) || // Halfwidth forms of compatibility jamo characters for Hangul + (current >= 0x20000 && current <= 0x2FA1F) || // CJK Unified Ideographs Extension B ~ F and CJK Compatibility Ideographs Supplement. + (current >= 0x30000 && current <= 0x3134F); // CJK Unified Ideographs Extension G. const bool long_separatable = separatable && (wofs - backtrack + w + cw > p_width); const bool separation_changed = end > 0 && was_separatable != separatable; if (!just_breaked_in_middle && (long_separatable || separation_changed)) { @@ -501,8 +501,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & fx_color.a = faded_visibility; } - bool visible = visible_characters < 0 || ((p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - line_descent - line_ascent, line_ascent + line_descent)) && - faded_visibility > 0.0f); + bool visible = visible_characters < 0 || ((p_char_count < visible_characters && YRANGE_VISIBLE(y + lh - line_descent - line_ascent, line_ascent + line_descent)) && faded_visibility > 0.0f); const bool previously_visible = visible; @@ -548,7 +547,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & Math::lerp(Math::cos(previous_offset), Math::cos(current_offset), n_time)) * - (float)item_shake->strength / 10.0f; + (float)item_shake->strength / 10.0f; } else if (item_fx->type == ITEM_WAVE) { ItemWave *item_wave = static_cast(item_fx); diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 23ceb89d1dc..720bf32ec78 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -241,12 +241,12 @@ private: uint64_t offset_random(int index) { return (_current_rng >> (index % 64)) | - (_current_rng << (64 - (index % 64))); + (_current_rng << (64 - (index % 64))); } uint64_t offset_previous_random(int index) { return (_previous_rng >> (index % 64)) | - (_previous_rng << (64 - (index % 64))); + (_previous_rng << (64 - (index % 64))); } }; diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index c26311f0fca..2cafd4d83f6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -70,18 +70,18 @@ static bool _is_hex_symbol(CharType c) { static bool _is_pair_right_symbol(CharType c) { return c == '"' || - c == '\'' || - c == ')' || - c == ']' || - c == '}'; + c == '\'' || + c == ')' || + c == ']' || + c == '}'; } static bool _is_pair_left_symbol(CharType c) { return c == '"' || - c == '\'' || - c == '(' || - c == '[' || - c == '{'; + c == '\'' || + c == '(' || + c == '[' || + c == '{'; } static bool _is_pair_symbol(CharType c) { diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f1491b67525..3cc35ef094f 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1625,10 +1625,10 @@ void Viewport::_gui_call_input(Control *p_control, const Ref &p_inpu Ref mb = p_input; bool cant_stop_me_now = (mb.is_valid() && - (mb->get_button_index() == BUTTON_WHEEL_DOWN || - mb->get_button_index() == BUTTON_WHEEL_UP || - mb->get_button_index() == BUTTON_WHEEL_LEFT || - mb->get_button_index() == BUTTON_WHEEL_RIGHT)); + (mb->get_button_index() == BUTTON_WHEEL_DOWN || + mb->get_button_index() == BUTTON_WHEEL_UP || + mb->get_button_index() == BUTTON_WHEEL_LEFT || + mb->get_button_index() == BUTTON_WHEEL_RIGHT)); Ref pn = p_input; cant_stop_me_now = pn.is_valid() || cant_stop_me_now; diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index df6a3a88871..d32331e8cbb 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1526,10 +1526,11 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a float t2 = t * t; float t3 = t2 * t; - return 0.5f * ((p1 * 2.0f) + - (-p0 + p2) * t + - (2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 + - (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3); + return 0.5f * + ((p1 * 2.0f) + + (-p0 + p2) * t + + (2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 + + (-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3); } else if ((vformat & (vformat - 1))) { return p_a; //can't interpolate, mix of types diff --git a/servers/physics/body_pair_sw.cpp b/servers/physics/body_pair_sw.cpp index 1a8cf3f2829..c331b77ed39 100644 --- a/servers/physics/body_pair_sw.cpp +++ b/servers/physics/body_pair_sw.cpp @@ -437,8 +437,7 @@ void BodyPairSW::solve(real_t p_step) { Vector3 temp1 = A->get_inv_inertia_tensor().xform(c.rA.cross(tv)); Vector3 temp2 = B->get_inv_inertia_tensor().xform(c.rB.cross(tv)); - real_t t = -tvl / - (A->get_inv_mass() + B->get_inv_mass() + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB))); + real_t t = -tvl / (A->get_inv_mass() + B->get_inv_mass() + tv.dot(temp1.cross(c.rA) + temp2.cross(c.rB))); Vector3 jt = t * tv; diff --git a/servers/physics/joints/cone_twist_joint_sw.cpp b/servers/physics/joints/cone_twist_joint_sw.cpp index d6cc48eb8f9..f6a1a44a4c2 100644 --- a/servers/physics/joints/cone_twist_joint_sw.cpp +++ b/servers/physics/joints/cone_twist_joint_sw.cpp @@ -138,16 +138,18 @@ bool ConeTwistJointSW::setup(real_t p_timestep) { plane_space(normal[0], normal[1], normal[2]); for (int i = 0; i < 3; i++) { - memnew_placement(&m_jac[i], JacobianEntrySW( - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - pivotAInW - A->get_transform().origin - A->get_center_of_mass(), - pivotBInW - B->get_transform().origin - B->get_center_of_mass(), - normal[i], - A->get_inv_inertia(), - A->get_inv_mass(), - B->get_inv_inertia(), - B->get_inv_mass())); + memnew_placement( + &m_jac[i], + JacobianEntrySW( + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + pivotAInW - A->get_transform().origin - A->get_center_of_mass(), + pivotBInW - B->get_transform().origin - B->get_center_of_mass(), + normal[i], + A->get_inv_inertia(), + A->get_inv_mass(), + B->get_inv_inertia(), + B->get_inv_mass())); } } @@ -201,8 +203,7 @@ bool ConeTwistJointSW::setup(real_t p_timestep) { real_t swingAxisSign = (b2Axis1.dot(b1Axis1) >= 0.0f) ? 1.0f : -1.0f; m_swingAxis *= swingAxisSign; - m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) + - B->compute_angular_impulse_denominator(m_swingAxis)); + m_kSwing = real_t(1.) / (A->compute_angular_impulse_denominator(m_swingAxis) + B->compute_angular_impulse_denominator(m_swingAxis)); } // Twist limits @@ -221,8 +222,7 @@ bool ConeTwistJointSW::setup(real_t p_timestep) { m_twistAxis.normalize(); m_twistAxis *= -1.0f; - m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + - B->compute_angular_impulse_denominator(m_twistAxis)); + m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis)); } else if (twist > m_twistSpan * lockedFreeFactor) { m_twistCorrection = (twist - m_twistSpan); @@ -231,8 +231,7 @@ bool ConeTwistJointSW::setup(real_t p_timestep) { m_twistAxis = (b2Axis1 + b1Axis1) * 0.5f; m_twistAxis.normalize(); - m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + - B->compute_angular_impulse_denominator(m_twistAxis)); + m_kTwist = real_t(1.) / (A->compute_angular_impulse_denominator(m_twistAxis) + B->compute_angular_impulse_denominator(m_twistAxis)); } } diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index f4308183b19..342e2b75a6a 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -272,25 +272,30 @@ void Generic6DOFJointSW::calculateTransforms() { void Generic6DOFJointSW::buildLinearJacobian( JacobianEntrySW &jacLinear, const Vector3 &normalWorld, const Vector3 &pivotAInW, const Vector3 &pivotBInW) { - memnew_placement(&jacLinear, JacobianEntrySW( - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - pivotAInW - A->get_transform().origin - A->get_center_of_mass(), - pivotBInW - B->get_transform().origin - B->get_center_of_mass(), - normalWorld, - A->get_inv_inertia(), - A->get_inv_mass(), - B->get_inv_inertia(), - B->get_inv_mass())); + memnew_placement( + &jacLinear, + JacobianEntrySW( + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + pivotAInW - A->get_transform().origin - A->get_center_of_mass(), + pivotBInW - B->get_transform().origin - B->get_center_of_mass(), + normalWorld, + A->get_inv_inertia(), + A->get_inv_mass(), + B->get_inv_inertia(), + B->get_inv_mass())); } void Generic6DOFJointSW::buildAngularJacobian( JacobianEntrySW &jacAngular, const Vector3 &jointAxisW) { - memnew_placement(&jacAngular, JacobianEntrySW(jointAxisW, - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_inv_inertia(), - B->get_inv_inertia())); + memnew_placement( + &jacAngular, + JacobianEntrySW( + jointAxisW, + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_inv_inertia(), + B->get_inv_inertia())); } bool Generic6DOFJointSW::testAngularLimitMotor(int axis_index) { diff --git a/servers/physics/joints/hinge_joint_sw.cpp b/servers/physics/joints/hinge_joint_sw.cpp index 3653c038f6f..334e4481e3b 100644 --- a/servers/physics/joints/hinge_joint_sw.cpp +++ b/servers/physics/joints/hinge_joint_sw.cpp @@ -176,16 +176,18 @@ bool HingeJointSW::setup(real_t p_step) { plane_space(normal[0], normal[1], normal[2]); for (int i = 0; i < 3; i++) { - memnew_placement(&m_jac[i], JacobianEntrySW( - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - pivotAInW - A->get_transform().origin - A->get_center_of_mass(), - pivotBInW - B->get_transform().origin - B->get_center_of_mass(), - normal[i], - A->get_inv_inertia(), - A->get_inv_mass(), - B->get_inv_inertia(), - B->get_inv_mass())); + memnew_placement( + &m_jac[i], + JacobianEntrySW( + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + pivotAInW - A->get_transform().origin - A->get_center_of_mass(), + pivotBInW - B->get_transform().origin - B->get_center_of_mass(), + normal[i], + A->get_inv_inertia(), + A->get_inv_mass(), + B->get_inv_inertia(), + B->get_inv_mass())); } } @@ -202,23 +204,32 @@ bool HingeJointSW::setup(real_t p_step) { Vector3 jointAxis1 = A->get_transform().basis.xform(jointAxis1local); Vector3 hingeAxisWorld = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2)); - memnew_placement(&m_jacAng[0], JacobianEntrySW(jointAxis0, - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_inv_inertia(), - B->get_inv_inertia())); + memnew_placement( + &m_jacAng[0], + JacobianEntrySW( + jointAxis0, + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_inv_inertia(), + B->get_inv_inertia())); - memnew_placement(&m_jacAng[1], JacobianEntrySW(jointAxis1, - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_inv_inertia(), - B->get_inv_inertia())); + memnew_placement( + &m_jacAng[1], + JacobianEntrySW( + jointAxis1, + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_inv_inertia(), + B->get_inv_inertia())); - memnew_placement(&m_jacAng[2], JacobianEntrySW(hingeAxisWorld, - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_inv_inertia(), - B->get_inv_inertia())); + memnew_placement( + &m_jacAng[2], + JacobianEntrySW( + hingeAxisWorld, + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_inv_inertia(), + B->get_inv_inertia())); // Compute limit information real_t hingeAngle = get_hinge_angle(); @@ -247,8 +258,7 @@ bool HingeJointSW::setup(real_t p_step) { //Compute K = J*W*J' for hinge axis Vector3 axisA = A->get_transform().basis.xform(m_rbAFrame.basis.get_axis(2)); - m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) + - B->compute_angular_impulse_denominator(axisA)); + m_kHinge = 1.0f / (A->compute_angular_impulse_denominator(axisA) + B->compute_angular_impulse_denominator(axisA)); return true; } @@ -307,7 +317,7 @@ void HingeJointSW::solve(real_t p_step) { if (len > real_t(0.00001)) { Vector3 normal = velrelOrthog.normalized(); real_t denom = A->compute_angular_impulse_denominator(normal) + - B->compute_angular_impulse_denominator(normal); + B->compute_angular_impulse_denominator(normal); // scale for mass and relaxation velrelOrthog *= (real_t(1.) / denom) * m_relaxationFactor; } @@ -318,7 +328,7 @@ void HingeJointSW::solve(real_t p_step) { if (len2 > real_t(0.00001)) { Vector3 normal2 = angularError.normalized(); real_t denom2 = A->compute_angular_impulse_denominator(normal2) + - B->compute_angular_impulse_denominator(normal2); + B->compute_angular_impulse_denominator(normal2); angularError *= (real_t(1.) / denom2) * relaxation; } diff --git a/servers/physics/joints/pin_joint_sw.cpp b/servers/physics/joints/pin_joint_sw.cpp index 696557049cd..8629eb268ea 100644 --- a/servers/physics/joints/pin_joint_sw.cpp +++ b/servers/physics/joints/pin_joint_sw.cpp @@ -60,16 +60,18 @@ bool PinJointSW::setup(real_t p_step) { for (int i = 0; i < 3; i++) { normal[i] = 1; - memnew_placement(&m_jac[i], JacobianEntrySW( - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(), - B->get_transform().xform(m_pivotInB) - B->get_transform().origin - B->get_center_of_mass(), - normal, - A->get_inv_inertia(), - A->get_inv_mass(), - B->get_inv_inertia(), - B->get_inv_mass())); + memnew_placement( + &m_jac[i], + JacobianEntrySW( + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_transform().xform(m_pivotInA) - A->get_transform().origin - A->get_center_of_mass(), + B->get_transform().xform(m_pivotInB) - B->get_transform().origin - B->get_center_of_mass(), + normal, + A->get_inv_inertia(), + A->get_inv_mass(), + B->get_inv_inertia(), + B->get_inv_mass())); normal[i] = 0; } @@ -82,9 +84,6 @@ void PinJointSW::solve(real_t p_step) { Vector3 normal(0, 0, 0); - //Vector3 angvelA = A->get_transform().origin.getBasis().transpose() * A->getAngularVelocity(); - //Vector3 angvelB = B->get_transform().origin.getBasis().transpose() * B->getAngularVelocity(); - for (int i = 0; i < 3; i++) { normal[i] = 1; real_t jacDiagABInv = real_t(1.) / m_jac[i].getDiagonal(); @@ -100,12 +99,6 @@ void PinJointSW::solve(real_t p_step) { real_t rel_vel; rel_vel = normal.dot(vel); - /* - //velocity error (first order error) - real_t rel_vel = m_jac[i].getRelativeVelocity(A->getLinearVelocity(),angvelA, - B->getLinearVelocity(),angvelB); - */ - //positional error (zeroth order error) real_t depth = -(pivotAInW - pivotBInW).dot(normal); //this is the error projected on the normal diff --git a/servers/physics/joints/slider_joint_sw.cpp b/servers/physics/joints/slider_joint_sw.cpp index d4dc403f02f..bbdf569b3ac 100644 --- a/servers/physics/joints/slider_joint_sw.cpp +++ b/servers/physics/joints/slider_joint_sw.cpp @@ -147,16 +147,17 @@ bool SliderJointSW::setup(real_t p_step) { //linear part for (i = 0; i < 3; i++) { normalWorld = m_calculatedTransformA.basis.get_axis(i); - memnew_placement(&m_jacLin[i], JacobianEntrySW( - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - m_relPosA - A->get_center_of_mass(), - m_relPosB - B->get_center_of_mass(), - normalWorld, - A->get_inv_inertia(), - A->get_inv_mass(), - B->get_inv_inertia(), - B->get_inv_mass())); + memnew_placement( + &m_jacLin[i], + JacobianEntrySW( + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + m_relPosA - A->get_center_of_mass(), m_relPosB - B->get_center_of_mass(), + normalWorld, + A->get_inv_inertia(), + A->get_inv_mass(), + B->get_inv_inertia(), + B->get_inv_mass())); m_jacLinDiagABInv[i] = real_t(1.) / m_jacLin[i].getDiagonal(); m_depth[i] = m_delta.dot(normalWorld); } @@ -164,12 +165,14 @@ bool SliderJointSW::setup(real_t p_step) { // angular part for (i = 0; i < 3; i++) { normalWorld = m_calculatedTransformA.basis.get_axis(i); - memnew_placement(&m_jacAng[i], JacobianEntrySW( - normalWorld, - A->get_principal_inertia_axes().transposed(), - B->get_principal_inertia_axes().transposed(), - A->get_inv_inertia(), - B->get_inv_inertia())); + memnew_placement( + &m_jacAng[i], + JacobianEntrySW( + normalWorld, + A->get_principal_inertia_axes().transposed(), + B->get_principal_inertia_axes().transposed(), + A->get_inv_inertia(), + B->get_inv_inertia())); } testAngLimits(); Vector3 axisA = m_calculatedTransformA.basis.get_axis(0); diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 10cc8f0b64a..bee16577195 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -2511,16 +2511,16 @@ bool ShaderLanguage::is_scalar_type(DataType p_type) { bool ShaderLanguage::is_sampler_type(DataType p_type) { return p_type == TYPE_SAMPLER2D || - p_type == TYPE_ISAMPLER2D || - p_type == TYPE_USAMPLER2D || - p_type == TYPE_SAMPLER2DARRAY || - p_type == TYPE_ISAMPLER2DARRAY || - p_type == TYPE_USAMPLER2DARRAY || - p_type == TYPE_SAMPLER3D || - p_type == TYPE_ISAMPLER3D || - p_type == TYPE_USAMPLER3D || - p_type == TYPE_SAMPLERCUBE || - p_type == TYPE_SAMPLEREXT; + p_type == TYPE_ISAMPLER2D || + p_type == TYPE_USAMPLER2D || + p_type == TYPE_SAMPLER2DARRAY || + p_type == TYPE_ISAMPLER2DARRAY || + p_type == TYPE_USAMPLER2DARRAY || + p_type == TYPE_SAMPLER3D || + p_type == TYPE_ISAMPLER3D || + p_type == TYPE_USAMPLER3D || + p_type == TYPE_SAMPLERCUBE || + p_type == TYPE_SAMPLEREXT; } Variant ShaderLanguage::constant_value_to_variant(const Vector &p_value, DataType p_type, ShaderLanguage::ShaderNode::Uniform::Hint p_hint) { @@ -2654,16 +2654,16 @@ void ShaderLanguage::get_keyword_list(List *r_keywords) { bool ShaderLanguage::is_control_flow_keyword(String p_keyword) { return p_keyword == "break" || - p_keyword == "case" || - p_keyword == "continue" || - p_keyword == "default" || - p_keyword == "do" || - p_keyword == "else" || - p_keyword == "for" || - p_keyword == "if" || - p_keyword == "return" || - p_keyword == "switch" || - p_keyword == "while"; + p_keyword == "case" || + p_keyword == "continue" || + p_keyword == "default" || + p_keyword == "do" || + p_keyword == "else" || + p_keyword == "for" || + p_keyword == "if" || + p_keyword == "return" || + p_keyword == "switch" || + p_keyword == "while"; } void ShaderLanguage::get_builtin_funcs(List *r_keywords) {