Cleanup: Move constant variable declarations outside of loop

This commit is contained in:
Hans Goudey
2023-12-01 12:37:29 -05:00
parent f2ed2b82ce
commit aae0b71342

View File

@@ -223,6 +223,11 @@ static void partialvis_update_grids(Depsgraph *depsgraph,
const float planes[4][4],
const Span<PBVHNode *> nodes)
{
SculptSession *ss = ob->sculpt;
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
MutableSpan<BLI_bitmap *> grid_hidden = subdiv_ccg->grid_hidden;
const CCGKey key = *BKE_pbvh_get_grid_key(pbvh);
for (PBVHNode *node : nodes) {
CCGElem *const *grids;
const int *grid_indices;
@@ -232,11 +237,6 @@ static void partialvis_update_grids(Depsgraph *depsgraph,
/* Get PBVH data. */
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, nullptr, nullptr, &grids);
SculptSession *ss = ob->sculpt;
SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
MutableSpan<BLI_bitmap *> grid_hidden = subdiv_ccg->grid_hidden;
const CCGKey key = *BKE_pbvh_get_grid_key(pbvh);
SCULPT_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
for (int i = 0; i < totgrid; i++) {
@@ -354,12 +354,11 @@ static void partialvis_update_bmesh(Object *ob,
const float planes[4][4],
const Span<PBVHNode *> nodes)
{
BMesh *bm = BKE_pbvh_get_bmesh(pbvh);
for (PBVHNode *node : nodes) {
bool any_changed = false;
bool any_visible = false;
BMesh *bm = BKE_pbvh_get_bmesh(pbvh);
SCULPT_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
partialvis_update_bmesh_verts(bm,