diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 32 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 20 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 2 |
3 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 1616b3026bd..dd07da6a16f 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -133,7 +133,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) int size; int j; int refresh; - int format = col? GL_RGBA : GL_ALPHA; + GLenum format = col ? GL_RGBA : GL_ALPHA; if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0; @@ -151,7 +151,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) if (refresh) { struct ImagePool *pool = NULL; /* stencil is rotated later */ - const float rotation = (br->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL)? + const float rotation = (br->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL) ? -br->mtex.rot : 0; float radius = BKE_brush_size_get(vc->scene, br) * zoom; @@ -257,10 +257,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) if (br->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) mul_v4_fl(rgba, BKE_brush_curve_strength(br, len, 1)); /* Falloff curve */ - buffer[index*4] = rgba[0]*255; - buffer[index*4 + 1] = rgba[1]*255; - buffer[index*4 + 2] = rgba[2]*255; - buffer[index*4 + 3] = rgba[3]*255; + buffer[index * 4] = rgba[0] * 255; + buffer[index * 4 + 1] = rgba[1] * 255; + buffer[index * 4 + 2] = rgba[2] * 255; + buffer[index * 4 + 3] = rgba[3] * 255; } else { float avg = br->mtex.tex ? paint_get_tex_pixel(&br->mtex, x, y, pool) : 1; @@ -275,13 +275,14 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col) } else { if (col) { - buffer[index*4] = 0; - buffer[index*4 + 1] = 0; - buffer[index*4 + 2] = 0; - buffer[index*4 + 3] = 0; + buffer[index * 4] = 0; + buffer[index * 4 + 1] = 0; + buffer[index * 4 + 2] = 0; + buffer[index * 4 + 3] = 0; } - else + else { buffer[index] = 0; + } } } } @@ -424,14 +425,13 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, /* check for overlay mode */ if (brush->mtex.brush_map_mode != MTEX_MAP_MODE_STENCIL && - (!(brush->flag & BRUSH_TEXTURE_OVERLAY) || + (!(brush->flag & BRUSH_TEXTURE_OVERLAY) || !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED))) { return; } - col = ELEM3(mode, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D, PAINT_VERTEX)? - true: false; + col = ELEM3(mode, PAINT_TEXTURE_PROJECTIVE, PAINT_TEXTURE_2D, PAINT_VERTEX) ? true: false; /* save lots of GL state * TODO: check on whether all of these are needed? */ glPushAttrib(GL_COLOR_BUFFER_BIT | @@ -485,7 +485,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, quad.ymax = y + radius; } } - else if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED){ + else if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) { quad.xmin = 0; quad.ymin = 0; quad.xmax = BLI_rcti_size_x(&vc->ar->winrct); @@ -500,7 +500,7 @@ static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, glMatrixMode(GL_MODELVIEW); glPushMatrix(); glTranslatef(brush->stencil_pos[0], brush->stencil_pos[1], 0); - glRotatef(brush->mtex.rot/M_PI*180, 0, 0, 1); + glRotatef(RAD2DEGF(brush->mtex.rot), 0, 0, 1); glMatrixMode(GL_TEXTURE); } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 7ea11cc464a..a63d147e459 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -476,7 +476,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev copy_v2_v2_int(scd->init_sdim, br->stencil_dimension); copy_v2_v2_int(scd->init_spos, br->stencil_pos); sub_v2_v2v2_int(mdiff, event->mval, br->stencil_pos); - scd->lenorig = sqrtf(mdiff[0]*mdiff[0] + mdiff[1]*mdiff[1]); + scd->lenorig = sqrtf(mdiff[0] * mdiff[0] + mdiff[1] * mdiff[1]); scd->br = br; scd->init_rot = br->mtex.rot; scd->init_angle = atan2(mdiff[1], mdiff[0]); @@ -519,10 +519,10 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve { float len, factor; sub_v2_v2v2_int(mdiff, event->mval, scd->br->stencil_pos); - len = sqrtf(mdiff[0]*mdiff[0] + mdiff[1]*mdiff[1]); + len = sqrtf(mdiff[0] * mdiff[0] + mdiff[1] * mdiff[1]); factor = len/scd->lenorig; - mdiff[0] = factor*scd->init_sdim[0]; - mdiff[1] = factor*scd->init_sdim[1]; + mdiff[0] = factor * scd->init_sdim[0]; + mdiff[1] = factor * scd->init_sdim[1]; copy_v2_v2_int(scd->br->stencil_dimension, mdiff); break; } @@ -532,10 +532,10 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve sub_v2_v2v2_int(mdiff, event->mval, scd->br->stencil_pos); angle = atan2(mdiff[1], mdiff[0]); angle = scd->init_rot + angle - scd->init_angle; - if (angle < 0) - angle += 2*M_PI; - if (angle > 2*M_PI) - angle -= 2*M_PI; + if (angle < 0.0f) + angle += (float)(2 * M_PI); + if (angle > (float)(2 * M_PI)) + angle -= (float)(2 * M_PI); scd->br->mtex.rot = angle; break; } @@ -543,12 +543,12 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve } break; case LEFTMOUSE: - if(event->val == KM_PRESS) { + if (event->val == KM_PRESS) { MEM_freeN(op->customdata); return OPERATOR_FINISHED; } case RIGHTMOUSE: - if(event->val == KM_PRESS) { + if (event->val == KM_PRESS) { return stencil_control_cancel(C, op); } default: diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 061f073b287..2eca3f94e95 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -883,7 +883,7 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co } factor = rgba[3]; } - return factor*BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); + return factor * BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); } } if (rgba) |