Cleanup: Sculpt: Remove unnecessary default case statements

Pull Request: https://projects.blender.org/blender/blender/pulls/127003
This commit is contained in:
Sean Kim
2024-08-31 04:04:34 +02:00
committed by Sean Kim
parent a08005f484
commit ead0e2d1f8
6 changed files with 9 additions and 54 deletions

View File

@@ -1888,8 +1888,6 @@ static void vpaint_paint_leaves(bContext *C,
case VPAINT_TOOL_SMEAR:
do_vpaint_brush_smear(C, vp, vpd, ob, mesh, nodes, node_mask, attribute);
break;
default:
break;
}
}

View File

@@ -2428,9 +2428,7 @@ static float brush_strength(const Sculpt &sd,
case BRUSH_MASK_SMOOTH:
return alpha * pressure * feather;
}
BLI_assert_msg(0, "Not supposed to happen");
return 0.0f;
break;
case SCULPT_TOOL_CREASE:
case SCULPT_TOOL_BLOB:
return alpha * flip * pressure * overlap * feather;
@@ -2490,10 +2488,9 @@ static float brush_strength(const Sculpt &sd,
case SCULPT_TOOL_POSE:
case SCULPT_TOOL_BOUNDARY:
return root_alpha * feather;
default:
return 0.0f;
}
BLI_assert_unreachable();
return 0.0f;
}
void sculpt_apply_texture(const SculptSession &ss,
@@ -3098,9 +3095,6 @@ void calc_brush_plane(const Depsgraph &depsgraph,
normalize_v3(r_area_no);
}
break;
default:
break;
}
/* For flatten center. */

View File

@@ -822,8 +822,6 @@ static void fill_topology_automasking_factors(const Depsgraph &depsgraph,
case bke::pbvh::Type::BMesh:
fill_topology_automasking_factors_bmesh(sd, ob, *ss.bm);
break;
default:
BLI_assert_unreachable();
}
}

View File

@@ -2956,9 +2956,6 @@ static std::pair<float, float> calc_boundary_falloff(const SculptBoundary &bound
/* For constant falloff distances are not allocated, so this should never happen. */
BLI_assert_unreachable();
break;
default:
BLI_assert_unreachable();
break;
}
return {falloff_distance, direction};
@@ -3170,9 +3167,6 @@ static void init_boundary_mesh(const Depsgraph &depsgraph,
case BRUSH_BOUNDARY_DEFORM_SMOOTH:
/* Do nothing. These deform modes don't need any extra data to be precomputed. */
break;
default:
BLI_assert_unreachable();
break;
}
init_falloff_mesh(mask, brush, ss.cache->initial_radius, *ss.cache->boundaries[symm_area]);
@@ -3231,9 +3225,6 @@ static void init_boundary_grids(Object &object,
case BRUSH_BOUNDARY_DEFORM_SMOOTH:
/* Do nothing. These deform modes don't need any extra data to be precomputed. */
break;
default:
BLI_assert_unreachable();
break;
}
init_falloff_grids(
@@ -3288,9 +3279,6 @@ static void init_boundary_bmesh(Object &object,
case BRUSH_BOUNDARY_DEFORM_SMOOTH:
/* Do nothing. These deform modes don't need any extra data to be precomputed. */
break;
default:
BLI_assert_unreachable();
break;
}
init_falloff_bmesh(bm, brush, ss.cache->initial_radius, *ss.cache->boundaries[symm_area]);
@@ -3333,9 +3321,6 @@ static float get_mesh_strength(const SculptSession &ss, const Brush &brush)
}
case BRUSH_BOUNDARY_DEFORM_SMOOTH:
return strength;
default:
BLI_assert_unreachable();
break;
}
BLI_assert_unreachable();
@@ -3362,9 +3347,6 @@ void do_boundary_brush(const Depsgraph &depsgraph,
case bke::pbvh::Type::BMesh:
init_boundary_bmesh(ob, brush, symm_area);
break;
default:
BLI_assert_unreachable();
break;
}
}
@@ -3430,9 +3412,6 @@ void do_boundary_brush(const Depsgraph &depsgraph,
strength,
eBrushDeformTarget(brush.deform_target));
break;
default:
BLI_assert_unreachable();
break;
}
}
@@ -3670,9 +3649,6 @@ std::unique_ptr<SculptBoundaryPreview> preview_data_init(const Depsgraph &depsgr
case bke::pbvh::Type::BMesh:
boundary = data_init_bmesh(object, brush, std::get<BMVert *>(initial_vert), radius);
break;
default:
BLI_assert_unreachable();
break;
}
if (boundary == nullptr) {

View File

@@ -1435,22 +1435,12 @@ static bool edit_is_operation_valid(const Object &object,
return true;
}
static void edit_modify_geometry(bContext *C,
Object &ob,
const int active_face_set,
const EditMode mode,
const bool modify_hidden,
wmOperator *op)
static void edit_modify_geometry(
bContext *C, Object &ob, const int active_face_set, const bool modify_hidden, wmOperator *op)
{
Mesh *mesh = static_cast<Mesh *>(ob.data);
undo::geometry_begin(ob, op);
switch (mode) {
case EditMode::DeleteGeometry:
delete_geometry(ob, active_face_set, modify_hidden);
break;
default:
BLI_assert_unreachable();
}
delete_geometry(ob, active_face_set, modify_hidden);
undo::geometry_end(ob);
BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(&ob.id, ID_RECALC_GEOMETRY);
@@ -1528,7 +1518,7 @@ static int edit_op_exec(bContext *C, wmOperator *op)
switch (mode) {
case EditMode::DeleteGeometry:
edit_modify_geometry(C, ob, active_face_set, mode, modify_hidden, op);
edit_modify_geometry(C, ob, active_face_set, modify_hidden, op);
break;
case EditMode::Grow:
case EditMode::Shrink:

View File

@@ -363,10 +363,9 @@ static void update_affected_nodes_by_clip_planes(GestureData &gesture_data)
return true;
}
return BKE_pbvh_node_frustum_exclude_AABB(&node, &frustum);
default:
BLI_assert_unreachable();
return true;
}
BLI_assert_unreachable();
return false;
});
}