From 5c73a543fa26d176c47b215b4b5e85e63f7576bc Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 25 Apr 2024 13:18:44 -0400 Subject: [PATCH] Cleanup: Use const argument to sculpt accessor functions --- source/blender/editors/sculpt_paint/sculpt.cc | 22 ++++++++++++---------- .../blender/editors/sculpt_paint/sculpt_intern.hh | 12 ++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index eca841d4f91..01be621ca98 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -379,7 +379,7 @@ namespace blender::ed::sculpt_paint { namespace face_set { -int active_face_set_get(SculptSession *ss) +int active_face_set_get(const SculptSession *ss) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: @@ -429,7 +429,7 @@ bool vert_visible_get(const SculptSession *ss, PBVHVertRef vertex) return true; } -bool vert_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex) +bool vert_any_face_visible_get(const SculptSession *ss, PBVHVertRef vertex) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { @@ -506,7 +506,7 @@ bool vert_all_faces_visible_get(const SculptSession *ss, PBVHVertRef vertex) namespace face_set { -int vert_face_set_get(SculptSession *ss, PBVHVertRef vertex) +int vert_face_set_get(const SculptSession *ss, PBVHVertRef vertex) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { @@ -536,7 +536,7 @@ int vert_face_set_get(SculptSession *ss, PBVHVertRef vertex) return 0; } -bool vert_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_set) +bool vert_has_face_set(const SculptSession *ss, PBVHVertRef vertex, int face_set) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { @@ -565,7 +565,7 @@ bool vert_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_set) return true; } -static bool sculpt_check_unique_face_set_in_base_mesh(SculptSession *ss, int index) +static bool sculpt_check_unique_face_set_in_base_mesh(const SculptSession *ss, int index) { if (!ss->face_sets) { return true; @@ -588,7 +588,9 @@ static bool sculpt_check_unique_face_set_in_base_mesh(SculptSession *ss, int ind * Checks if the face sets of the adjacent faces to the edge between \a v1 and \a v2 * in the base mesh are equal. */ -static bool sculpt_check_unique_face_set_for_edge_in_base_mesh(SculptSession *ss, int v1, int v2) +static bool sculpt_check_unique_face_set_for_edge_in_base_mesh(const SculptSession *ss, + int v1, + int v2) { const Span vert_map = ss->vert_to_face_map[v1]; int p1 = -1, p2 = -1; @@ -615,7 +617,7 @@ static bool sculpt_check_unique_face_set_for_edge_in_base_mesh(SculptSession *ss return true; } -bool vert_has_unique_face_set(SculptSession *ss, PBVHVertRef vertex) +bool vert_has_unique_face_set(const SculptSession *ss, PBVHVertRef vertex) { switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { @@ -718,7 +720,7 @@ static void sculpt_vertex_neighbors_get_bmesh(PBVHVertRef vertex, SculptVertexNe } } -static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, +static void sculpt_vertex_neighbors_get_faces(const SculptSession *ss, PBVHVertRef vertex, SculptVertexNeighborIter *iter) { @@ -753,7 +755,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, } } -static void sculpt_vertex_neighbors_get_grids(SculptSession *ss, +static void sculpt_vertex_neighbors_get_grids(const SculptSession *ss, const PBVHVertRef vertex, const bool include_duplicates, SculptVertexNeighborIter *iter) @@ -797,7 +799,7 @@ static void sculpt_vertex_neighbors_get_grids(SculptSession *ss, } // namespace blender::ed::sculpt_paint -void SCULPT_vertex_neighbors_get(SculptSession *ss, +void SCULPT_vertex_neighbors_get(const SculptSession *ss, const PBVHVertRef vertex, const bool include_duplicates, SculptVertexNeighborIter *iter) diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.hh b/source/blender/editors/sculpt_paint/sculpt_intern.hh index 28caa7658f3..3b853f02630 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_intern.hh @@ -884,7 +884,7 @@ float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss, int deform_target, PBVHVertexIter *iter); -void SCULPT_vertex_neighbors_get(SculptSession *ss, +void SCULPT_vertex_neighbors_get(const SculptSession *ss, PBVHVertRef vertex, bool include_duplicates, SculptVertexNeighborIter *iter); @@ -952,7 +952,7 @@ namespace hide { bool vert_visible_get(const SculptSession *ss, PBVHVertRef vertex); bool vert_all_faces_visible_get(const SculptSession *ss, PBVHVertRef vertex); -bool vert_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex); +bool vert_any_face_visible_get(const SculptSession *ss, PBVHVertRef vertex); } @@ -964,11 +964,11 @@ bool vert_any_face_visible_get(SculptSession *ss, PBVHVertRef vertex); namespace face_set { -int active_face_set_get(SculptSession *ss); -int vert_face_set_get(SculptSession *ss, PBVHVertRef vertex); +int active_face_set_get(const SculptSession *ss); +int vert_face_set_get(const SculptSession *ss, PBVHVertRef vertex); -bool vert_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_set); -bool vert_has_unique_face_set(SculptSession *ss, PBVHVertRef vertex); +bool vert_has_face_set(const SculptSession *ss, PBVHVertRef vertex, int face_set); +bool vert_has_unique_face_set(const SculptSession *ss, PBVHVertRef vertex); bke::SpanAttributeWriter ensure_face_sets_mesh(Object &object); int ensure_face_sets_bmesh(Object &object); -- 2.11.4.GIT