1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

Remove ABS in favor of Math::abs

This commit is contained in:
kobewi
2022-11-30 17:56:32 +01:00
parent 3d9b05ad4a
commit 10f6c01b9c
68 changed files with 142 additions and 146 deletions

View File

@@ -2806,7 +2806,7 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
if (rect.has_point(p_pos)) {
if (const_cast<AnimationTrackEdit *>(this)->is_key_selectable_by_distance()) {
float distance = ABS(offset - p_pos.x);
float distance = Math::abs(offset - p_pos.x);
if (key_idx == -1 || distance < key_distance) {
key_idx = i;
key_distance = distance;
@@ -3211,7 +3211,7 @@ void AnimationTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
if (rect.has_point(pos)) {
if (is_key_selectable_by_distance()) {
const float distance = ABS(offset - pos.x);
const float distance = Math::abs(offset - pos.x);
if (key_idx == -1 || distance < key_distance) {
key_idx = i;
key_distance = distance;
@@ -3275,7 +3275,7 @@ bool AnimationTrackEdit::_try_select_at_ui_pos(const Point2 &p_pos, bool p_aggre
if (rect.has_point(p_pos)) {
if (is_key_selectable_by_distance()) {
float distance = ABS(offset - p_pos.x);
float distance = Math::abs(offset - p_pos.x);
if (key_idx == -1 || distance < key_distance) {
key_idx = i;
key_distance = distance;
@@ -6737,7 +6737,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
to_restore.push_back(amr);
}
#define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * ABS(s) + from_t
#define NEW_POS(m_ofs) (((s > 0) ? m_ofs : from_t + (len - (m_ofs - from_t))) - pivot) * Math::abs(s) + from_t
// 3 - Move the keys (re insert them).
for (RBMap<SelectedKey, KeyInfo>::Element *E = selection.back(); E; E = E->prev()) {
float newpos = NEW_POS(E->get().pos);
@@ -8675,7 +8675,7 @@ String AnimationMarkerEdit::get_tooltip(const Point2 &p_pos) const {
if (rect.has_point(p_pos)) {
if (const_cast<AnimationMarkerEdit *>(this)->is_key_selectable_by_distance()) {
float distance = ABS(offset - p_pos.x);
float distance = Math::abs(offset - p_pos.x);
if (key_idx == -1 || distance < key_distance) {
key_idx = i;
key_distance = distance;