diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-07 15:56:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-07 15:56:13 +0300 |
commit | 48e089375ebe4aeb30d60e9d8ef6f467280cf07d (patch) | |
tree | af4675f9b8489fb49b68a9a9d977a098e645f640 /source/blender/editors | |
parent | b134434224254d4ac3fc73d023f2f6d914746690 (diff) |
Cleanup: pass arrays const where possible
Diffstat (limited to 'source/blender/editors')
27 files changed, 69 insertions, 39 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 72ea52314b9..69a05c9ae31 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1716,7 +1716,10 @@ static bool isNurbselV(Nurb *nu, int *u, int flag) return 1; } -static void rotateflagNurb(ListBase *editnurb, short flag, const float cent[3], float rotmat[3][3]) +static void rotateflagNurb(ListBase *editnurb, + short flag, + const float cent[3], + const float rotmat[3][3]) { /* all verts with (flag & 'flag') rotate */ Nurb *nu; diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index b45a324bc67..30e4fe0b531 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -271,7 +271,7 @@ static void annotation_get_3d_reference(tGPsdata *p, float vec[3]) /* Stroke Editing ---------------------------- */ /* check if the current mouse position is suitable for adding a new point */ -static bool annotation_stroke_filtermval(tGPsdata *p, const float mval[2], float pmval[2]) +static bool annotation_stroke_filtermval(tGPsdata *p, const float mval[2], const float pmval[2]) { int dx = (int)fabsf(mval[0] - pmval[0]); int dy = (int)fabsf(mval[1] - pmval[1]); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index de58a0916b2..611fe158948 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -362,7 +362,7 @@ static void gpencil_get_3d_reference(tGPsdata *p, float vec[3]) /* Stroke Editing ---------------------------- */ /* check if the current mouse position is suitable for adding a new point */ -static bool gpencil_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2]) +static bool gpencil_stroke_filtermval(tGPsdata *p, const float mval[2], const float mvalo[2]) { Brush *brush = p->brush; int dx = (int)fabsf(mval[0] - mvalo[0]); @@ -3269,7 +3269,7 @@ static void gpencil_brush_angle_segment(tGPsdata *p, tGPspoint *pt_prev, tGPspoi * + PtA - 1 * / * CTL is the vertice of the triangle created between PtA and PtB */ -static void gpencil_add_arc_points(tGPsdata *p, float mval[2], int segments) +static void gpencil_add_arc_points(tGPsdata *p, const float mval[2], int segments) { bGPdata *gpd = p->gpd; BrushGpencilSettings *brush_settings = p->brush->gpencil_settings; diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index f44dbd1a752..28ea9535a80 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -378,7 +378,10 @@ static void gpencil_primitive_add_segment(tGPDprimitive *tgpi) } /* Helper: set control point */ -static void gpencil_primitive_set_cp(tGPDprimitive *tgpi, float p[2], float color[4], int size) +static void gpencil_primitive_set_cp(tGPDprimitive *tgpi, + const float p[2], + float color[4], + int size) { if (tgpi->flag == IN_PROGRESS) { return; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 339e97bd71c..aaf88e1a0b0 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1723,7 +1723,7 @@ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob) /* Cursor drawing */ /* check if cursor is in drawing region */ -static bool gpencil_check_cursor_region(bContext *C, int mval_i[2]) +static bool gpencil_check_cursor_region(bContext *C, const int mval_i[2]) { ARegion *region = CTX_wm_region(C); ScrArea *area = CTX_wm_area(C); @@ -2311,7 +2311,9 @@ static void gpencil_insert_point( MEM_SAFE_FREE(temp_points); } -static float gpencil_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2]) +static float gpencil_calc_factor(const float p2d_a1[2], + const float p2d_a2[2], + const float r_hit2d[2]) { float dist1 = len_squared_v2v2(p2d_a1, p2d_a2); float dist2 = len_squared_v2v2(p2d_a1, r_hit2d); diff --git a/source/blender/editors/interface/interface_eyedropper_gpencil_color.c b/source/blender/editors/interface/interface_eyedropper_gpencil_color.c index 978d8ac09de..aa5b4d2c255 100644 --- a/source/blender/editors/interface/interface_eyedropper_gpencil_color.c +++ b/source/blender/editors/interface/interface_eyedropper_gpencil_color.c @@ -106,8 +106,11 @@ static void eyedropper_gpencil_exit(bContext *C, wmOperator *op) MEM_SAFE_FREE(op->customdata); } -static void eyedropper_add_material( - bContext *C, float col_conv[4], const bool only_stroke, const bool only_fill, const bool both) +static void eyedropper_add_material(bContext *C, + const float col_conv[4], + const bool only_stroke, + const bool only_fill, + const bool both) { Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); @@ -193,7 +196,7 @@ static void eyedropper_add_material( } /* Create a new palette color and palette if needed. */ -static void eyedropper_add_palette_color(bContext *C, float col_conv[4]) +static void eyedropper_add_palette_color(bContext *C, const float col_conv[4]) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 89a90dcf12d..62c646a81e4 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -343,8 +343,11 @@ static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e) return (edbm_ripsel_edge_uid_step(e, &v_test)) ? e->v1 : e->v2; } -static void edbm_ripsel_deselect_helper( - BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *region, float projectMat[4][4], float fmval[2]) +static void edbm_ripsel_deselect_helper(BMesh *bm, + EdgeLoopPair *eloop_pairs, + ARegion *region, + float projectMat[4][4], + const float fmval[2]) { EdgeLoopPair *lp; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index e559d2120e2..f0d01305e96 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -875,7 +875,7 @@ BLI_INLINE void draw_rect_point(uint pos, imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy); } -BLI_INLINE void draw_bezier_handle_lines(uint pos, float sel_col[4], BezTriple *bez) +BLI_INLINE void draw_bezier_handle_lines(uint pos, const float sel_col[4], BezTriple *bez) { immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); GPU_line_width(3.0f); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index fa9a0854112..d16c66848b8 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -2928,7 +2928,7 @@ static void project_bucket_clip_face(const bool is_ortho, /* checks if pt is inside a convex 2D polyline, the polyline must be ordered rotating clockwise * otherwise it would have to test for mixed (line_point_side_v2 > 0.0f) cases */ -static bool IsectPoly2Df(const float pt[2], float uv[][2], const int tot) +static bool IsectPoly2Df(const float pt[2], const float uv[][2], const int tot) { int i; if (line_point_side_v2(uv[tot - 1], uv[0], pt) < 0.0f) { @@ -2943,7 +2943,7 @@ static bool IsectPoly2Df(const float pt[2], float uv[][2], const int tot) return true; } -static bool IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot) +static bool IsectPoly2Df_twoside(const float pt[2], const float uv[][2], const int tot) { const bool side = (line_point_side_v2(uv[tot - 1], uv[0], pt) > 0.0f); diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index c255cbcaaab..7e5825835fb 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -389,7 +389,7 @@ typedef struct LassoMaskData { * Lasso select. This could be defined as part of #VIEW3D_OT_select_lasso, * still the shortcuts conflict, so we will use a separate operator. */ -static bool is_effected_lasso(LassoMaskData *data, float co[3]) +static bool is_effected_lasso(LassoMaskData *data, const float co[3]) { float scr_co_f[2]; int scr_co_s[2]; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index b9361726826..38a09cd97bd 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -1198,7 +1198,10 @@ static void paint_line_strokes_spacing(bContext *C, *length_residue = length; } -static void paint_stroke_line_end(bContext *C, wmOperator *op, PaintStroke *stroke, float mouse[2]) +static void paint_stroke_line_end(bContext *C, + wmOperator *op, + PaintStroke *stroke, + const float mouse[2]) { Brush *br = stroke->brush; if (stroke->stroke_started && (br->flag & BRUSH_LINE)) { diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index af5afa80eb8..b7e5a73cbb3 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -238,7 +238,7 @@ void paint_stroke_operator_properties(wmOperatorType *ot) /* 3D Paint */ -static void imapaint_project(float matrix[4][4], const float co[3], float pco[4]) +static void imapaint_project(const float matrix[4][4], const float co[3], float pco[4]) { copy_v3_v3(pco, co); pco[3] = 1.0f; diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 71f75d96cb1..80ce07d39ef 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -273,7 +273,7 @@ typedef struct { int marker_flag; } MarkerUpdateCb; -static void to_pixel_space(float r[2], float a[2], int width, int height) +static void to_pixel_space(float r[2], const float a[2], int width, int height) { copy_v2_v2(r, a); r[0] *= width; diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index c3aca95910b..c7328ae9f8f 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -49,7 +49,9 @@ #include "clip_intern.h" /* own include */ -static void track_channel_color(MovieTrackingTrack *track, float default_color[3], float color[3]) +static void track_channel_color(MovieTrackingTrack *track, + const float default_color[3], + float color[3]) { if (track->flag & TRACK_CUSTOMCOLOR) { float bg[3]; diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 63d9889e662..ffd3241a30f 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -178,7 +178,7 @@ static void mouse_select_init_data(bContext *C, MouseSelectUserData *userdata, c copy_v2_v2(userdata->mouse_co, co); } -static bool mouse_select_knot(bContext *C, float co[2], bool extend) +static bool mouse_select_knot(bContext *C, const float co[2], bool extend) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); @@ -236,7 +236,7 @@ static bool mouse_select_knot(bContext *C, float co[2], bool extend) return false; } -static bool mouse_select_curve(bContext *C, float co[2], bool extend) +static bool mouse_select_curve(bContext *C, const float co[2], bool extend) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index 615d09a04b2..80d0dd773b2 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -744,7 +744,9 @@ static int point_inside_ellipse(const float point[2], return x * x + y * y < 1.0f; } -static int marker_inside_ellipse(MovieTrackingMarker *marker, float offset[2], float ellipse[2]) +static int marker_inside_ellipse(MovieTrackingMarker *marker, + const float offset[2], + const float ellipse[2]) { return point_inside_ellipse(marker->pos, offset, ellipse); } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 96599fd92a7..97939a93d01 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -378,7 +378,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uin } /* helper call to setup dashed-lines for strip outlines */ -static uint nla_draw_use_dashed_outlines(float color[4], bool muted) +static uint nla_draw_use_dashed_outlines(const float color[4], bool muted) { /* Note that we use dashed shader here, and make it draw solid lines if not muted... */ uint shdr_pos = GPU_vertformat_attr_add( diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 9110d82fb84..a09c70b794a 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -1004,7 +1004,7 @@ void NODE_OT_link_make(wmOperatorType *ot) } /* ********************** Cut Link operator ***************** */ -static bool cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot) +static bool cut_links_intersect(bNodeLink *link, const float mcoords[][2], int tot) { float coord_array[NODE_LINK_RESOL + 1][2]; int i, b; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index f17d7ccd136..1ffa653372c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -69,7 +69,7 @@ static const float cosval[CIRCLE_RESOL] = { 0.82076344, 0.91895781, 0.97952994, 1.00000000, }; -static void circball_array_fill(float verts[CIRCLE_RESOL][3], +static void circball_array_fill(const float verts[CIRCLE_RESOL][3], const float cent[3], float rad, const float tmat[4][4]) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 19aa9cb203b..ac9d12cdd58 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2500,7 +2500,10 @@ static bool viewdolly_offset_lock_check(bContext *C, wmOperator *op) return false; } -static void view_dolly_to_vector_3d(ARegion *region, float orig_ofs[3], float dvec[3], float dfac) +static void view_dolly_to_vector_3d(ARegion *region, + const float orig_ofs[3], + const float dvec[3], + float dfac) { RegionView3D *rv3d = region->regiondata; madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac)); diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index b79632f0a82..a828dbc2ee0 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -246,7 +246,7 @@ static bool idp_poject_surface_normal(SnapObjectContext *snap_context, /** \name Primitive Drawing (Cube, Cone, Cylinder...) * \{ */ -static void draw_line_loop(float coords[][3], int coords_len, const float color[4]) +static void draw_line_loop(const float coords[][3], int coords_len, const float color[4]) { GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); @@ -279,7 +279,7 @@ static void draw_line_loop(float coords[][3], int coords_len, const float color[ GPU_blend(false); } -static void draw_line_pairs(float coords_a[][3], +static void draw_line_pairs(const float coords_a[][3], float coords_b[][3], int coords_len, const float color[4]) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index e15239f37d4..d0e37f22236 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -388,7 +388,7 @@ void transform_constraint_snap_axis_to_face(const TransInfo *t, * Return true if the 2x axis are both aligned when projected into the view. * In this case, we can't usefully project the cursor onto the plane. */ -static bool isPlaneProjectionViewAligned(const TransInfo *t, float plane[4]) +static bool isPlaneProjectionViewAligned(const TransInfo *t, const float plane[4]) { const float eps = 0.001f; float view_to_plane[3]; diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 38d49ab5efd..495c21bc755 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -178,7 +178,7 @@ static void protectedRotateBits(short protectflag, float eul[3], const float old /* this function only does the delta rotation */ /* axis-angle is usually internally stored as quats... */ static void protectedAxisAngleBits( - short protectflag, float axis[3], float *angle, float oldAxis[3], float oldAngle) + short protectflag, float axis[3], float *angle, const float oldAxis[3], float oldAngle) { /* check that protection flags are set */ if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0) { @@ -896,7 +896,7 @@ void headerResize(TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR]) * * \note this is a tricky area, before making changes see: T29633, T42444 */ -static void TransMat3ToSize(float mat[3][3], float smat[3][3], float size[3]) +static void TransMat3ToSize(const float mat[3][3], const float smat[3][3], float size[3]) { float rmat[3][3]; diff --git a/source/blender/editors/transform/transform_mode_bbone_resize.c b/source/blender/editors/transform/transform_mode_bbone_resize.c index 2c2253630c0..80a5b307a91 100644 --- a/source/blender/editors/transform/transform_mode_bbone_resize.c +++ b/source/blender/editors/transform/transform_mode_bbone_resize.c @@ -87,7 +87,10 @@ static void headerBoneSize(TransInfo *t, const float vec[3], char str[UI_MAX_DRA } } -static void ElementBoneSize(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3]) +static void ElementBoneSize(TransInfo *t, + TransDataContainer *tc, + TransData *td, + const float mat[3][3]) { float tmat[3][3], smat[3][3], oldy; float sizemat[3][3]; diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 8079795d306..50b7c6d147b 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -1302,11 +1302,11 @@ static bool test_projected_edge_dist(const struct DistProjectedAABBPrecalc *prec * \{ */ typedef void (*Nearest2DGetVertCoCallback)(const int index, const float **co, void *data); -typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, int v_index[2], void *data); -typedef void (*Nearest2DGetTriVertsCallback)(const int index, int v_index[3], void *data); +typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, const int v_index[2], void *data); +typedef void (*Nearest2DGetTriVertsCallback)(const int index, const int v_index[3], void *data); /* Equal the previous one */ -typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data); -typedef void (*Nearest2DCopyVertNoCallback)(const int index, float r_no[3], void *data); +typedef void (*Nearest2DGetTriEdgesCallback)(const int index, const int e_index[3], void *data); +typedef void (*Nearest2DCopyVertNoCallback)(const int index, const float r_no[3], void *data); typedef struct Nearest2dUserData { void *userdata; diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index a4ee9a294fe..8e079dcac94 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -497,7 +497,7 @@ static void p_chart_uv_translate(PChart *chart, const float trans[2]) } } -static void p_chart_uv_transform(PChart *chart, float mat[2][2]) +static void p_chart_uv_transform(PChart *chart, const float mat[2][2]) { PVert *v; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index f649ee528d4..f3ea7456c38 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -323,7 +323,10 @@ static int getNumOfIslandUvs(UvElementMap *elementMap, int island) return elementMap->islandIndices[island + 1] - elementMap->islandIndices[island]; } -static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2], float aspect) +static void stitch_uv_rotate(const float mat[2][2], + const float medianPoint[2], + float uv[2], + float aspect) { float uv_rotation_result[2]; |