From 0547a7753643f45861306542857d97215ecb2c4f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Sep 2019 08:10:50 +1000 Subject: Cleanup: use const args, variables --- .../editors/gizmo_library/gizmo_library_presets.c | 4 ++-- .../gizmo_library/gizmo_types/dial3d_gizmo.c | 2 +- source/blender/editors/gpencil/annotate_draw.c | 2 +- source/blender/editors/gpencil/drawgpencil.c | 7 ++++-- source/blender/editors/gpencil/gpencil_brush.c | 11 +++++---- source/blender/editors/gpencil/gpencil_edit.c | 2 +- source/blender/editors/gpencil/gpencil_select.c | 2 +- source/blender/editors/gpencil/gpencil_utils.c | 8 +++---- source/blender/editors/interface/interface_icons.c | 2 +- .../blender/editors/interface/interface_widgets.c | 6 ++--- source/blender/editors/mesh/editmesh_add_gizmo.c | 2 +- source/blender/editors/mesh/meshtools.c | 2 +- source/blender/editors/object/object_transform.c | 2 +- source/blender/editors/object/object_vgroup.c | 4 ++-- source/blender/editors/object/object_warp.c | 6 ++--- source/blender/editors/physics/particle_edit.c | 4 ++-- source/blender/editors/physics/particle_object.c | 4 ++-- source/blender/editors/screen/area.c | 4 ++-- source/blender/editors/sculpt_paint/paint_cursor.c | 24 ++++++++++++------- .../editors/sculpt_paint/paint_image_proj.c | 6 +++-- source/blender/editors/sculpt_paint/paint_utils.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- source/blender/editors/sculpt_paint/sculpt_uv.c | 4 ++-- source/blender/editors/space_clip/clip_draw.c | 4 ++-- source/blender/editors/space_clip/clip_ops.c | 2 +- source/blender/editors/space_clip/tracking_ops.c | 4 ++-- .../editors/space_clip/tracking_ops_plane.c | 4 ++-- .../blender/editors/space_clip/tracking_select.c | 4 ++-- source/blender/editors/space_console/console_ops.c | 2 +- .../editors/space_view3d/view3d_gizmo_navigate.c | 2 +- .../space_view3d/view3d_gizmo_navigate_type.c | 2 +- .../blender/editors/space_view3d/view3d_project.c | 2 +- source/blender/editors/transform/transform.c | 11 +++++---- .../editors/transform/transform_convert_graph.c | 4 ++-- .../editors/transform/transform_convert_mask.c | 4 ++-- .../editors/transform/transform_convert_mesh.c | 4 ++-- .../editors/transform/transform_convert_tracking.c | 2 +- .../editors/transform/transform_snap_object.c | 28 +++++++++++----------- source/blender/editors/uvedit/uvedit_buttons.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 14 +++++------ 41 files changed, 115 insertions(+), 96 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/gizmo_library/gizmo_library_presets.c b/source/blender/editors/gizmo_library/gizmo_library_presets.c index 59c5b758e1b..fe0893ae3ff 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_presets.c +++ b/source/blender/editors/gizmo_library/gizmo_library_presets.c @@ -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) { diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 6d8ab096a26..d3121711e28 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -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) diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index 683ee7fb973..67bf64a2903 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -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; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 4015fa12438..80795b825b0 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -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]; diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 89cb85b0e17..2a2e7c21df4 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -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); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 1834261e1bf..96302bcbe63 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -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) diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index f4484624d5a..b7b73c1b501 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -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) { diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 3ee7aed0a02..89a2a987f60 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -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; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 104b41491c2..b844e237366 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -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]; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index a0bb4de96ea..0ee2ed0f338 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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], diff --git a/source/blender/editors/mesh/editmesh_add_gizmo.c b/source/blender/editors/mesh/editmesh_add_gizmo.c index f6729fb56e1..66832ceba7f 100644 --- a/source/blender/editors/mesh/editmesh_add_gizmo.c +++ b/source/blender/editors/mesh/editmesh_add_gizmo.c @@ -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]), diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 8d9d0e40f44..c68f5963cbd 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -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, diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 9b5342fc797..1cd16b1b0bf 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -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]) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index ce385b12608..d703cdfecb3 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -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, diff --git a/source/blender/editors/object/object_warp.c b/source/blender/editors/object/object_warp.c index 3a089acb330..836e38e3676 100644 --- a/source/blender/editors/object/object_warp.c +++ b/source/blender/editors/object/object_warp.c @@ -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, diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 7a781999dfc..2047ecb9e0a 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -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); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 12eb433a3dd..5a2009845f8 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -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) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 2ad512851b1..cb87b076d79 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -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, }; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 9464bdb901e..5c83bdf0012 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -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) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 397b2981ace..04a54ad5137 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -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); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 6919536043f..6459325e6ee 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -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], diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fd45d1a17bc..351e4c0482b 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -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) { diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 251dddf6d78..de03fea7bb1 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -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) diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index e3fa8edd714..e96dc91cedb 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -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; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index bc1026180a3..da534cf9b40 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -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, diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1375b99bdaa..68198acfe52 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -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]); } diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c index b1bf88634bc..7d2324d3f48 100644 --- a/source/blender/editors/space_clip/tracking_ops_plane.c +++ b/source/blender/editors/space_clip/tracking_ops_plane.c @@ -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]); } diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 4532b61f291..f6063b49005 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -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) || diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index faf613482a3..bc18a6cfb56 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -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); diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c index ec7d1fc85f1..53a5609d437 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c @@ -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, diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 539b5d93bdf..b5b924c7f4a 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -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), }; diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index b81b7e0109e..56c8b4bcbe9 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -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], diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8839abe70a2..a95c7cf7456 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -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]; diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c index c3afbb9b7ba..3eb4d220cb0 100644 --- a/source/blender/editors/transform/transform_convert_graph.c +++ b/source/blender/editors/transform/transform_convert_graph.c @@ -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) { diff --git a/source/blender/editors/transform/transform_convert_mask.c b/source/blender/editors/transform/transform_convert_mask.c index 9e892f395b3..32152442acf 100644 --- a/source/blender/editors/transform/transform_convert_mask.c +++ b/source/blender/editors/transform/transform_convert_mask.c @@ -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); diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index acbe2c5f06a..9c46094ee83 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -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) { diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index d7275f1fbf9..b68b79adbd8 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -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]) { diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 76797339cea..9c2642a46c1 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -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 */ diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index 2abbe67237e..44bffc76859 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -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; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index cd7e5f9ba09..57e2a84d248 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -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}, diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 2d8f40ea5af..1db038bef94 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -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]; -- cgit v1.2.3