diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-09 19:41:07 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-09 19:41:07 +0300 |
commit | 63916f5941b443dfc8566682bb75374e5abd553f (patch) | |
tree | fb0704701f1d4d9acbddf4a6fbc62c819d8d4c36 /source/blender/editors/sculpt_paint/sculpt_undo.c | |
parent | 0cff2c944f9c2cd3ac873fe826c4399fc2f32159 (diff) |
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index fd800ca2c18..287e1eb03d1 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -327,17 +327,14 @@ static bool sculpt_undo_restore_color(bContext *C, SculptUndoNode *unode) ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); SculptSession *ss = ob->sculpt; - MVert *mvert; - MPropCol *vcol; - int *index, i; if (unode->maxvert) { /* regular mesh restore */ - index = unode->index; - mvert = ss->mvert; - vcol = ss->vcol; + int *index = unode->index; + MVert *mvert = ss->mvert; + MPropCol *vcol = ss->vcol; - for (i = 0; i < unode->totvert; i++) { + for (int i = 0; i < unode->totvert; i++) { copy_v4_v4(vcol[index[i]].color, unode->col[i]); mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE; } @@ -927,16 +924,14 @@ SculptUndoNode *SCULPT_undo_get_first_node() static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, SculptUndoNode *unode) { PBVHNode *node = unode->node; - BLI_bitmap **grid_hidden; - int i, *grid_indices, totgrid; - - grid_hidden = BKE_pbvh_grid_hidden(pbvh); + BLI_bitmap **grid_hidden = BKE_pbvh_grid_hidden(pbvh); + int *grid_indices, totgrid; BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, NULL); unode->grid_hidden = MEM_callocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); - for (i = 0; i < totgrid; i++) { + for (int i = 0; i < totgrid; i++) { if (grid_hidden[grid_indices[i]]) { unode->grid_hidden[i] = MEM_dupallocN(grid_hidden[grid_indices[i]]); } @@ -1087,11 +1082,10 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode) MVert *mvert; const int *vert_indices; int allvert; - int i; BKE_pbvh_node_num_verts(pbvh, node, NULL, &allvert); BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert); - for (i = 0; i < allvert; i++) { + for (int i = 0; i < allvert; i++) { BLI_BITMAP_SET(unode->vert_hidden, i, mvert[vert_indices[i]].flag & ME_HIDE); } } |