Cleanup: use const args, variables

This commit is contained in:
Campbell Barton 2019-09-14 08:10:50 +10:00
parent d30ec73d76
commit 0547a77536
Notes: blender-bot 2023-02-14 11:08:33 +01:00
Referenced by issue #70197, Cycles viewport bug (video)
Referenced by issue #70190, File browser access crashes Blender
Referenced by issue #70095, Quadriflow crash running on a messy mesh
Referenced by issue #69868, failure to render eevee
Referenced by issue #69864, Crash - Shading Workspace
Referenced by issue #69853, fully broken scenes., by drag an object only the pivot point moves
Referenced by issue #58428, Motion Tracking: pre Blender 2.8 file prefetch footage freezes Blender
70 changed files with 202 additions and 171 deletions

View File

@ -1005,9 +1005,9 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param,
}
static void make_bbone_spline_matrix(BBoneSplineParameters *param,
float scalemats[2][4][4],
float pos[3],
float axis[3],
const float scalemats[2][4][4],
const float pos[3],
const float axis[3],
float roll,
float scalex,
float scaley,

View File

@ -188,11 +188,11 @@ BLI_INLINE int next_ind(int i)
}
static float compute_collision_point(float a1[3],
float a2[3],
float a3[3],
float b1[3],
float b2[3],
float b3[3],
const float a2[3],
const float a3[3],
const float b1[3],
const float b2[3],
const float b3[3],
bool culling,
bool use_normal,
float r_a[3],
@ -419,7 +419,7 @@ static float compute_collision_point(float a1[3],
// w3 is not perfect
static void collision_compute_barycentric(
float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3)
const float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3)
{
/* dot_v3v3 */
#define INPR(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
@ -1499,7 +1499,7 @@ BLI_INLINE bool cloth_point_face_collision_params(const float p1[3],
}
static CollPair *cloth_point_collpair(float p1[3],
float p2[3],
const float p2[3],
const MVert *mverts,
int bp1,
int bp2,

View File

@ -2410,9 +2410,9 @@ static void armdef_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
}
static void armdef_accumulate_matrix(float obmat[4][4],
float iobmat[4][4],
float basemat[4][4],
float bonemat[4][4],
const float iobmat[4][4],
const float basemat[4][4],
const float bonemat[4][4],
float weight,
float r_sum_mat[4][4],
DualQuat *r_sum_dq)

View File

@ -2645,7 +2645,7 @@ static int gpencil_check_same_material_color(Object *ob_gp, float color[4], Mate
/* Helper: Add gpencil material using curve material as base. */
static Material *gpencil_add_from_curve_material(Main *bmain,
Object *ob_gp,
float cu_color[4],
const float cu_color[4],
const bool gpencil_lines,
const bool fill,
int *r_idx)
@ -2686,7 +2686,7 @@ static void gpencil_add_new_points(bGPDstroke *gps,
float pressure,
int init,
int totpoints,
float init_co[3],
const float init_co[3],
bool last)
{
for (int i = 0; i < totpoints; i++) {

View File

@ -2348,7 +2348,7 @@ static void multires_apply_uniform_scale(Object *object, const float scale)
static void multires_apply_smat(struct Depsgraph *UNUSED(depsgraph),
Scene *scene,
Object *object,
float smat[3][3])
const float smat[3][3])
{
const MultiresModifierData *mmd = get_multires_modifier(scene, object, true);
if (mmd == NULL || mmd->totlvl == 0) {

View File

@ -93,8 +93,11 @@ typedef struct DupliGenerator {
static const DupliGenerator *get_dupli_generator(const DupliContext *ctx);
/* create initial context for root object */
static void init_context(
DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, Object *ob, float space_mat[4][4])
static void init_context(DupliContext *r_ctx,
Depsgraph *depsgraph,
Scene *scene,
Object *ob,
const float space_mat[4][4])
{
r_ctx->depsgraph = depsgraph;
r_ctx->scene = scene;
@ -118,7 +121,7 @@ static void init_context(
/* create sub-context for recursive duplis */
static void copy_dupli_context(
DupliContext *r_ctx, const DupliContext *ctx, Object *ob, float mat[4][4], int index)
DupliContext *r_ctx, const DupliContext *ctx, Object *ob, const float mat[4][4], int index)
{
*r_ctx = *ctx;
@ -204,7 +207,7 @@ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4]
*/
static void make_recursive_duplis(const DupliContext *ctx,
Object *ob,
float space_mat[4][4],
const float space_mat[4][4],
int index)
{
/* simple preventing of too deep nested collections with MAX_DUPLI_RECUR */

View File

@ -657,7 +657,7 @@ float do_clump(ParticleKey *state,
}
static void do_rough(const float loc[3],
float mat[4][4],
const float mat[4][4],
float t,
float fac,
float size,
@ -701,7 +701,7 @@ static void do_rough_end(
}
static void do_rough_curve(const float loc[3],
float mat[4][4],
const float mat[4][4],
float time,
float fac,
float size,

View File

@ -1695,7 +1695,7 @@ typedef struct SPHRangeData {
static void sph_evaluate_func(BVHTree *tree,
ParticleSystem **psys,
float co[3],
const float co[3],
SPHRangeData *pfr,
float interaction_radius,
BVHTree_RangeQuery callback)
@ -2497,7 +2497,7 @@ static float collision_point_distance_with_normal(
return 0;
}
static void collision_point_on_surface(
float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co)
const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co)
{
collision_interpolate_element(pce, 0.f, fac, col);

View File

@ -1049,8 +1049,8 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]),
/* +++ the face external section*/
static int sb_detect_face_pointCached(float face_v1[3],
float face_v2[3],
float face_v3[3],
const float face_v2[3],
const float face_v3[3],
float *damp,
float force[3],
struct Object *vertexowner,
@ -1147,8 +1147,8 @@ static int sb_detect_face_pointCached(float face_v1[3],
}
static int sb_detect_face_collisionCached(float face_v1[3],
float face_v2[3],
float face_v3[3],
const float face_v2[3],
const float face_v3[3],
float *damp,
float force[3],
struct Object *vertexowner,
@ -1326,7 +1326,7 @@ static void scan_for_ext_face_forces(Object *ob, float timenow)
/* +++ the spring external section*/
static int sb_detect_edge_collisionCached(float edge_v1[3],
float edge_v2[3],
const float edge_v2[3],
float *damp,
float force[3],
struct Object *vertexowner,

View File

@ -946,7 +946,7 @@ BLI_INLINE void studiolight_spherical_harmonics_eval(StudioLight *sl,
/* This modify the radiance into irradiance. */
static void studiolight_spherical_harmonics_apply_band_factors(StudioLight *sl, float (*sh)[3])
{
static float sl_sh_band_factors[5] = {
static const float sl_sh_band_factors[5] = {
1.0f,
2.0f / 3.0f,
1.0f / 4.0f,
@ -1074,7 +1074,7 @@ static float wrapped_lighting(float NL, float w)
static float blinn_specular(const float L[3],
const float I[3],
const float N[3],
float R[3],
const float R[3],
float NL,
float roughness,
float wrap)

View File

@ -581,7 +581,7 @@ static void voronoi_clampEdges(ListBase *edges, int width, int height, ListBase
}
static int voronoi_getNextSideCoord(
ListBase *edges, float coord[2], int dim, int dir, float next_coord[2])
ListBase *edges, const float coord[2], int dim, int dir, float next_coord[2])
{
VoronoiEdge *edge = edges->first;
float distance = FLT_MAX;

View File

@ -330,9 +330,9 @@ static bool quad_co(const float v1[3],
}
static void mdisp_axis_from_quad(float v1[3],
float v2[3],
const float v2[3],
float UNUSED(v3[3]),
float v4[3],
const float v4[3],
float r_axis_x[3],
float r_axis_y[3])
{

View File

@ -94,7 +94,7 @@ static BMLoop *bm_edge_flagged_radial_first(BMEdge *e)
}
static void normalize_v2_m3_v3v3(float out[2],
float axis_mat[3][3],
const float axis_mat[3][3],
const float v1[3],
const float v2[3])
{
@ -110,7 +110,7 @@ static void normalize_v2_m3_v3v3(float out[2],
*/
static bool bm_face_split_edgenet_find_loop_pair(BMVert *v_init,
const float face_normal[3],
float face_normal_matrix[3][3],
const float face_normal_matrix[3][3],
BMEdge *e_pair[2])
{
/* Always find one boundary edge (to determine winding)
@ -420,7 +420,7 @@ finally:
static bool bm_face_split_edgenet_find_loop(BMVert *v_init,
const float face_normal[3],
float face_normal_matrix[3][3],
const float face_normal_matrix[3][3],
/* cache to avoid realloc every time */
struct VertOrder *edge_order,
const uint edge_order_len,

View File

@ -277,8 +277,8 @@ static void bm_edge_pair_elem_setup(BMEdge *e,
static bool bm_vertxedge_isect_impl_ex(BMVert *v,
BMEdge *e,
int edge_index,
float co[3],
float dir[3],
const float co[3],
const float dir[3],
float lambda,
float data_dist_sq,
int *data_cut_edges_len,
@ -411,10 +411,10 @@ static void bm_edgexedge_isect_impl(struct EDBMSplitData *data,
int index_b,
BMEdge *e_a,
BMEdge *e_b,
float co_a[3],
float dir_a[3],
float co_b[3],
float dir_b[3],
const float co_a[3],
const float dir_a[3],
const float co_b[3],
const float dir_b[3],
float lambda_a,
float lambda_b)
{

View File

@ -80,7 +80,7 @@ static void gpencil_set_buffer_stroke_point(GPUVertBuf *vbo,
uint thickness_id,
uint uvdata_id,
uint prev_pos_id,
float ref_pt[3],
const float ref_pt[3],
short thickness,
const float ink[4])
{
@ -110,7 +110,7 @@ static void gpencil_set_fill_point(GPUVertBuf *vbo,
int idx,
bGPDspoint *pt,
const float fcolor[4],
float uv[2],
const float uv[2],
uint pos_id,
uint color_id,
uint text_id)
@ -886,7 +886,7 @@ void gpencil_get_edlin_geom(struct GpencilBatchCacheElem *be,
static void set_grid_point(GPUVertBuf *vbo,
int idx,
float col_grid[4],
const float col_grid[4],
uint pos_id,
uint color_id,
float v1,

View File

@ -276,8 +276,11 @@ static void gpencil_calc_2d_bounding_box(const float (*points2d)[2],
}
/* calc texture coordinates using flat projected points */
static void gpencil_calc_stroke_fill_uv(
const float (*points2d)[2], int totpoints, float minv[2], float maxv[2], float (*r_uv)[2])
static void gpencil_calc_stroke_fill_uv(const float (*points2d)[2],
int totpoints,
const float minv[2],
float maxv[2],
float (*r_uv)[2])
{
float d[2];
d[0] = maxv[0] - minv[0];
@ -419,7 +422,7 @@ static DRWShadingGroup *gpencil_shgroup_fill_create(GPENCIL_Data *vedata,
bGPDlayer *gpl,
MaterialGPencilStyle *gp_style,
int id,
int shading_type[2])
const int shading_type[2])
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();

View File

@ -131,7 +131,7 @@ static void GPENCIL_render_cache(void *vedata,
/* TODO: Reuse Eevee code in shared module instead to duplicate here */
static void GPENCIL_render_update_viewvecs(float invproj[4][4],
float winmat[4][4],
const float winmat[4][4],
float (*r_viewvecs)[4])
{
/* view vectors for the corners of the view frustum.

View File

@ -284,7 +284,7 @@ bool studiolight_camera_in_object_shadow(WORKBENCH_PrivateData *wpd,
}
/* Test projected near rectangle sides */
float pts[4][2] = {
const float pts[4][2] = {
{oed->shadow_min[0], oed->shadow_min[1]},
{oed->shadow_min[0], oed->shadow_max[1]},
{oed->shadow_max[0], oed->shadow_min[1]},

View File

@ -592,7 +592,7 @@ GPUBatch *DRW_cache_circle_get(void)
GPUBatch *DRW_cache_square_get(void)
{
if (!SHC.drw_square) {
float p[4][3] = {
const float p[4][3] = {
{1.0f, 0.0f, 1.0f}, {1.0f, 0.0f, -1.0f}, {-1.0f, 0.0f, -1.0f}, {-1.0f, 0.0f, 1.0f}};
/* Position Only 3D format */
@ -1801,7 +1801,7 @@ GPUBatch *DRW_cache_light_spot_volume_get(void)
GPUBatch *DRW_cache_light_spot_square_get(void)
{
if (!SHC.drw_light_spot_square) {
float p[5][3] = {
const float p[5][3] = {
{0.0f, 0.0f, 0.0f},
{1.0f, 1.0f, -1.0f},
{1.0f, -1.0f, -1.0f},
@ -1840,7 +1840,7 @@ GPUBatch *DRW_cache_light_spot_square_get(void)
GPUBatch *DRW_cache_light_spot_square_volume_get(void)
{
if (!SHC.drw_light_spot_square_volume) {
float p[5][3] = {
const float p[5][3] = {
{0.0f, 0.0f, 0.0f},
{1.0f, 1.0f, -1.0f},
{1.0f, -1.0f, -1.0f},
@ -1952,7 +1952,7 @@ GPUBatch *DRW_cache_lightprobe_cube_get(void)
int v_idx = 0;
const float sin_pi_3 = 0.86602540378f;
const float cos_pi_3 = 0.5f;
float v[7][3] = {
const float v[7][3] = {
{0.0f, 1.0f, 0.0f},
{sin_pi_3, cos_pi_3, 0.0f},
{sin_pi_3, -cos_pi_3, 0.0f},
@ -2057,7 +2057,7 @@ GPUBatch *DRW_cache_lightprobe_planar_get(void)
if (!SHC.drw_lightprobe_planar) {
int v_idx = 0;
const float sin_pi_3 = 0.86602540378f;
float v[4][3] = {
const float v[4][3] = {
{0.0f, 0.5f, 0.0f},
{sin_pi_3, 0.0f, 0.0f},
{0.0f, -0.5f, 0.0f},

View File

@ -772,7 +772,7 @@ static void curve_create_edit_data_and_handles(CurveRenderData *rdata,
GPU_indexbuf_add_line_verts(elbp_lines, vbo_len_used + 1, vbo_len_used + 2);
}
if (vbo_data) {
char vflag[3] = {
const char vflag[3] = {
beztriple_vflag_get(rdata, bezt->f1, bezt->h1, a, nu_id),
beztriple_vflag_get(rdata, bezt->f2, bezt->h1, a, nu_id),
beztriple_vflag_get(rdata, bezt->f3, bezt->h2, a, nu_id),

View File

@ -2154,7 +2154,7 @@ static void camera_view3d_stereoscopy_display_extra(OBJECT_ShadingGroupList *sgl
static float one = 1.0f;
float plane_mat[4][4], scale_mat[4][4];
float scale_factor[3] = {1.0f, 1.0f, 1.0f};
float color_plane[2][4] = {
const float color_plane[2][4] = {
{0.0f, 0.0f, 0.0f, v3d->stereo3d_convergence_alpha},
{0.0f, 0.0f, 0.0f, 1.0f},
};
@ -2180,7 +2180,7 @@ static void camera_view3d_stereoscopy_display_extra(OBJECT_ShadingGroupList *sgl
/* Draw convergence volume. */
if (is_stereo3d_volume && !is_select) {
static float one = 1.0f;
float color_volume[3][4] = {
const float color_volume[3][4] = {
{0.0f, 1.0f, 1.0f, v3d->stereo3d_volume_alpha},
{1.0f, 0.0f, 0.0f, v3d->stereo3d_volume_alpha},
{0.0f, 0.0f, 0.0f, 1.0f},
@ -2306,7 +2306,7 @@ static void camera_view3d_reconstruction(OBJECT_ShadingGroupList *sgl,
DRW_shgroup_empty_ex(sgl, bundle_mat, &v3d->bundle_size, v3d->bundle_drawtype, color);
}
float bundle_color_v4[4] = {
const float bundle_color_v4[4] = {
bundle_color[0],
bundle_color[1],
bundle_color[2],

View File

@ -54,7 +54,7 @@
* Given a single axis, orient the matrix to a different direction.
*/
static void single_axis_convert(int src_axis,
float src_mat[4][4],
const float src_mat[4][4],
int dst_axis,
float dst_mat[4][4])
{
@ -73,7 +73,7 @@ static void single_axis_convert(int src_axis,
* Use for all geometry.
*/
static void ed_gizmo_draw_preset_geometry(const struct wmGizmo *gz,
float mat[4][4],
const float mat[4][4],
int select_id,
const GizmoGeomInfo *info)
{

View File

@ -273,7 +273,7 @@ static void dial_ghostarc_draw(const float angle_ofs,
static void dial_ghostarc_get_angles(const wmGizmo *gz,
const wmEvent *event,
const ARegion *ar,
float mat[4][4],
const float mat[4][4],
const float co_outer[3],
float *r_start,
float *r_delta)

View File

@ -95,7 +95,7 @@ static void annotation_draw_stroke_buffer(const tGPspoint *points,
short thickness,
short dflag,
short sflag,
float ink[4])
const float ink[4])
{
int draw_points = 0;

View File

@ -267,8 +267,11 @@ static void gp_calc_2d_bounding_box(
}
/* calc texture coordinates using flat projected points */
static void gp_calc_stroke_text_coordinates(
const float (*points2d)[2], int totpoints, float minv[2], float maxv[2], float (*r_uv)[2])
static void gp_calc_stroke_text_coordinates(const float (*points2d)[2],
int totpoints,
const float minv[2],
float maxv[2],
float (*r_uv)[2])
{
float d[2];
d[0] = maxv[0] - minv[0];

View File

@ -565,7 +565,7 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
/* Apply grab transform to all relevant points of the affected strokes */
static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
bGPDstroke *gps,
float diff_mat[4][4])
const float diff_mat[4][4])
{
tGPSB_Grab_StrokeData *data = BLI_ghash_lookup(gso->stroke_customdata, gps);
int i;
@ -1555,7 +1555,7 @@ static float gpsculpt_rotation_eval_get(GP_SpaceConversion *gsc,
/* Apply brush operation to points in this stroke */
static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
bGPDstroke *gps,
float diff_mat[4][4],
const float diff_mat[4][4],
GP_BrushApplyCb apply)
{
GP_SpaceConversion *gsc = &gso->gsc;
@ -1680,8 +1680,11 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
}
/* Apply sculpt brushes to strokes in the given frame */
static bool gpsculpt_brush_do_frame(
bContext *C, tGP_BrushEditData *gso, bGPDlayer *gpl, bGPDframe *gpf, float diff_mat[4][4])
static bool gpsculpt_brush_do_frame(bContext *C,
tGP_BrushEditData *gso,
bGPDlayer *gpl,
bGPDframe *gpf,
const float diff_mat[4][4])
{
bool changed = false;
Object *ob = CTX_data_active_object(C);

View File

@ -3021,7 +3021,7 @@ static void gpencil_flip_stroke(bGPDstroke *gps)
static void gpencil_stroke_copy_point(bGPDstroke *gps,
bGPDspoint *point,
int idx,
float delta[3],
const float delta[3],
float pressure,
float strength,
float deltatime)

View File

@ -840,7 +840,7 @@ static bool gp_stroke_do_circle_sel(bGPDlayer *gpl,
const int radius,
const bool select,
rcti *rect,
float diff_mat[4][4],
const float diff_mat[4][4],
const int selectmode,
const float scale)
{

View File

@ -1952,7 +1952,7 @@ void ED_gpencil_setup_modes(bContext *C, bGPdata *gpd, int newmode)
/* helper to convert 2d to 3d for simple drawing buffer */
static void gpencil_stroke_convertcoords(ARegion *ar,
const tGPspoint *point2D,
float origin[3],
const float origin[3],
float out[3])
{
float mval_f[2] = {(float)point2D->x, (float)point2D->y};
@ -2084,8 +2084,8 @@ static bool gpencil_check_collision(bGPDstroke *gps,
bGPDstroke **gps_array,
GHash *all_2d,
int totstrokes,
float p2d_a1[2],
float p2d_a2[2],
const float p2d_a1[2],
const float p2d_a2[2],
float r_hit[2])
{
bool hit = false;
@ -2164,7 +2164,7 @@ static void gp_copy_points(bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final
}
static void gp_insert_point(
bGPDstroke *gps, bGPDspoint *a_pt, bGPDspoint *b_pt, float co_a[3], float co_b[3])
bGPDstroke *gps, bGPDspoint *a_pt, bGPDspoint *b_pt, const float co_a[3], float co_b[3])
{
bGPDspoint *temp_points;
int totnewpoints, oldtotpoints;

View File

@ -777,7 +777,7 @@ static ImBuf *create_mono_icon_with_border(ImBuf *buf,
const int blurred_alpha_offset = by * (ICON_GRID_W + 2 * ICON_MONO_BORDER_OUTSET) + bx;
const int offset_write = (sy + by) * buf->x + (sx + bx);
const float blurred_alpha = blurred_alpha_buffer[blurred_alpha_offset];
float border_srgb[4] = {
const float border_srgb[4] = {
0, 0, 0, MIN2(1.0, blurred_alpha * border_sharpness) * border_intensity};
const unsigned int color_read = buf->rect[offset_write];

View File

@ -1311,7 +1311,7 @@ static struct {
void UI_widgetbase_draw_cache_flush(void)
{
float checker_params[3] = {
const float checker_params[3] = {
UI_ALPHA_CHECKER_DARK / 255.0f, UI_ALPHA_CHECKER_LIGHT / 255.0f, 8.0f};
if (g_widget_base_batch.count == 0) {
@ -1394,7 +1394,7 @@ static void draw_widgetbase_batch(GPUBatch *batch, uiWidgetBase *wtb)
}
}
else {
float checker_params[3] = {
const float checker_params[3] = {
UI_ALPHA_CHECKER_DARK / 255.0f, UI_ALPHA_CHECKER_LIGHT / 255.0f, 8.0f};
/* draw single */
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE);
@ -3337,7 +3337,7 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol)
{
int y = rect->ymin + BLI_rcti_size_y(rect) / 2 - 1;
uchar col[4] = {
const uchar col[4] = {
wcol->text[0],
wcol->text[1],
wcol->text[2],

View File

@ -78,7 +78,7 @@ static void calc_initial_placement_point_from_view(bContext *C,
float orient_matrix[3][3];
BKE_scene_cursor_to_mat4(&scene->cursor, cursor_matrix);
float dots[3] = {
const float dots[3] = {
dot_v3v3(rv3d->viewinv[2], cursor_matrix[0]),
dot_v3v3(rv3d->viewinv[2], cursor_matrix[1]),
dot_v3v3(rv3d->viewinv[2], cursor_matrix[2]),

View File

@ -81,7 +81,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
Scene *scene,
Object *ob_dst,
Object *ob_src,
float imat[4][4],
const float imat[4][4],
MVert **mvert_pp,
MEdge **medge_pp,
MLoop **mloop_pp,

View File

@ -1679,7 +1679,7 @@ static void object_apply_location(Object *ob, const float loc[3])
}
static void object_orient_to_location(Object *ob,
float rot_orig[3][3],
const float rot_orig[3][3],
const float axis[3],
const float location[3])
{

View File

@ -1319,8 +1319,8 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
Object *ob,
Mesh *me,
int index,
float norm[3],
float coord[3],
const float norm[3],
const float coord[3],
float d,
float distToBe,
float strength,

View File

@ -43,7 +43,7 @@
static void object_warp_calc_view_matrix(float r_mat_view[4][4],
float r_center_view[3],
Object *obedit,
float viewmat[4][4],
const float viewmat[4][4],
const float center[3],
const float offset_angle)
{
@ -62,7 +62,7 @@ static void object_warp_calc_view_matrix(float r_mat_view[4][4],
}
static void object_warp_transverts_minmax_x(TransVertStore *tvs,
float mat_view[4][4],
const float mat_view[4][4],
const float center_view[3],
float *r_min,
float *r_max)
@ -90,7 +90,7 @@ static void object_warp_transverts_minmax_x(TransVertStore *tvs,
}
static void object_warp_transverts(TransVertStore *tvs,
float mat_view[4][4],
const float mat_view[4][4],
const float center_view[3],
const float angle_,
const float min,

View File

@ -649,8 +649,8 @@ typedef void (*ForHitPointFunc)(PEData *data, int point_index, float mouse_dista
typedef void (*ForKeyFunc)(PEData *data, int point_index, int key_index, bool is_inside);
typedef void (*ForKeyMatFunc)(PEData *data,
float mat[4][4],
float imat[4][4],
const float mat[4][4],
const float imat[4][4],
int point_index,
int key_index,
PTCacheEditKey *key);

View File

@ -704,8 +704,8 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
Object *target_ob,
ParticleSystem *target_psys,
PTCacheEdit *target_edit,
float from_mat[4][4],
float to_mat[4][4],
const float from_mat[4][4],
const float to_mat[4][4],
bool from_global,
bool to_global)
{

View File

@ -812,7 +812,7 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
return;
}
float coords[4][4] = {
const float coords[4][4] = {
/* Bottom-left. */
{sa->totrct.xmin - U.pixelsize,
sa->totrct.ymin - U.pixelsize,
@ -2434,7 +2434,7 @@ void ED_region_panels_layout_ex(const bContext *C,
* instead they calculate offsets for the next panel to start drawing. */
Panel *panel = ar->panels.last;
if (panel != NULL) {
int size_dyn[2] = {
const int size_dyn[2] = {
UI_UNIT_X * ((panel->flag & PNL_CLOSED) ? 8 : 14) / UI_DPI_FAC,
UI_panel_size_y(panel) / UI_DPI_FAC,
};

View File

@ -869,15 +869,19 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups,
return alpha_overlay_active;
}
BLI_INLINE void draw_tri_point(
unsigned int pos, float sel_col[4], float pivot_col[4], float *co, float width, bool selected)
BLI_INLINE void draw_tri_point(unsigned int pos,
const float sel_col[4],
float pivot_col[4],
float *co,
float width,
bool selected)
{
immUniformColor4fv(selected ? sel_col : pivot_col);
GPU_line_width(3.0f);
float w = width / 2.0f;
float tri[3][2] = {
const float tri[3][2] = {
{co[0], co[1] + w},
{co[0] - w, co[1] - w},
{co[0] + w, co[1] - w},
@ -899,8 +903,12 @@ BLI_INLINE void draw_tri_point(
immEnd();
}
BLI_INLINE void draw_rect_point(
unsigned int pos, float sel_col[4], float handle_col[4], float *co, float width, bool selected)
BLI_INLINE void draw_rect_point(unsigned int pos,
const float sel_col[4],
float handle_col[4],
float *co,
float width,
bool selected)
{
immUniformColor4fv(selected ? sel_col : handle_col);
@ -1087,8 +1095,8 @@ static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush)
static void cursor_draw_point_screen_space(const uint gpuattr,
const ARegion *ar,
float true_location[3],
float obmat[4][4])
const float true_location[3],
const float obmat[4][4])
{
float translation_vertex_cursor[3], location[3];
copy_v3_v3(location, true_location);
@ -1100,7 +1108,7 @@ static void cursor_draw_point_screen_space(const uint gpuattr,
static void cursor_draw_tiling_preview(const uint gpuattr,
const ARegion *ar,
float true_location[3],
const float true_location[3],
Sculpt *sd,
Object *ob,
float radius)

View File

@ -5212,8 +5212,10 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool),
float line_len_sq_inv, line_len;
float f;
float color_f[4];
float p[2] = {projPixel->projCoSS[0] - lastpos[0],
projPixel->projCoSS[1] - lastpos[1]};
const float p[2] = {
projPixel->projCoSS[0] - lastpos[0],
projPixel->projCoSS[1] - lastpos[1],
};
sub_v2_v2v2(tangent, pos, lastpos);
line_len = len_squared_v2(tangent);

View File

@ -251,7 +251,7 @@ static void imapaint_project(float matrix[4][4], const float co[3], float pco[4]
}
static void imapaint_tri_weights(float matrix[4][4],
GLint view[4],
const GLint view[4],
const float v1[3],
const float v2[3],
const float v3[3],

View File

@ -444,7 +444,7 @@ static bool is_symmetry_iteration_valid(char i, char symm)
/* Checks if a vertex is inside the brush radius from any of its mirrored axis */
static bool sculpt_is_vertex_inside_brush_radius_symm(float vertex[3],
float br_co[3],
const float br_co[3],
float radius,
char symm)
{
@ -3594,7 +3594,7 @@ static void pose_brush_init_task_cb_ex(void *__restrict userdata,
}
static bool sculpt_pose_brush_is_vertex_inside_brush_radius(float vertex[3],
float br_co[3],
const float br_co[3],
float radius,
char symm)
{

View File

@ -147,7 +147,7 @@ typedef struct Temp_UvData {
static void HC_relaxation_iteration_uv(BMEditMesh *em,
UvSculptData *sculptdata,
float mouse_coord[2],
const float mouse_coord[2],
float alpha,
float radius,
float aspectRatio)
@ -235,7 +235,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em,
static void laplacian_relaxation_iteration_uv(BMEditMesh *em,
UvSculptData *sculptdata,
float mouse_coord[2],
const float mouse_coord[2],
float alpha,
float radius,
float aspectRatio)

View File

@ -887,7 +887,7 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker)
}
static void draw_marker_slide_square(
float x, float y, float dx, float dy, int outline, float px[2], unsigned int pos)
float x, float y, float dx, float dy, int outline, const float px[2], unsigned int pos)
{
float tdx, tdy;
@ -903,7 +903,7 @@ static void draw_marker_slide_square(
}
static void draw_marker_slide_triangle(
float x, float y, float dx, float dy, int outline, float px[2], unsigned int pos)
float x, float y, float dx, float dy, int outline, const float px[2], unsigned int pos)
{
float tdx, tdy;

View File

@ -1131,7 +1131,7 @@ static void proxy_freejob(void *pjv)
static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
{
int build_count = 0;
int size_flags[2][4] = {
const int size_flags[2][4] = {
{MCLIP_PROXY_SIZE_25, MCLIP_PROXY_SIZE_50, MCLIP_PROXY_SIZE_75, MCLIP_PROXY_SIZE_100},
{MCLIP_PROXY_UNDISTORTED_SIZE_25,
MCLIP_PROXY_UNDISTORTED_SIZE_50,

View File

@ -448,8 +448,8 @@ static float mouse_to_slide_zone_distance_squared(const float co[2],
int width,
int height)
{
float pixel_co[2] = {co[0] * width, co[1] * height},
pixel_slide_zone[2] = {slide_zone[0] * width, slide_zone[1] * height};
const float pixel_co[2] = {co[0] * width, co[1] * height},
pixel_slide_zone[2] = {slide_zone[0] * width, slide_zone[1] * height};
return SQUARE(pixel_co[0] - pixel_slide_zone[0]) + SQUARE(pixel_co[1] - pixel_slide_zone[1]);
}

View File

@ -115,8 +115,8 @@ static float mouse_to_plane_slide_zone_distance_squared(const float co[2],
int width,
int height)
{
float pixel_co[2] = {co[0] * width, co[1] * height},
pixel_slide_zone[2] = {slide_zone[0] * width, slide_zone[1] * height};
const float pixel_co[2] = {co[0] * width, co[1] * height},
pixel_slide_zone[2] = {slide_zone[0] * width, slide_zone[1] * height};
return SQUARE(pixel_co[0] - pixel_slide_zone[0]) + SQUARE(pixel_co[1] - pixel_slide_zone[1]);
}

View File

@ -57,7 +57,7 @@ static float dist_to_crns(float co[2], float pos[2], float crns[4][2]);
/********************** mouse select operator *********************/
static int mouse_on_side(
float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
const float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
{
if (x1 > x2) {
SWAP(float, x1, x2);
@ -71,7 +71,7 @@ static int mouse_on_side(
}
static int mouse_on_rect(
float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
const float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
{
return mouse_on_side(
co, pos[0] + min[0], pos[1] + min[1], pos[0] + max[0], pos[1] + min[1], epsx, epsy) ||

View File

@ -1082,7 +1082,7 @@ typedef struct SetConsoleCursor {
// TODO, cursor placement without selection
static void console_cursor_set_to_pos(
SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel))
SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, const int mval[2], int UNUSED(sel))
{
int pos;
pos = console_char_pick(sc, ar, mval);

View File

@ -213,7 +213,7 @@ static void WIDGETGROUP_navigate_setup(const bContext *C, wmGizmoGroup *gzgroup)
{
wmGizmo *gz = navgroup->gz_array[GZ_INDEX_ROTATE];
gz->scale_basis = GIZMO_SIZE / 2;
char mapping[6] = {
const char mapping[6] = {
RV3D_VIEW_LEFT,
RV3D_VIEW_RIGHT,
RV3D_VIEW_FRONT,

View File

@ -479,7 +479,7 @@ static int gizmo_axis_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mv
float i_best_len_sq = FLT_MAX;
for (int i = 0; i < 3; i++) {
for (int is_pos = 0; is_pos < 2; is_pos++) {
float co[2] = {
const float co[2] = {
gz->matrix_offset[i][0] * (is_pos ? 1 : -1),
gz->matrix_offset[i][1] * (is_pos ? 1 : -1),
};

View File

@ -116,7 +116,7 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *bas
* - 'rv3d->persmatob', is_local == true
*/
static eV3DProjStatus ed_view3d_project__internal(const ARegion *ar,
float perspmat[4][4],
const float perspmat[4][4],
const bool is_local, /* normally hidden */
const float co[3],
float r_co[2],

View File

@ -1794,7 +1794,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
if (t->helpline != HLP_NONE) {
float cent[2];
float mval[3] = {
const float mval[3] = {
x,
y,
0.0f,
@ -4322,8 +4322,11 @@ static void headerRotation(TransInfo *t, char str[UI_MAX_DRAW_STR], float final)
*
* Protected axis and other transform settings are taken into account.
*/
static void ElementRotation_ex(
TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const float *center)
static void ElementRotation_ex(TransInfo *t,
TransDataContainer *tc,
TransData *td,
const float mat[3][3],
const float *center)
{
float vec[3], totmat[3][3], smat[3][3];
float eul[3], fmat[3][3], quat[4];
@ -4727,7 +4730,7 @@ static void initTrackball(TransInfo *t)
static void applyTrackballValue(TransInfo *t,
const float axis1[3],
const float axis2[3],
float angles[2])
const float angles[2])
{
float mat[3][3];
float axis[3];

View File

@ -63,8 +63,8 @@ static void bezt_to_transdata(TransData *td,
bool selected,
bool ishandle,
bool intvals,
float mtx[3][3],
float smtx[3][3],
const float mtx[3][3],
const float smtx[3][3],
float unit_scale,
float offset)
{

View File

@ -62,8 +62,8 @@ static void MaskHandleToTransData(MaskSplinePoint *point,
TransData2D *td2d,
TransDataMasking *tdm,
const float asp[2],
/*const*/ float parent_matrix[3][3],
/*const*/ float parent_inverse_matrix[3][3])
/*const*/ const float parent_matrix[3][3],
/*const*/ const float parent_inverse_matrix[3][3])
{
BezTriple *bezt = &point->bezt;
const bool is_sel_any = MASKPOINT_ISSEL_ANY(point);

View File

@ -75,7 +75,7 @@ static bool bmesh_test_dist_add(BMVert *v,
/* optionally track original index */
int *index,
const int *index_prev,
float mtx[3][3])
const float mtx[3][3])
{
if ((BM_elem_flag_test(v_other, BM_ELEM_SELECT) == 0) &&
(BM_elem_flag_test(v_other, BM_ELEM_HIDDEN) == 0)) {
@ -105,7 +105,7 @@ static bool bmesh_test_dist_add(BMVert *v,
* \param index: Optionally store the original index we're measuring the distance to (can be NULL).
*/
static void editmesh_set_connectivity_distance(BMesh *bm,
float mtx[3][3],
const float mtx[3][3],
float *dists,
int *index)
{

View File

@ -76,7 +76,7 @@ static void markerToTransDataInit(TransData *td,
MovieTrackingMarker *marker,
int area,
float loc[2],
float rel[2],
const float rel[2],
const float off[2],
const float aspect[2])
{

View File

@ -354,7 +354,7 @@ static bool raycastMesh(SnapObjectContext *sctx,
const float ray_dir[3],
Object *ob,
Mesh *me,
float obmat[4][4],
const float obmat[4][4],
const unsigned int ob_index,
bool use_hide,
/* read/write args */
@ -527,7 +527,7 @@ static bool raycastEditMesh(SnapObjectContext *sctx,
const float ray_dir[3],
Object *ob,
BMEditMesh *em,
float obmat[4][4],
const float obmat[4][4],
const unsigned int ob_index,
/* read/write args */
float *ray_depth,
@ -710,7 +710,7 @@ static bool raycastObj(SnapObjectContext *sctx,
const float ray_start[3],
const float ray_dir[3],
Object *ob,
float obmat[4][4],
const float obmat[4][4],
const unsigned int ob_index,
bool use_obedit,
bool use_occlusion_test,
@ -923,10 +923,10 @@ static bool raycastObjects(SnapObjectContext *sctx,
/* Test BoundBox */
static bool snap_bound_box_check_dist(float min[3],
float max[3],
float lpmat[4][4],
float win_size[2],
float mval[2],
const float max[3],
const float lpmat[4][4],
const float win_size[2],
const float mval[2],
float dist_px_sq)
{
/* In vertex and edges you need to get the pixel distance from ray to BoundBox,
@ -1220,7 +1220,7 @@ static void cb_snap_tri_verts(void *userdata,
static short snap_mesh_polygon(SnapObjectContext *sctx,
SnapData *snapdata,
Object *ob,
float obmat[4][4],
const float obmat[4][4],
/* read/write args */
float *dist_px,
/* return args */
@ -1362,7 +1362,7 @@ static short snap_mesh_polygon(SnapObjectContext *sctx,
static short snap_mesh_edge_verts_mixed(SnapObjectContext *sctx,
SnapData *snapdata,
Object *ob,
float obmat[4][4],
const float obmat[4][4],
float original_dist_px,
const float prev_co[3],
/* read/write args */
@ -1542,7 +1542,7 @@ static short snap_mesh_edge_verts_mixed(SnapObjectContext *sctx,
static short snapArmature(SnapData *snapdata,
Object *ob,
float obmat[4][4],
const float obmat[4][4],
bool use_obedit,
/* read/write args */
float *dist_px,
@ -1687,7 +1687,7 @@ static short snapArmature(SnapData *snapdata,
static short snapCurve(SnapData *snapdata,
Object *ob,
float obmat[4][4],
const float obmat[4][4],
bool use_obedit,
/* read/write args */
float *dist_px,
@ -1838,7 +1838,7 @@ static short snapCurve(SnapData *snapdata,
/* may extend later (for now just snaps to empty center) */
static short snapEmpty(SnapData *snapdata,
Object *ob,
float obmat[4][4],
const float obmat[4][4],
/* read/write args */
float *dist_px,
/* return args */
@ -1993,7 +1993,7 @@ static short snapMesh(SnapObjectContext *sctx,
SnapData *snapdata,
Object *ob,
Mesh *me,
float obmat[4][4],
const float obmat[4][4],
/* read/write args */
float *dist_px,
/* return args */
@ -2231,7 +2231,7 @@ static short snapEditMesh(SnapObjectContext *sctx,
SnapData *snapdata,
Object *ob,
BMEditMesh *em,
float obmat[4][4],
const float obmat[4][4],
/* read/write args */
float *dist_px,
/* return args */

View File

@ -98,7 +98,7 @@ static int uvedit_center(
}
static void uvedit_translate(
Scene *scene, Object **objects, uint objects_len, Image *ima, float delta[2])
Scene *scene, Object **objects, uint objects_len, Image *ima, const float delta[2])
{
BMFace *f;
BMLoop *l;

View File

@ -4458,7 +4458,7 @@ static int uv_select_overlap(bContext *C, const bool extend)
overlap_data[data_index].face_index = face_index;
/* BVH needs 3D, overlap data uses 2D. */
float tri[3][3] = {
const float tri[3][3] = {
{UNPACK2(uv_verts[indices[t][0]]), 0.0f},
{UNPACK2(uv_verts[indices[t][1]]), 0.0f},
{UNPACK2(uv_verts[indices[t][2]]), 0.0f},

View File

@ -1258,7 +1258,7 @@ static void uv_map_rotation_matrix_ex(float result[4][4],
float upangledeg,
float sideangledeg,
float radius,
float offset[4])
const float offset[4])
{
float rotup[4][4], rotside[4][4], viewmatrix[4][4], rotobj[4][4];
float sideangle = 0.0f, upangle = 0.0f;
@ -2035,9 +2035,9 @@ void UV_OT_reset(wmOperatorType *ot)
/****************** Sphere Project operator ***************/
static void uv_sphere_project(float target[2],
float source[3],
float center[3],
float rotmat[4][4])
const float source[3],
const float center[3],
const float rotmat[4][4])
{
float pv[3];
@ -2162,9 +2162,9 @@ void UV_OT_sphere_project(wmOperatorType *ot)
/***************** Cylinder Project operator **************/
static void uv_cylinder_project(float target[2],
float source[3],
float center[3],
float rotmat[4][4])
const float source[3],
const float center[3],
const float rotmat[4][4])
{
float pv[3];

View File

@ -954,7 +954,7 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers,
BM_face_as_array_vert_tri(f, v);
uint idx[3] = {
const uint idx[3] = {
BM_elem_index_get(v[0]), BM_elem_index_get(v[1]), BM_elem_index_get(v[2])};
GPU_indexbuf_add_tri_verts(&elb, idx[0], idx[1], idx[2]);

View File

@ -344,7 +344,7 @@ static float eval_integral(float x0, float x1, short falloff_type, float sharpne
#undef INTEGRAL_RESOLUTION
static void compute_sss_kernel(
GPUSssKernelData *kd, float radii[3], int sample_len, int falloff_type, float sharpness)
GPUSssKernelData *kd, const float radii[3], int sample_len, int falloff_type, float sharpness)
{
float rad[3];
/* Minimum radius */

View File

@ -68,7 +68,7 @@ static void imb_stereo3d_write_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyp
const int stride_from = width;
const int stride_to = width;
int anaglyph_encoding[3][3] = {
const int anaglyph_encoding[3][3] = {
{0, 1, 1},
{1, 0, 1},
{0, 0, 1},
@ -810,7 +810,7 @@ static void imb_stereo3d_read_anaglyph(Stereo3DData *s3d, enum eStereo3dAnaglyph
const int stride_from = width;
const int stride_to = width;
int anaglyph_encoding[3][3] = {
const int anaglyph_encoding[3][3] = {
{0, 1, 1},
{1, 0, 1},
{0, 0, 1},

View File

@ -268,7 +268,7 @@ static void dm_mvert_map_doubles(int *doubles_map,
static void mesh_merge_transform(Mesh *result,
Mesh *cap_mesh,
float cap_offset[4][4],
const float cap_offset[4][4],
unsigned int cap_verts_index,
unsigned int cap_edges_index,
int cap_loops_index,

View File

@ -68,8 +68,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
static Mesh *doBiscetOnMirrorPlane(
MirrorModifierData *mmd, const Mesh *mesh, int axis, float plane_co[3], float plane_no[3])
static Mesh *doBiscetOnMirrorPlane(MirrorModifierData *mmd,
const Mesh *mesh,
int axis,
const float plane_co[3],
float plane_no[3])
{
bool do_bisect_flip_axis = ((axis == 0 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_X) ||
(axis == 1 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Y) ||

View File

@ -39,7 +39,7 @@ static bNodeSocketTemplate sh_node_hue_sat_out[] = {
/* note: it would be possible to use CMP version for both nodes */
static void do_hue_sat_fac(
bNode *UNUSED(node), float *out, float hue, float sat, float val, float in[4], float fac)
bNode *UNUSED(node), float *out, float hue, float sat, float val, const float in[4], float fac)
{
if (fac != 0.0f && (hue != 0.5f || sat != 1.0f || val != 1.0f)) {
float col[3], hsv[3], mfac = 1.0f - fac;

View File

@ -172,8 +172,8 @@ void RE_bake_margin(ImBuf *ibuf, char *mask, const int margin)
*/
static void calc_point_from_barycentric_cage(TriTessFace *triangles_low,
TriTessFace *triangles_cage,
float mat_low[4][4],
float mat_cage[4][4],
const float mat_low[4][4],
const float mat_cage[4][4],
int primitive_id,
float u,
float v,
@ -214,8 +214,8 @@ static void calc_point_from_barycentric_cage(TriTessFace *triangles_low,
* The returned coordinate is extruded along the normal by cage_extrusion
*/
static void calc_point_from_barycentric_extrusion(TriTessFace *triangles,
float mat[4][4],
float imat[4][4],
const float mat[4][4],
const float imat[4][4],
int primitive_id,
float u,
float v,
@ -316,7 +316,7 @@ static bool cast_ray_highpoly(BVHTreeFromMesh *treeData,
TriTessFace *triangles[],
BakePixel *pixel_array_low,
BakePixel *pixel_array,
float mat_low[4][4],
const float mat_low[4][4],
BakeHighPolyData *highpoly,
const float co[3],
const float dir[3],

View File

@ -77,8 +77,11 @@ static GHOST_TStandardCursor convert_cursor(int curs)
}
}
static void window_set_custom_cursor(
wmWindow *win, unsigned char mask[16][2], unsigned char bitmap[16][2], int hotx, int hoty)
static void window_set_custom_cursor(wmWindow *win,
unsigned const char mask[16][2],
unsigned char bitmap[16][2],
int hotx,
int hoty)
{
GHOST_SetCustomCursorShape(
win->ghostwin, (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 16, 16, hotx, hoty, true);