From a03bf7e05579b6c433ee8fb37449ea29ca393d01 Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Thu, 25 Apr 2024 02:31:27 +0200 Subject: [PATCH] Refactor: Invert return value of array_utils::indexed_data_equal This PR inverts the return values of `indexed_data_equal` to make the function return as one would expect (i.e. if everything is equal then it returns true, if any are not equal it returns false) Pull Request: https://projects.blender.org/blender/blender/pulls/121056 --- source/blender/blenlib/BLI_array_utils.hh | 4 ++-- source/blender/editors/sculpt_paint/paint_hide.cc | 2 +- source/blender/editors/sculpt_paint/sculpt_face_set.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/blenlib/BLI_array_utils.hh b/source/blender/blenlib/BLI_array_utils.hh index efb8227b692..2a936cca04e 100644 --- a/source/blender/blenlib/BLI_array_utils.hh +++ b/source/blender/blenlib/BLI_array_utils.hh @@ -300,10 +300,10 @@ bool indexed_data_equal(const Span all_values, const Span indices, const { for (const int i : indices.index_range()) { if (all_values[indices[i]] != values[i]) { - return true; + return false; } } - return false; + return true; } bool indices_are_range(Span indices, IndexRange range); diff --git a/source/blender/editors/sculpt_paint/paint_hide.cc b/source/blender/editors/sculpt_paint/paint_hide.cc index 56453bbf401..bbff2891670 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.cc +++ b/source/blender/editors/sculpt_paint/paint_hide.cc @@ -216,7 +216,7 @@ static void vert_hide_update(Object &object, new_hide.reinitialize(verts.size()); array_utils::gather(hide_vert.span.as_span(), verts, new_hide.as_mutable_span()); calc_hide(verts, new_hide); - if (!array_utils::indexed_data_equal(hide_vert.span, verts, new_hide)) { + if (array_utils::indexed_data_equal(hide_vert.span, verts, new_hide)) { continue; } diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index a498886e21e..a42126b949e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -517,7 +517,7 @@ static void face_sets_update(Object &object, MutableSpan new_face_sets = tls.new_face_sets; array_utils::gather(face_sets.span.as_span(), faces, new_face_sets); calc_face_sets(faces, new_face_sets); - if (!array_utils::indexed_data_equal(face_sets.span, faces, new_face_sets)) { + if (array_utils::indexed_data_equal(face_sets.span, faces, new_face_sets)) { continue; } @@ -1021,7 +1021,7 @@ static void face_hide_update(Object &object, MutableSpan new_hide = tls.new_hide; array_utils::gather(hide_poly.span.as_span(), faces, new_hide); calc_hide(faces, new_hide); - if (!array_utils::indexed_data_equal(hide_poly.span, faces, new_hide)) { + if (array_utils::indexed_data_equal(hide_poly.span, faces, new_hide)) { continue; }