Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
committerJacques Lucke <jacques@blender.org>2020-09-09 19:41:07 +0300
commit63916f5941b443dfc8566682bb75374e5abd553f (patch)
treefb0704701f1d4d9acbddf4a6fbc62c819d8d4c36 /source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
parent0cff2c944f9c2cd3ac873fe826c4399fc2f32159 (diff)
Cleanup: reduce variable scope
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex_color_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index d05b1673c9a..b831687ca67 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -68,9 +68,6 @@ static void tag_object_after_update(Object *object)
static bool vertex_color_set(Object *ob, uint paintcol)
{
Mesh *me;
- const MPoly *mp;
- int i, j;
-
if (((me = BKE_mesh_from_object(ob)) == NULL) || (ED_mesh_color_ensure(me, NULL) == false)) {
return false;
}
@@ -78,15 +75,15 @@ static bool vertex_color_set(Object *ob, uint paintcol)
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
- mp = me->mpoly;
- for (i = 0; i < me->totpoly; i++, mp++) {
+ const MPoly *mp = me->mpoly;
+ for (int i = 0; i < me->totpoly; i++, mp++) {
MLoopCol *lcol = me->mloopcol + mp->loopstart;
if (use_face_sel && !(mp->flag & ME_FACE_SEL)) {
continue;
}
- j = 0;
+ int j = 0;
do {
uint vidx = me->mloop[mp->loopstart + j].v;
if (!(use_vert_sel && !(me->mvert[vidx].flag & SELECT))) {
@@ -211,7 +208,6 @@ static void vertex_color_smooth_looptag(Mesh *me, const bool *mlooptag)
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
const MPoly *mp;
int(*scol)[4];
- int i, j;
bool has_shared = false;
/* if no mloopcol: do not do */
@@ -223,11 +219,12 @@ static void vertex_color_smooth_looptag(Mesh *me, const bool *mlooptag)
scol = MEM_callocN(sizeof(int) * me->totvert * 5, "scol");
+ int i;
for (i = 0, mp = me->mpoly; i < me->totpoly; i++, mp++) {
if ((use_face_sel == false) || (mp->flag & ME_FACE_SEL)) {
const MLoop *ml = me->mloop + mp->loopstart;
MLoopCol *lcol = me->mloopcol + mp->loopstart;
- for (j = 0; j < mp->totloop; j++, ml++, lcol++) {
+ for (int j = 0; j < mp->totloop; j++, ml++, lcol++) {
scol[ml->v][0] += lcol->r;
scol[ml->v][1] += lcol->g;
scol[ml->v][2] += lcol->b;
@@ -250,7 +247,7 @@ static void vertex_color_smooth_looptag(Mesh *me, const bool *mlooptag)
if ((use_face_sel == false) || (mp->flag & ME_FACE_SEL)) {
const MLoop *ml = me->mloop + mp->loopstart;
MLoopCol *lcol = me->mloopcol + mp->loopstart;
- for (j = 0; j < mp->totloop; j++, ml++, lcol++) {
+ for (int j = 0; j < mp->totloop; j++, ml++, lcol++) {
if (mlooptag[mp->loopstart + j]) {
lcol->r = scol[ml->v][0];
lcol->g = scol[ml->v][1];