Commit: 64e65442a1857033a9f139893eaff56b53cbd667 Author: Pablo Dobarro Date: Sat Feb 8 20:04:42 2020 +0100 Branches: master https://developer.blender.org/rB64e65442a1857033a9f139893eaff56b53cbd667
Cleanup: Sculpt/Paint, use correct types and iterator variable declaration Reviewed By: brecht Differential Revision: https://developer.blender.org/D6788 =================================================================== M source/blender/editors/sculpt_paint/paint_cursor.c M source/blender/editors/sculpt_paint/paint_hide.c M source/blender/editors/sculpt_paint/paint_image_2d.c M source/blender/editors/sculpt_paint/paint_image_proj.c M source/blender/editors/sculpt_paint/paint_mask.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_undo.c =================================================================== diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 906387fc63b..d5bb552b470 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1099,8 +1099,11 @@ static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush) return true; } -static void cursor_draw_point_screen_space( - const uint gpuattr, const ARegion *ar, float true_location[3], float obmat[4][4], int size) +static void cursor_draw_point_screen_space(const uint gpuattr, + const ARegion *ar, + const float true_location[3], + const float obmat[4][4], + const int size) { float translation_vertex_cursor[3], location[3]; copy_v3_v3(location, true_location); @@ -1118,11 +1121,11 @@ static void cursor_draw_tiling_preview(const uint gpuattr, const float true_location[3], Sculpt *sd, Object *ob, - float radius) + const float radius) { BoundBox *bb = BKE_object_boundbox_get(ob); float orgLoc[3], location[3]; - int dim, tile_pass = 0; + int tile_pass = 0; int start[3]; int end[3]; int cur[3]; @@ -1131,7 +1134,7 @@ static void cursor_draw_tiling_preview(const uint gpuattr, const float *step = sd->paint.tile_offset; copy_v3_v3(orgLoc, true_location); - for (dim = 0; dim < 3; dim++) { + for (int dim = 0; dim < 3; dim++) { if ((sd->paint.symmetry_flags & (PAINT_TILE_X << dim)) && step[dim] > 0) { start[dim] = (bbMin[dim] - orgLoc[dim] - radius) / step[dim]; end[dim] = (bbMax[dim] - orgLoc[dim] + radius) / step[dim]; @@ -1149,7 +1152,7 @@ static void cursor_draw_tiling_preview(const uint gpuattr, continue; } tile_pass++; - for (dim = 0; dim < 3; dim++) { + for (int dim = 0; dim < 3; dim++) { location[dim] = cur[dim] * step[dim] + orgLoc[dim]; } cursor_draw_point_screen_space(gpuattr, ar, location, ob->obmat, 3); @@ -1163,7 +1166,7 @@ static void cursor_draw_point_with_symmetry(const uint gpuattr, const float true_location[3], Sculpt *sd, Object *ob, - float radius) + const float radius) { const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL; float location[3], symm_rot_mat[4][4]; @@ -1223,7 +1226,7 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr, SculptSession static void sculpt_multiplane_scrape_preview_draw(const uint gpuattr, SculptSession *ss, const float outline_col[3], - float outline_alpha) + const float outline_alpha) { float local_mat_inv[4][4]; invert_m4_m4(local_mat_inv, ss->cache->stroke_local_mat); diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 624200734e8..aed9e47b972 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -68,7 +68,7 @@ static bool is_effected(PartialVisArea area, const float mask) { if (area == PARTIALVIS_ALL) { - return 1; + return true; } else if (area == PARTIALVIS_MASKED) { return mask > 0.5f; @@ -137,7 +137,7 @@ static void partialvis_update_grids(Depsgraph *depsgraph, { CCGElem **grids; BLI_bitmap **grid_hidden; - int *grid_indices, totgrid, i; + int *grid_indices, totgrid; bool any_changed = false, any_visible = false; /* Get PBVH data. */ @@ -147,9 +147,9 @@ static void partialvis_update_grids(Depsgraph *depsgraph, sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN); - for (i = 0; i < totgrid; i++) { + for (int i = 0; i < totgrid; i++) { int any_hidden = 0; - int g = grid_indices[i], x, y; + int g = grid_indices[i]; BLI_bitmap *gh = grid_hidden[g]; if (!gh) { @@ -172,8 +172,8 @@ static void partialvis_update_grids(Depsgraph *depsgraph, continue; } - for (y = 0; y < key.grid_size; y++) { - for (x = 0; x < key.grid_size; x++) { + for (int y = 0; y < key.grid_size; y++) { + for (int x = 0; x < key.grid_size; x++) { CCGElem *elem = CCG_grid_elem(&key, grids[g], x, y); const float *co = CCG_elem_co(&key, elem); float mask = key.has_mask ? *CCG_elem_mask(&key, elem) : 0.0f; @@ -349,7 +349,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) PBVHType pbvh_type; float clip_planes[4][4]; rcti rect; - int totnode, i; + int totnode; /* Read operator properties. */ action = RNA_enum_get(op->ptr, "action"); @@ -376,7 +376,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) break; } - for (i = 0; i < totnode; i++) { + for (int i = 0; i < totnode; i++) { switch (pbvh_type) { case PBVH_FACES: partialvis_update_mesh(ob, pbvh, nodes[i], action, area, clip_planes); diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index a667c7062e6..c5c2c524af9 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -446,9 +446,9 @@ static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter, float len = len_v2(xy_rot); float p = len / radius; if (hardness < 1.0f) { - p = (p - hardness) / (1 - hardness); + p = (p - hardness) / (1.0f - hardness); p = 1.0f - p; - CLAMP(p, 0, 1); + CLAMP(p, 0.0f, 1.0f); } else { p = 1.0; @@ -574,7 +574,7 @@ static void brush_painter_imbuf_update(BrushPainter *painter, /* get brush color */ if (brush->imagepaint_tool == PAINT_TOOL_DRAW) { paint_brush_color_get( - scene, brush, use_color_correction, cache->invert, 0.0, 1.0, brush_rgb, display); + scene, brush, use_color_correction, cache->invert, 0.0f, 1.0f, brush_rgb, display); } else { brush_rgb[0] = 1.0f; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 34cde8ff48c..bb7340b95b0 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -732,7 +732,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, tri_index = project_paint_PickFace(ps, pt, w); if (tri_index == -1) { - return 0; + return false; } lt = &ps->mlooptri_eval[tri_index]; @@ -807,7 +807,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, } } BKE_image_release_ibuf(ima, ibuf, NULL); - return 1; + return true; } /** @@ -1052,8 +1052,9 @@ static bool cmp_uv(const float vec2a[2], const float vec2b[2]) yb += 1.0f; } - return ((fabsf(xa - xb) < PROJ_GEOM_TOLERANCE) && (fabsf(ya - yb) < PROJ_GEOM_TOLERANCE)) ? 1 : - 0; + return ((fabsf(xa - xb) < PROJ_GEOM_TOLERANCE) && (fabsf(ya - yb) < PROJ_GEOM_TOLERANCE)) ? + true : + false; } #endif @@ -1084,7 +1085,7 @@ static bool pixel_bounds_uv(const float uv_quad[4][2], /*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/ /* face uses no UV area when quantized to pixels? */ - return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? 0 : 1; + return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? false : true; } #endif @@ -1095,7 +1096,7 @@ static bool pixel_bounds_array( float min_uv[2], max_uv[2]; if (tot == 0) { - return 0; + return false; } INIT_MINMAX2(min_uv, max_uv); @@ -1114,7 +1115,7 @@ static bool pixel_bounds_array( /*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/ /* face uses no UV area when quantized to pixels? */ - return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? 0 : 1; + return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? false : true; } #ifndef PROJ_DEBUG_NOSEAMBLEED @@ -1197,22 +1198,22 @@ static bool check_seam(const ProjPaintState *ps, * they are on the same side so edge is boundary */ if ((ps->faceWindingFlags[tri_index] & PROJ_FACE_WINDING_CW) != (ps->faceWindingFlags[orig_face] & PROJ_FACE_WINDING_CW)) { - return 1; + return true; } // printf("SEAM (NONE)\n"); - return 0; + return false; } else { // printf("SEAM (UV GAP)\n"); - return 1; + return true; } } } } // printf("SEAM (NO FACE)\n"); *other_face = -1; - return 1; + return true; } static VertSeam *find_adjacent_seam(const ProjPaintState *ps, @@ -2068,11 +2069,11 @@ static bool line_clip_rect2f(const rctf *cliprect, if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) { /* is the line out of range on its Y axis? */ if (l1[1] < rect->ymin || l1[1] > rect->ymax) { - return 0; + return false; } /* line is out of range on its X axis */ if ((l1[0] < rect->xmin && l2[0] < rect->xmin) || (l1[0] > rect->xmax && l2[0] > rect->xmax)) { - return 0; + return false; } /* this is a single point (or close to)*/ @@ -2080,10 +2081,10 @@ static bool line_clip_rect2f(const rctf *cliprect, if ( @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
