Cleanup: use const pointers
This commit is contained in:
parent
285cbf9ee4
commit
c6a9b11ef6
@ -261,7 +261,7 @@ void RB_dworld_add_constraint(rbDynamicsWorld *world, rbConstraint *con, int dis
|
||||
/* Remove Rigid Body Constraint from simulation world */
|
||||
void RB_dworld_remove_constraint(rbDynamicsWorld *world, rbConstraint *con);
|
||||
|
||||
rbConstraint *RB_constraint_new_point(float pivot[3], rbRigidBody *rb1, rbRigidBody *rb2);
|
||||
rbConstraint *RB_constraint_new_point(const float pivot[3], rbRigidBody *rb1, rbRigidBody *rb2);
|
||||
rbConstraint *RB_constraint_new_fixed(float pivot[3],
|
||||
float orn[4],
|
||||
rbRigidBody *rb1,
|
||||
|
@ -940,8 +940,8 @@ static void make_constraint_transforms(btTransform &transform1,
|
||||
btTransform &transform2,
|
||||
btRigidBody *body1,
|
||||
btRigidBody *body2,
|
||||
float pivot[3],
|
||||
float orn[4])
|
||||
const float pivot[3],
|
||||
const float orn[4])
|
||||
{
|
||||
btTransform pivot_transform = btTransform();
|
||||
pivot_transform.setIdentity();
|
||||
@ -952,7 +952,7 @@ static void make_constraint_transforms(btTransform &transform1,
|
||||
transform2 = body2->getWorldTransform().inverse() * pivot_transform;
|
||||
}
|
||||
|
||||
rbConstraint *RB_constraint_new_point(float pivot[3], rbRigidBody *rb1, rbRigidBody *rb2)
|
||||
rbConstraint *RB_constraint_new_point(const float pivot[3], rbRigidBody *rb1, rbRigidBody *rb2)
|
||||
{
|
||||
btRigidBody *body1 = rb1->body;
|
||||
btRigidBody *body2 = rb2->body;
|
||||
|
@ -116,7 +116,7 @@ static void subdiv_ccg_init_layers(SubdivCCG &subdiv_ccg, const SubdivToCCGSetti
|
||||
}
|
||||
|
||||
/* TODO(sergey): Make it more accessible function. */
|
||||
static int topology_refiner_count_face_corners(OpenSubdiv_TopologyRefiner *topology_refiner)
|
||||
static int topology_refiner_count_face_corners(const OpenSubdiv_TopologyRefiner *topology_refiner)
|
||||
{
|
||||
const int num_faces = topology_refiner->getNumFaces();
|
||||
int num_corners = 0;
|
||||
@ -130,7 +130,7 @@ static int topology_refiner_count_face_corners(OpenSubdiv_TopologyRefiner *topol
|
||||
* function. */
|
||||
static void subdiv_ccg_alloc_elements(SubdivCCG &subdiv_ccg, Subdiv &subdiv)
|
||||
{
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv.topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv.topology_refiner;
|
||||
const int64_t element_size = element_size_bytes_get(subdiv_ccg);
|
||||
/* Allocate memory for surface grids. */
|
||||
const int64_t num_grids = topology_refiner_count_face_corners(topology_refiner);
|
||||
@ -268,7 +268,7 @@ static bool subdiv_ccg_evaluate_grids(SubdivCCG &subdiv_ccg,
|
||||
SubdivCCGMaskEvaluator *mask_evaluator)
|
||||
{
|
||||
using namespace blender;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv.topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv.topology_refiner;
|
||||
const int num_faces = topology_refiner->getNumFaces();
|
||||
const Span<int> face_ptex_offset(face_ptex_offset_get(&subdiv), subdiv_ccg.faces.size());
|
||||
threading::parallel_for(IndexRange(num_faces), 1024, [&](const IndexRange range) {
|
||||
@ -939,7 +939,7 @@ static void subdiv_ccg_affected_face_adjacency(SubdivCCG &subdiv_ccg,
|
||||
blender::Set<int> &adjacent_edges)
|
||||
{
|
||||
Subdiv *subdiv = subdiv_ccg.subdiv;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
|
||||
Vector<int, 64> face_vertices;
|
||||
Vector<int, 64> face_edges;
|
||||
@ -1196,7 +1196,7 @@ static int adjacent_vertex_index_from_coord(const SubdivCCG &subdiv_ccg,
|
||||
const SubdivCCGCoord &coord)
|
||||
{
|
||||
Subdiv *subdiv = subdiv_ccg.subdiv;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
|
||||
const int face_index = subdiv_ccg.grid_to_face_map[coord.grid_index];
|
||||
const IndexRange face = subdiv_ccg.faces[face_index];
|
||||
@ -1217,7 +1217,7 @@ static void neighbor_coords_corner_vertex_get(const SubdivCCG &subdiv_ccg,
|
||||
SubdivCCGNeighbors &r_neighbors)
|
||||
{
|
||||
Subdiv *subdiv = subdiv_ccg.subdiv;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
|
||||
const int adjacent_vertex_index = adjacent_vertex_index_from_coord(subdiv_ccg, coord);
|
||||
const int num_vertex_edges = topology_refiner->getNumVertexEdges(adjacent_vertex_index);
|
||||
@ -1271,7 +1271,7 @@ static void neighbor_coords_corner_vertex_get(const SubdivCCG &subdiv_ccg,
|
||||
static int adjacent_edge_index_from_coord(const SubdivCCG &subdiv_ccg, const SubdivCCGCoord &coord)
|
||||
{
|
||||
Subdiv *subdiv = subdiv_ccg.subdiv;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
|
||||
const int face_index = subdiv_ccg.grid_to_face_map[coord.grid_index];
|
||||
const IndexRange face = subdiv_ccg.faces[face_index];
|
||||
@ -1299,7 +1299,7 @@ static int adjacent_edge_point_index_from_coord(const SubdivCCG &subdiv_ccg,
|
||||
const int adjacent_edge_index)
|
||||
{
|
||||
Subdiv *subdiv = subdiv_ccg.subdiv;
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
|
||||
const int adjacent_vertex_index = adjacent_vertex_index_from_coord(subdiv_ccg, coord);
|
||||
int edge_vertices_indices[2];
|
||||
@ -1398,7 +1398,7 @@ static void neighbor_coords_edge_get(const SubdivCCG &subdiv_ccg,
|
||||
|
||||
int duplicate_i = num_adjacent_faces;
|
||||
for (int i = 0; i < num_adjacent_faces; ++i) {
|
||||
SubdivCCGCoord *boundary_coords = adjacent_edge->boundary_coords[i];
|
||||
const SubdivCCGCoord *boundary_coords = adjacent_edge->boundary_coords[i];
|
||||
/* One step into the grid from the edge for each adjacent face. */
|
||||
SubdivCCGCoord grid_coord = boundary_coords[point_index];
|
||||
r_neighbors.coords[i + 2] = coord_step_inside_from_boundary(subdiv_ccg, grid_coord);
|
||||
|
@ -19,7 +19,7 @@ namespace blender::bke::subdiv {
|
||||
int topology_num_fvar_layers_get(const Subdiv *subdiv)
|
||||
{
|
||||
#ifdef WITH_OPENSUBDIV
|
||||
OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
const OpenSubdiv_TopologyRefiner *topology_refiner = subdiv->topology_refiner;
|
||||
return topology_refiner->getNumFVarChannels();
|
||||
#else
|
||||
UNUSED_VARS(subdiv);
|
||||
|
@ -33,15 +33,15 @@ void BLI_expr_pylike_free(struct ExprPyLike_Parsed *expr);
|
||||
/**
|
||||
* Check if the parsing result is valid for evaluation.
|
||||
*/
|
||||
bool BLI_expr_pylike_is_valid(struct ExprPyLike_Parsed *expr);
|
||||
bool BLI_expr_pylike_is_valid(const struct ExprPyLike_Parsed *expr);
|
||||
/**
|
||||
* Check if the parsed expression always evaluates to the same value.
|
||||
*/
|
||||
bool BLI_expr_pylike_is_constant(struct ExprPyLike_Parsed *expr);
|
||||
bool BLI_expr_pylike_is_constant(const struct ExprPyLike_Parsed *expr);
|
||||
/**
|
||||
* Check if the parsed expression uses the parameter with the given index.
|
||||
*/
|
||||
bool BLI_expr_pylike_is_using_param(struct ExprPyLike_Parsed *expr, int index);
|
||||
bool BLI_expr_pylike_is_using_param(const struct ExprPyLike_Parsed *expr, int index);
|
||||
/**
|
||||
* Compile the expression and return the result.
|
||||
*
|
||||
|
@ -116,17 +116,17 @@ void BLI_expr_pylike_free(ExprPyLike_Parsed *expr)
|
||||
}
|
||||
}
|
||||
|
||||
bool BLI_expr_pylike_is_valid(ExprPyLike_Parsed *expr)
|
||||
bool BLI_expr_pylike_is_valid(const ExprPyLike_Parsed *expr)
|
||||
{
|
||||
return expr != NULL && expr->ops_count > 0;
|
||||
}
|
||||
|
||||
bool BLI_expr_pylike_is_constant(ExprPyLike_Parsed *expr)
|
||||
bool BLI_expr_pylike_is_constant(const ExprPyLike_Parsed *expr)
|
||||
{
|
||||
return expr != NULL && expr->ops_count == 1 && expr->ops[0].opcode == OPCODE_CONST;
|
||||
}
|
||||
|
||||
bool BLI_expr_pylike_is_using_param(ExprPyLike_Parsed *expr, int index)
|
||||
bool BLI_expr_pylike_is_using_param(const ExprPyLike_Parsed *expr, int index)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -201,7 +201,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
|
||||
|
||||
static void wm_gesture_draw_rect(wmGesture *gt)
|
||||
{
|
||||
rcti *rect = (rcti *)gt->customdata;
|
||||
const rcti *rect = static_cast<const rcti *>(gt->customdata);
|
||||
|
||||
uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
|
||||
@ -242,7 +242,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
|
||||
|
||||
static void wm_gesture_draw_circle(wmGesture *gt)
|
||||
{
|
||||
rcti *rect = (rcti *)gt->customdata;
|
||||
const rcti *rect = static_cast<const rcti *>(gt->customdata);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
@ -384,7 +384,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
|
||||
|
||||
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
|
||||
{
|
||||
rcti *rect = (rcti *)gt->customdata;
|
||||
const rcti *rect = static_cast<const rcti *>(gt->customdata);
|
||||
const int winsize_x = WM_window_pixels_x(win);
|
||||
const int winsize_y = WM_window_pixels_y(win);
|
||||
|
||||
|
@ -127,7 +127,7 @@ static int UNUSED_FUNCTION(gesture_modal_state_from_operator)(wmOperator *op)
|
||||
static bool gesture_box_apply_rect(wmOperator *op)
|
||||
{
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
const rcti *rect = static_cast<const rcti *>(gesture->customdata);
|
||||
|
||||
if (rect->xmin == rect->xmax || rect->ymin == rect->ymax) {
|
||||
return false;
|
||||
@ -319,7 +319,7 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static void gesture_circle_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
const rcti *rect = static_cast<const rcti *>(gesture->customdata);
|
||||
|
||||
if (gesture->wait_for_input && (gesture->modal_state == GESTURE_MODAL_NOP)) {
|
||||
return;
|
||||
@ -710,7 +710,7 @@ void WM_OT_lasso_gesture(wmOperatorType *ot)
|
||||
static bool gesture_straightline_apply(bContext *C, wmOperator *op)
|
||||
{
|
||||
wmGesture *gesture = static_cast<wmGesture *>(op->customdata);
|
||||
rcti *rect = static_cast<rcti *>(gesture->customdata);
|
||||
const rcti *rect = static_cast<const rcti *>(gesture->customdata);
|
||||
|
||||
if (rect->xmin == rect->xmax && rect->ymin == rect->ymax) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user