Cleanup: Editors/Sculpt/Paint, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/sculpt_paint` module.

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2020-07-03 16:09:51 +02:00
parent fd5b093f84
commit 2a39b34a09
16 changed files with 193 additions and 288 deletions

View File

@ -557,11 +557,9 @@ static int project_brush_radius(ViewContext *vc, float radius, const float locat
/* The distance between these points is the size of the projected brush in pixels. */
return len_v2v2(p1, p2);
}
else {
/* Assert because the code that sets up the vectors should disallow this. */
BLI_assert(0);
return 0;
}
/* Assert because the code that sets up the vectors should disallow this. */
BLI_assert(0);
return 0;
}
static bool sculpt_get_brush_geometry(bContext *C,

View File

@ -142,19 +142,15 @@ static char paintcurve_point_side_index(const BezTriple *bezt,
if ((bezt->f1 & SELECT) == (bezt->f3 & SELECT)) {
return is_first ? SEL_F1 : SEL_F3;
}
else if (bezt->f1 & SELECT) {
if (bezt->f1 & SELECT) {
return SEL_F1;
}
else if (bezt->f3 & SELECT) {
if (bezt->f3 & SELECT) {
return SEL_F3;
}
else {
return fallback;
}
}
else {
return 0;
return fallback;
}
return 0;
}
/******************* Operators *********************************/
@ -491,9 +487,7 @@ static int paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmE
RNA_int_set_array(op->ptr, "location", loc);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
static int paintcurve_select_point_exec(bContext *C, wmOperator *op)

View File

@ -70,13 +70,12 @@ static bool is_effected(PartialVisArea area,
if (area == PARTIALVIS_ALL) {
return true;
}
else if (area == PARTIALVIS_MASKED) {
if (area == PARTIALVIS_MASKED) {
return mask > 0.5f;
}
else {
bool inside = isect_point_planes_v3(planes, 4, co);
return ((inside && area == PARTIALVIS_INSIDE) || (!inside && area == PARTIALVIS_OUTSIDE));
}
bool inside = isect_point_planes_v3(planes, 4, co);
return ((inside && area == PARTIALVIS_INSIDE) || (!inside && area == PARTIALVIS_OUTSIDE));
}
static void partialvis_update_mesh(Object *ob,
@ -418,9 +417,7 @@ static int hide_show_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (!ELEM(area, PARTIALVIS_ALL, PARTIALVIS_MASKED)) {
return WM_gesture_box_invoke(C, op, event);
}
else {
return op->type->exec(C, op);
}
return op->type->exec(C, op);
}
void PAINT_OT_hide_show(struct wmOperatorType *ot)

View File

@ -557,12 +557,11 @@ static Image *project_paint_face_paint_image(const ProjPaintState *ps, int tri_i
if (ps->do_stencil_brush) {
return ps->stencil_ima;
}
else {
const MPoly *mp = ps_tri_index_to_mpoly(ps, tri_index);
Material *ma = ps->mat_array[mp->mat_nr];
TexPaintSlot *slot = ma ? ma->texpaintslot + ma->paint_active_slot : NULL;
return slot ? slot->ima : ps->canvas_ima;
}
const MPoly *mp = ps_tri_index_to_mpoly(ps, tri_index);
Material *ma = ps->mat_array[mp->mat_nr];
TexPaintSlot *slot = ma ? ma->texpaintslot + ma->paint_active_slot : NULL;
return slot ? slot->ima : ps->canvas_ima;
}
static TexPaintSlot *project_paint_face_clone_slot(const ProjPaintState *ps, int tri_index)
@ -605,9 +604,7 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj
if (bucket_index < 0 || bucket_index >= ps->buckets_x * ps->buckets_y) {
return -1;
}
else {
return bucket_index;
}
return bucket_index;
}
static float VecZDepthOrtho(
@ -840,18 +837,17 @@ static int project_paint_occlude_ptv(const float pt[3],
if (v1[2] < pt[2] && v2[2] < pt[2] && v3[2] < pt[2]) {
return 1;
}
else {
/* we intersect? - find the exact depth at the point of intersection */
/* Is this point is occluded by another face? */
if (is_ortho) {
if (VecZDepthOrtho(pt, v1, v2, v3, w) < pt[2]) {
return 2;
}
/* we intersect? - find the exact depth at the point of intersection */
/* Is this point is occluded by another face? */
if (is_ortho) {
if (VecZDepthOrtho(pt, v1, v2, v3, w) < pt[2]) {
return 2;
}
else {
if (VecZDepthPersp(pt, v1, v2, v3, w) < pt[2]) {
return 2;
}
}
else {
if (VecZDepthPersp(pt, v1, v2, v3, w) < pt[2]) {
return 2;
}
}
return -1;
@ -977,14 +973,12 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
*x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;
return ISECT_TRUE;
}
else if (p1[1] < y_level && p2[1] > y_level) {
if (p1[1] < y_level && p2[1] > y_level) {
/* (p2[1] - p1[1]); */
*x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;
return ISECT_TRUE;
}
else {
return 0;
}
return 0;
}
static int line_isect_x(const float p1[2], const float p2[2], const float x_level, float *y_isect)
@ -1014,14 +1008,12 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
*y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff;
return ISECT_TRUE;
}
else if (p1[0] < x_level && p2[0] > x_level) {
if (p1[0] < x_level && p2[0] > x_level) {
/* (p2[0] - p1[0]); */
*y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff;
return ISECT_TRUE;
}
else {
return 0;
}
return 0;
}
/* simple func use for comparing UV locations to check if there are seams.
@ -1204,10 +1196,8 @@ static bool check_seam(const ProjPaintState *ps,
// printf("SEAM (NONE)\n");
return false;
}
else {
// printf("SEAM (UV GAP)\n");
return true;
}
// printf("SEAM (UV GAP)\n");
return true;
}
}
}
@ -1788,7 +1778,7 @@ static float project_paint_uvpixel_mask(const ProjPaintState *ps,
/* outsize the normal limit*/
return 0.0f;
}
else if (angle_cos < ps->normal_angle_inner__cos) {
if (angle_cos < ps->normal_angle_inner__cos) {
mask *= (ps->normal_angle - acosf(angle_cos)) / ps->normal_angle_range;
} /* otherwise no mask normal is needed, we're within the limit */
}
@ -1805,9 +1795,7 @@ static int project_paint_pixel_sizeof(const short tool)
if ((tool == PAINT_TOOL_CLONE) || (tool == PAINT_TOOL_SMEAR)) {
return sizeof(ProjPixelClone);
}
else {
return sizeof(ProjPixel);
}
return sizeof(ProjPixel);
}
static int project_paint_undo_subtiles(const TileInfo *tinf, int tx, int ty)
@ -2083,9 +2071,7 @@ static bool line_clip_rect2f(const rctf *cliprect,
copy_v2_v2(l2_clip, l2);
return true;
}
else {
return false;
}
return false;
}
copy_v2_v2(l1_clip, l1);
@ -2094,7 +2080,7 @@ static bool line_clip_rect2f(const rctf *cliprect,
CLAMP(l2_clip[0], rect->xmin, rect->xmax);
return true;
}
else if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) {
if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) {
/* is the line out of range on its X axis? */
if (l1[0] < rect->xmin || l1[0] > rect->xmax) {
return 0;
@ -2112,9 +2098,7 @@ static bool line_clip_rect2f(const rctf *cliprect,
copy_v2_v2(l2_clip, l2);
return true;
}
else {
return false;
}
return false;
}
copy_v2_v2(l1_clip, l1);
@ -2123,106 +2107,103 @@ static bool line_clip_rect2f(const rctf *cliprect,
CLAMP(l2_clip[1], rect->ymin, rect->ymax);
return true;
}
else {
float isect;
short ok1 = 0;
short ok2 = 0;
/* Done with vertical lines */
float isect;
short ok1 = 0;
short ok2 = 0;
/* are either of the points inside the rectangle ? */
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
/* Done with vertical lines */
/* are either of the points inside the rectangle ? */
if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
ok1 = 1;
}
if (BLI_rctf_isect_pt_v(rect, l2)) {
copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
/* line inside rect */
if (ok1 && ok2) {
return 1;
}
/* top/bottom */
if (line_isect_y(l1, l2, rect->ymin, &isect) && (isect >= cliprect->xmin) &&
(isect <= cliprect->xmax)) {
if (l1[1] < l2[1]) { /* line 1 is outside */
l1_clip[0] = isect;
l1_clip[1] = rect->ymin;
ok1 = 1;
}
if (BLI_rctf_isect_pt_v(rect, l2)) {
copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
/* line inside rect */
if (ok1 && ok2) {
return 1;
}
/* top/bottom */
if (line_isect_y(l1, l2, rect->ymin, &isect) && (isect >= cliprect->xmin) &&
(isect <= cliprect->xmax)) {
if (l1[1] < l2[1]) { /* line 1 is outside */
l1_clip[0] = isect;
l1_clip[1] = rect->ymin;
ok1 = 1;
}
else {
l2_clip[0] = isect;
l2_clip[1] = rect->ymin;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
if (line_isect_y(l1, l2, rect->ymax, &isect) && (isect >= cliprect->xmin) &&
(isect <= cliprect->xmax)) {
if (l1[1] > l2[1]) { /* line 1 is outside */
l1_clip[0] = isect;
l1_clip[1] = rect->ymax;
ok1 = 1;
}
else {
l2_clip[0] = isect;
l2_clip[1] = rect->ymax;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
/* left/right */
if (line_isect_x(l1, l2, rect->xmin, &isect) && (isect >= cliprect->ymin) &&
(isect <= cliprect->ymax)) {
if (l1[0] < l2[0]) { /* line 1 is outside */
l1_clip[0] = rect->xmin;
l1_clip[1] = isect;
ok1 = 1;
}
else {
l2_clip[0] = rect->xmin;
l2_clip[1] = isect;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
if (line_isect_x(l1, l2, rect->xmax, &isect) && (isect >= cliprect->ymin) &&
(isect <= cliprect->ymax)) {
if (l1[0] > l2[0]) { /* line 1 is outside */
l1_clip[0] = rect->xmax;
l1_clip[1] = isect;
ok1 = 1;
}
else {
l2_clip[0] = rect->xmax;
l2_clip[1] = isect;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
else {
return false;
l2_clip[0] = isect;
l2_clip[1] = rect->ymin;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
if (line_isect_y(l1, l2, rect->ymax, &isect) && (isect >= cliprect->xmin) &&
(isect <= cliprect->xmax)) {
if (l1[1] > l2[1]) { /* line 1 is outside */
l1_clip[0] = isect;
l1_clip[1] = rect->ymax;
ok1 = 1;
}
else {
l2_clip[0] = isect;
l2_clip[1] = rect->ymax;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
/* left/right */
if (line_isect_x(l1, l2, rect->xmin, &isect) && (isect >= cliprect->ymin) &&
(isect <= cliprect->ymax)) {
if (l1[0] < l2[0]) { /* line 1 is outside */
l1_clip[0] = rect->xmin;
l1_clip[1] = isect;
ok1 = 1;
}
else {
l2_clip[0] = rect->xmin;
l2_clip[1] = isect;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
if (line_isect_x(l1, l2, rect->xmax, &isect) && (isect >= cliprect->ymin) &&
(isect <= cliprect->ymax)) {
if (l1[0] > l2[0]) { /* line 1 is outside */
l1_clip[0] = rect->xmax;
l1_clip[1] = isect;
ok1 = 1;
}
else {
l2_clip[0] = rect->xmax;
l2_clip[1] = isect;
ok2 = 2;
}
}
if (ok1 && ok2) {
return true;
}
return false;
}
/**
@ -2299,7 +2280,7 @@ static bool project_bucket_isect_circle(const float cent[2],
false;
}
/* top left test */
else if (cent[1] > bucket_bounds->ymax) {
if (cent[1] > bucket_bounds->ymax) {
return (len_squared_v2v2_alt(cent, bucket_bounds->xmin, bucket_bounds->ymax) <
radius_squared) ?
true :
@ -2315,7 +2296,7 @@ static bool project_bucket_isect_circle(const float cent[2],
false;
}
/* top right test */
else if (cent[1] > bucket_bounds->ymax) {
if (cent[1] > bucket_bounds->ymax) {
return (len_squared_v2v2_alt(cent, bucket_bounds->xmax, bucket_bounds->ymax) <
radius_squared) ?
true :
@ -2670,7 +2651,8 @@ static void project_bucket_clip_face(const bool is_ortho,
*tot = 4;
return;
}
else {
{
/* The Complicated Case!
*
* The 2 cases above are where the face is inside the bucket
@ -4209,9 +4191,7 @@ static bool project_paint_check_face_sel(const ProjPaintState *ps,
return ((mp->flag & ME_FACE_SEL) != 0);
}
else {
return true;
}
return true;
}
typedef struct {
@ -6144,19 +6124,18 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Could not get valid evaluated mesh");
return OPERATOR_CANCELLED;
}
else {
float pos[2] = {0.0, 0.0};
float lastpos[2] = {0.0, 0.0};
int a;
project_paint_op(&ps, lastpos, pos);
float pos[2] = {0.0, 0.0};
float lastpos[2] = {0.0, 0.0};
int a;
project_image_refresh_tagged(&ps);
project_paint_op(&ps, lastpos, pos);
for (a = 0; a < ps.image_tot; a++) {
GPU_free_image(ps.projImages[a].ima);
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ps.projImages[a].ima);
}
project_image_refresh_tagged(&ps);
for (a = 0; a < ps.image_tot; a++) {
GPU_free_image(ps.projImages[a].ima);
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ps.projImages[a].ima);
}
project_paint_end(&ps);
@ -6697,9 +6676,7 @@ static int texture_paint_add_texture_paint_slot_exec(bContext *C, wmOperator *op
if (proj_paint_add_slot(C, op)) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
static void get_default_texture_layer_name_for_object(Object *ob,

View File

@ -695,14 +695,12 @@ static Brush *brush_tool_toggle(Main *bmain, Paint *paint, Brush *brush_orig, co
return br;
}
else if (brush_orig->toggle_brush) {
if (brush_orig->toggle_brush) {
/* if current brush is using the desired tool, try to toggle
* back to the previously selected brush. */
return brush_orig->toggle_brush;
}
else {
return NULL;
}
return NULL;
}
static bool brush_generic_tool_set(bContext *C,
@ -751,9 +749,7 @@ static bool brush_generic_tool_set(bContext *C,
return true;
}
else {
return false;
}
return false;
}
static const ePaintMode brush_select_paint_modes[] = {

View File

@ -696,9 +696,7 @@ static float paint_space_stroke_spacing(bContext *C,
if (paint_stroke_use_scene_spacing(brush, mode)) {
return max_ff(0.001f, size_clamp * spacing / 50.f);
}
else {
return max_ff(stroke->zoom_2d, size_clamp * spacing / 50.0f);
}
return max_ff(stroke->zoom_2d, size_clamp * spacing / 50.0f);
}
static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing)
@ -751,9 +749,7 @@ static float paint_stroke_integrate_overlap(Brush *br, float factor)
if (max == 0.0f) {
return 1.0f;
}
else {
return 1.0f / max;
}
return 1.0f / max;
}
static float paint_space_stroke_spacing_variable(bContext *C,
@ -781,10 +777,9 @@ static float paint_space_stroke_spacing_variable(bContext *C,
return 0.5f * (last_spacing + new_spacing);
}
else {
/* no size pressure */
return paint_space_stroke_spacing(C, scene, stroke, 1.0f, pressure);
}
/* no size pressure */
return paint_space_stroke_spacing(C, scene, stroke, 1.0f, pressure);
}
/* For brushes with stroke spacing enabled, moves mouse in steps

View File

@ -137,13 +137,11 @@ static float view_angle_limits_apply_falloff(const struct NormalAnglePrecalc *a,
/* outsize the normal limit */
return false;
}
else if (angle_cos < a->angle_inner__cos) {
if (angle_cos < a->angle_inner__cos) {
*mask_p *= (a->angle - acosf(angle_cos)) / a->angle_range;
return true;
}
else {
return true;
}
return true;
}
static bool vwpaint_use_normal(const VPaint *vp)
@ -405,12 +403,10 @@ static float wpaint_clamp_monotonic(float oldval, float curval, float newval)
if (newval < oldval) {
return MIN2(newval, curval);
}
else if (newval > oldval) {
if (newval > oldval) {
return MAX2(newval, curval);
}
else {
return newval;
}
return newval;
}
static float wpaint_undo_lock_relative(
@ -535,7 +531,7 @@ static bool do_weight_paint_normalize_all_locked(MDeformVert *dvert,
return (lock_weight == 1.0f);
}
else if (sum_unlock != 0.0f) {
if (sum_unlock != 0.0f) {
fac = (1.0f - lock_weight) / sum_unlock;
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {

View File

@ -115,9 +115,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
@ -182,9 +180,7 @@ static int vertex_paint_from_weight_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
@ -323,9 +319,7 @@ static int vertex_color_smooth_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
@ -402,9 +396,7 @@ static int vertex_color_brightness_contrast_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
@ -469,9 +461,7 @@ static int vertex_color_hsv_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
@ -509,9 +499,7 @@ static int vertex_color_invert_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
@ -555,9 +543,7 @@ static int vertex_color_levels_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)

View File

@ -220,7 +220,7 @@ BLI_INLINE uint mcol_lighten(uint col_src, uint col_dst, int fac)
if (fac == 0) {
return col_src;
}
else if (fac >= 255) {
if (fac >= 255) {
return col_dst;
}
@ -254,7 +254,7 @@ BLI_INLINE uint mcol_darken(uint col_src, uint col_dst, int fac)
if (fac == 0) {
return col_src;
}
else if (fac >= 255) {
if (fac >= 255) {
return col_dst;
}

View File

@ -272,9 +272,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_weight_sample(wmOperatorType *ot)
@ -541,9 +539,7 @@ static int weight_paint_set_exec(bContext *C, wmOperator *op)
ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void PAINT_OT_weight_set(wmOperatorType *ot)

View File

@ -139,9 +139,7 @@ const float *SCULPT_vertex_co_get(SculptSession *ss, int index)
const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh);
return mverts[index].co;
}
else {
return ss->mvert[index].co;
}
return ss->mvert[index].co;
}
case PBVH_BMESH:
return BM_vert_at_index(BKE_pbvh_get_bmesh(ss->pbvh), index)->co;
@ -1520,9 +1518,7 @@ bool SCULPT_brush_test_sphere(SculptBrushTest *test, const float co[3])
test->dist = sqrtf(distsq);
return true;
}
else {
return false;
}
return false;
}
bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3])
@ -1536,9 +1532,7 @@ bool SCULPT_brush_test_sphere_sq(SculptBrushTest *test, const float co[3])
test->dist = distsq;
return true;
}
else {
return false;
}
return false;
}
bool SCULPT_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3])
@ -1562,9 +1556,7 @@ bool SCULPT_brush_test_circle_sq(SculptBrushTest *test, const float co[3])
test->dist = distsq;
return true;
}
else {
return false;
}
return false;
}
bool SCULPT_brush_test_cube(SculptBrushTest *test,
@ -1612,10 +1604,8 @@ bool SCULPT_brush_test_cube(SculptBrushTest *test,
test->dist = 0.0f;
return true;
}
else {
/* Outside the square. */
return false;
}
/* Outside the square. */
return false;
}
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss,
@ -1641,10 +1631,8 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss,
if (falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) {
return ss->cache->sculpt_normal_symm;
}
else {
/* PAINT_FALLOFF_SHAPE_TUBE */
return ss->cache->view_normal;
}
/* PAINT_FALLOFF_SHAPE_TUBE */
return ss->cache->view_normal;
}
static float frontface(const Brush *br,
@ -1666,9 +1654,7 @@ static float frontface(const Brush *br,
}
return dot > 0.0f ? dot : 0.0f;
}
else {
return 1.0f;
}
return 1.0f;
}
#if 0
@ -1728,9 +1714,7 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis,
if (distsq <= 4.0f * (cache->radius_squared)) {
return (2.0f * (cache->radius) - sqrtf(distsq)) / (2.0f * (cache->radius));
}
else {
return 0.0f;
}
return 0.0f;
}
static float calc_radial_symmetry_feather(Sculpt *sd,
@ -1768,9 +1752,7 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache)
return 1.0f / overlap;
}
else {
return 1.0f;
}
return 1.0f;
}
/** \name Calculate Normal and Center
@ -7254,9 +7236,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f
return true;
}
else {
return false;
}
return false;
}
static void sculpt_stroke_update_step(bContext *C,

View File

@ -94,9 +94,7 @@ float SCULPT_automasking_factor_get(SculptSession *ss, int vert)
if (ss->cache && ss->cache->automask) {
return ss->cache->automask[vert];
}
else {
return 1.0f;
}
return 1.0f;
}
void SCULPT_automasking_end(Object *ob)

View File

@ -194,15 +194,13 @@ static float cloth_brush_simulation_falloff_get(const Brush *brush,
/* Outiside the limits. */
return 0.0f;
}
else if (distance < falloff) {
if (distance < falloff) {
/* Before the falloff area. */
return 1.0f;
}
else {
/* Do a smoothstep transition inside the falloff area. */
float p = 1.0f - ((distance - falloff) / (limit - falloff));
return 3.0f * p * p - 2.0f * p * p * p;
}
/* Do a smoothstep transition inside the falloff area. */
float p = 1.0f - ((distance - falloff) / (limit - falloff));
return 3.0f * p * p - 2.0f * p * p * p;
}
static void cloth_brush_apply_force_to_vertex(SculptSession *UNUSED(ss),

View File

@ -430,7 +430,7 @@ static bool pose_topology_floodfill_cb(
co, data->pose_initial_co, data->radius, data->symm)) {
return true;
}
else if (SCULPT_check_vertex_pivot_symmetry(co, data->pose_initial_co, data->symm)) {
if (SCULPT_check_vertex_pivot_symmetry(co, data->pose_initial_co, data->symm)) {
if (!is_duplicate) {
add_v3_v3(data->pose_origin, co);
data->tot_co++;

View File

@ -221,9 +221,7 @@ float SCULPT_neighbor_mask_average(SculptSession *ss, int index)
if (total > 0) {
return avg / (float)total;
}
else {
return SCULPT_vertex_mask_get(ss, index);
}
return SCULPT_vertex_mask_get(ss, index);
}
void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index)

View File

@ -167,9 +167,7 @@ static bool test_swap_v3_v3(float a[3], float b[3])
swap_v3_v3(a, b);
return true;
}
else {
return false;
}
return false;
}
static bool sculpt_undo_restore_deformed(
@ -179,9 +177,7 @@ static bool sculpt_undo_restore_deformed(
copy_v3_v3(unode->co[uindex], ss->deform_cos[oindex]);
return true;
}
else {
return false;
}
return false;
}
static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, SculptUndoNode *unode)
@ -1270,17 +1266,17 @@ SculptUndoNode *SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType
BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}
else if (type == SCULPT_UNDO_GEOMETRY) {
if (type == SCULPT_UNDO_GEOMETRY) {
unode = sculpt_undo_geometry_push(ob, type);
BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}
else if (type == SCULPT_UNDO_FACE_SETS) {
if (type == SCULPT_UNDO_FACE_SETS) {
unode = sculpt_undo_face_sets_push(ob, type);
BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}
else if ((unode = SCULPT_undo_get_node(node))) {
if ((unode = SCULPT_undo_get_node(node))) {
BLI_thread_unlock(LOCK_CUSTOM1);
return unode;
}