Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-08-07 15:36:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-08-07 15:37:39 +0300
commitb134434224254d4ac3fc73d023f2f6d914746690 (patch)
treeb67d2c5aee982495d55848414c362665a37476b0 /source/blender/editors
parent3db67fd670535c0a709ec6e8204fcb730cd3eb0d (diff)
Cleanup: declare arrays arrays where possible
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/curve/editcurve_add.c8
-rw-r--r--source/blender/editors/curve/editfont.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c2
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_mesh.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c6
-rw-r--r--source/blender/editors/interface/interface_draw.c24
-rw-r--r--source/blender/editors/interface/interface_eyedropper_color.c4
-rw-r--r--source/blender/editors/interface/interface_eyedropper_colorband.c4
-rw-r--r--source/blender/editors/interface/interface_handlers.c4
-rw-r--r--source/blender/editors/interface/interface_icons_event.c2
-rw-r--r--source/blender/editors/interface/interface_style.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c8
-rw-r--r--source/blender/editors/mask/mask_draw.c2
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_spin.c2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c2
-rw-r--r--source/blender/editors/object/object_add.c2
-rw-r--r--source/blender/editors/object/object_remesh.c6
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/screen/area.c2
-rw-r--r--source/blender/editors/screen/glutil.c14
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_detail.c6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_mesh.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_mask_expand.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c8
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c6
-rw-r--r--source/blender/editors/space_clip/tracking_select.c8
-rw-r--r--source/blender/editors/space_image/image_draw.c12
-rw-r--r--source/blender/editors/space_info/info_draw.c4
-rw-r--r--source/blender/editors/space_info/textview.c2
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c8
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c2
-rw-r--r--source/blender/editors/transform/transform_convert_mesh.c3
-rw-r--r--source/blender/editors/transform/transform_gizmo_2d.c6
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c2
-rw-r--r--source/blender/editors/transform/transform_gizmo_extrude_3d.c2
-rw-r--r--source/blender/editors/transform/transform_mode_edge_slide.c4
-rw-r--r--source/blender/editors/transform/transform_mode_vert_slide.c6
-rw-r--r--source/blender/editors/transform/transform_snap_object.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c2
65 files changed, 141 insertions, 138 deletions
diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c
index bacdd5b69b5..75d90df3291 100644
--- a/source/blender/editors/curve/editcurve_add.c
+++ b/source/blender/editors/curve/editcurve_add.c
@@ -397,8 +397,8 @@ Nurb *ED_curve_add_nurbs_primitive(
break;
case CU_PRIM_SPHERE: /* sphere */
if (cutype == CU_NURBS) {
- float tmp_cent[3] = {0.f, 0.f, 0.f};
- float tmp_vec[3] = {0.f, 0.f, 1.f};
+ const float tmp_cent[3] = {0.f, 0.f, 0.f};
+ const float tmp_vec[3] = {0.f, 0.f, 1.f};
nu->pntsu = 5;
nu->pntsv = 1;
@@ -451,8 +451,8 @@ Nurb *ED_curve_add_nurbs_primitive(
break;
case CU_PRIM_DONUT: /* torus */
if (cutype == CU_NURBS) {
- float tmp_cent[3] = {0.f, 0.f, 0.f};
- float tmp_vec[3] = {0.f, 0.f, 1.f};
+ const float tmp_cent[3] = {0.f, 0.f, 0.f};
+ const float tmp_vec[3] = {0.f, 0.f, 1.f};
xzproj = 1;
nu = ED_curve_add_nurbs_primitive(C, obedit, mat, CU_NURBS | CU_PRIM_CIRCLE, 0);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index d78c543f94b..4529209b297 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -648,7 +648,7 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, const
int nchars = 0, nbytes = 0;
char *s;
int a;
- float rot[3] = {0.f, 0.f, 0.f};
+ const float rot[3] = {0.f, 0.f, 0.f};
obedit = BKE_object_add(bmain, scene, view_layer, OB_FONT, NULL);
base = view_layer->basact;
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index f31e004264c..341f43d0662 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -239,7 +239,7 @@ static int gizmo_arrow_test_select(bContext *UNUSED(C), wmGizmo *gz, const int m
WM_gizmo_calc_matrix_final(gz, matrix_final);
/* Arrow in pixel space. */
- float arrow_start[2] = {matrix_final[3][0], matrix_final[3][1]};
+ const float arrow_start[2] = {matrix_final[3][0], matrix_final[3][1]};
float arrow_end[2];
{
float co[3] = {0, 0, arrow_length};
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index 04b93f35681..c5231b3cd96 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -99,7 +99,7 @@ static void button2d_geom_draw_backdrop(const wmGizmo *gz,
else {
/* Draw fill. */
if ((fill_alpha != 0.0f) || (select == true)) {
- float fill_color[4] = {UNPACK3(color), fill_alpha * color[3]};
+ const float fill_color[4] = {UNPACK3(color), fill_alpha * color[3]};
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(fill_color);
imm_draw_circle_fill_2d(pos, 0, 0, 1.0f, CIRCLE_RESOLUTION);
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 8955a666e22..0bc65fe10a5 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -257,7 +257,7 @@ static void cage3d_draw_circle_handles(const RegionView3D *rv3d,
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3fv(color);
- float sign[3] = {-1.0f, 0.0f, 1.0f};
+ const float sign[3] = {-1.0f, 0.0f, 1.0f};
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index ab83abb6b37..b45a324bc67 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -573,14 +573,14 @@ static short annotation_stroke_addpoint(tGPsdata *p,
/* Arrow end corner. */
if (gpd->runtime.sbuffer_sflag & GP_STROKE_USE_ARROW_END) {
pt++;
- float e_heading[2] = {start[0] - end[0], start[1] - end[1]};
+ const float e_heading[2] = {start[0] - end[0], start[1] - end[1]};
/* Calculate points for ending arrow. */
annotation_stroke_arrow_calc_points(
pt, e_heading, end, gpd->runtime.arrow_end, gpd->runtime.arrow_end_style);
}
/* Arrow start corner. */
if (gpd->runtime.sbuffer_sflag & GP_STROKE_USE_ARROW_START) {
- float s_heading[2] = {end[0] - start[0], end[1] - start[1]};
+ const float s_heading[2] = {end[0] - start[0], end[1] - start[1]};
/* Calculate points for starting arrow. */
annotation_stroke_arrow_calc_points(
NULL, s_heading, start, gpd->runtime.arrow_start, gpd->runtime.arrow_start_style);
@@ -704,7 +704,7 @@ static void annotation_stroke_arrow_init_point(
tGPsdata *p, tGPspoint *ptc, bGPDspoint *pt, const float co[8], const int co_idx)
{
/* Note: provided co_idx should be always pair number as it's [x1, y1, x2, y2, x3, y3]. */
- float real_co[2] = {co[co_idx], co[co_idx + 1]};
+ const float real_co[2] = {co[co_idx], co[co_idx + 1]};
copy_v2_v2(&ptc->x, real_co);
annotation_stroke_convertcoords(p, &ptc->x, &pt->x, NULL);
annotation_stroke_arrow_init_point_default(pt);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 9658dc04b52..99e98df3397 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3376,7 +3376,7 @@ static void gpencil_stroke_join_strokes(bGPDstroke *gps_a,
bGPDspoint point;
bGPDspoint *pt;
int i;
- float delta[3] = {1.0f, 1.0f, 1.0f};
+ const float delta[3] = {1.0f, 1.0f, 1.0f};
float deltatime = 0.0f;
/* sanity checks */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 7db25ef817b..a70bbfc9d48 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -456,7 +456,7 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
GPU_matrix_set(tgpf->rv3d->viewmat);
/* draw strokes */
- float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f};
+ const float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f};
gpencil_draw_datablock(tgpf, ink);
GPU_matrix_pop_projection();
diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c
index 11f42f7d3ac..a6088e31ff8 100644
--- a/source/blender/editors/gpencil/gpencil_mesh.c
+++ b/source/blender/editors/gpencil/gpencil_mesh.c
@@ -196,7 +196,7 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op)
bool newob = false;
if (STREQ(target, "*NEW")) {
ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
- float loc[3] = {0.0f, 0.0f, 0.0f};
+ const float loc[3] = {0.0f, 0.0f, 0.0f};
ob_gpencil = ED_gpencil_add_object(C, loc, local_view_bits);
newob = true;
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 9ec04bbb553..de58a0916b2 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -519,7 +519,7 @@ static void gpencil_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const
/* default angle of brush in radians */
float angle = brush->gpencil_settings->draw_angle;
/* angle vector of the brush with full thickness */
- float v0[2] = {cos(angle), sin(angle)};
+ const float v0[2] = {cos(angle), sin(angle)};
/* Apply to first point (only if there are 2 points because before no data to do it ) */
if (gpd->runtime.sbuffer_used == 1) {
@@ -3247,7 +3247,7 @@ static void gpencil_brush_angle_segment(tGPsdata *p, tGPspoint *pt_prev, tGPspoi
float fac;
/* angle vector of the brush with full thickness */
- float v0[2] = {cos(angle), sin(angle)};
+ const float v0[2] = {cos(angle), sin(angle)};
mvec[0] = pt->x - pt_prev->x;
mvec[1] = pt->y - pt_prev->y;
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index f2ccbd6d2cf..339e97bd71c 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1080,7 +1080,7 @@ void ED_gpencil_project_stroke_to_plane(const Scene *scene,
}
}
else {
- float scale[3] = {1.0f, 1.0f, 1.0f};
+ const float scale[3] = {1.0f, 1.0f, 1.0f};
plane_normal[2] = 1.0f;
float mat[4][4];
loc_eul_size_to_mat4(mat, cursor->location, cursor->rotation_euler, scale);
@@ -1285,7 +1285,7 @@ void ED_gpencil_project_point_to_plane(const Scene *scene,
}
}
else {
- float scale[3] = {1.0f, 1.0f, 1.0f};
+ const float scale[3] = {1.0f, 1.0f, 1.0f};
plane_normal[2] = 1.0f;
float mat[4][4];
loc_eul_size_to_mat4(mat, cursor->location, cursor->rotation_euler, scale);
@@ -1469,7 +1469,7 @@ void ED_gpencil_reset_layers_parent(Depsgraph *depsgraph, Object *obact, bGPdata
/* Helper function to create new OB_GPENCIL Object */
Object *ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view_bits)
{
- float rot[3] = {0.0f};
+ const float rot[3] = {0.0f};
Object *ob = ED_object_add_type(C, OB_GPENCIL, NULL, loc, rot, false, local_view_bits);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index df11a78e657..05f6e61ff40 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -840,7 +840,7 @@ static void draw_scope_end(const rctf *rect, GLint *scissor)
/* outline */
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
UI_draw_roundbox_4fv(
false, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f, color);
}
@@ -858,7 +858,7 @@ static void histogram_draw_one(float r,
const bool is_line,
uint pos_attr)
{
- float color[4] = {r, g, b, alpha};
+ const float color[4] = {r, g, b, alpha};
/* that can happen */
if (res == 0) {
@@ -1032,7 +1032,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
Scopes *scopes = (Scopes *)but->poin;
int scissor[4];
float colors[3][3];
- float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
+ const float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
/* colors pre multiplied by alpha for speed up */
float colors_alpha[3][3], colorsycc_alpha[3][3];
float min, max;
@@ -1172,7 +1172,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
/* LUMA (1 channel) */
if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
- float col[3] = {alpha, alpha, alpha};
+ const float col[3] = {alpha, alpha, alpha};
GPU_matrix_push();
GPU_matrix_translate_2f(rect.xmin, yofs);
@@ -1465,7 +1465,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
if (scopes->ok && scopes->vecscope != NULL) {
/* pixel point cloud */
- float col[3] = {alpha, alpha, alpha};
+ const float col[3] = {alpha, alpha, alpha};
GPU_blend_set_func(GPU_ONE, GPU_ONE);
GPU_point_size(1.0);
@@ -1773,7 +1773,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const
void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
{
/* sphere color */
- float diffuse[3] = {1.0f, 1.0f, 1.0f};
+ const float diffuse[3] = {1.0f, 1.0f, 1.0f};
float light[3];
const float size = 0.5f * min_ff(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
@@ -1937,7 +1937,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol,
/* Do this first to not mess imm context */
if (but->a1 == UI_GRAD_H) {
/* magic trigger for curve backgrounds */
- float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
+ const float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
rcti grid = {
.xmin = rect->xmin + zoomx * (-offsx),
@@ -2483,7 +2483,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
(rect.ymax + 1) - (rect.ymin - 1));
if (scopes->track_disabled) {
- float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
+ const float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
@@ -2532,7 +2532,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
float col_sel[4], col_outline[4];
if (scopes->use_track_mask) {
- float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
@@ -2565,7 +2565,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
/* Do stipple cross with geometry */
immBegin(GPU_PRIM_LINES, 7 * 2 * 2);
- float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f};
+ const float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f};
for (int axe = 0; axe < 2; axe++) {
for (int i = 0; i < 7; i++) {
float x1 = pos_sel[i] * (1 - axe);
@@ -2595,7 +2595,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
}
if (!ok) {
- float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(
true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
@@ -2773,7 +2773,7 @@ void ui_draw_dropshadow(
GPU_batch_draw(batch);
/* outline emphasis */
- float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
UI_draw_roundbox_4fv(false,
rct->xmin - 0.5f,
rct->ymin - 0.5f,
diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index 5da82b5be9c..c86e35f91db 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -172,7 +172,7 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3])
ARegion *region = BKE_area_find_region_xy(area, RGN_TYPE_WINDOW, mx, my);
if (region) {
SpaceNode *snode = area->spacedata.first;
- int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
+ const int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
if (ED_space_node_color_sample(bmain, snode, region, mval, r_col)) {
return;
@@ -194,7 +194,7 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3])
if (win) {
/* Fallback to simple opengl picker. */
- int mval[2] = {mx, my};
+ const int mval[2] = {mx, my};
WM_window_pixel_sample_read(wm, win, mval, r_col);
IMB_colormanagement_display_to_scene_linear_v3(r_col, display);
}
diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c
index 7b8357f5ef1..b757341ae13 100644
--- a/source/blender/editors/interface/interface_eyedropper_colorband.c
+++ b/source/blender/editors/interface/interface_eyedropper_colorband.c
@@ -179,8 +179,8 @@ static void eyedropper_colorband_sample_segment(bContext *C,
/* Since the mouse tends to move rather rapidly we use #BLI_bitmap_draw_2d_line_v2v2i
* to interpolate between the reported coordinates */
struct EyedropperColorband_Context userdata = {C, eye};
- int p1[2] = {eye->last_x, eye->last_y};
- int p2[2] = {mx, my};
+ const int p1[2] = {eye->last_x, eye->last_y};
+ const int p2[2] = {mx, my};
BLI_bitmap_draw_2d_line_v2v2i(p1, p2, eyedropper_colorband_sample_callback, &userdata);
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index efbfcf8d19d..7ea64d36d48 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3023,7 +3023,7 @@ static bool ui_textedit_insert_buf(uiBut *but,
static bool ui_textedit_insert_ascii(uiBut *but, uiHandleButtonData *data, char ascii)
{
- char buf[2] = {ascii, '\0'};
+ const char buf[2] = {ascii, '\0'};
if (UI_but_is_utf8(but) && (BLI_str_utf8_size(buf) == -1)) {
printf(
@@ -6955,7 +6955,7 @@ static bool ui_numedit_but_CURVEPROFILE(uiBlock *block,
fy *= mval_factor;
/* Move all selected points. */
- float delta[2] = {fx, fy};
+ const float delta[2] = {fx, fy};
for (a = 0; a < profile->path_len; a++) {
/* Don't move the last and first control points. */
if ((pts[a].flag & PROF_SELECT) && (a != 0) && (a != profile->path_len)) {
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c
index fed29571185..4be2dbc0b4e 100644
--- a/source/blender/editors/interface/interface_icons_event.c
+++ b/source/blender/editors/interface/interface_icons_event.c
@@ -143,7 +143,7 @@ void icon_draw_rect_input(float x,
};
if ((event_type >= EVT_AKEY) && (event_type <= EVT_ZKEY)) {
- char str[2] = {'A' + (event_type - EVT_AKEY), '\0'};
+ const char str[2] = {'A' + (event_type - EVT_AKEY), '\0'};
icon_draw_rect_input_text(&rect, color, str, 13);
}
else if ((event_type >= EVT_F1KEY) && (event_type <= EVT_F12KEY)) {
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 64070725f2b..5310ff0e3ec 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -334,7 +334,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs,
const float margin = height / 4.0f;
/* backdrop */
- float color[4] = {col_bg[0], col_bg[1], col_bg[2], 0.5f};
+ const float color[4] = {col_bg[0], col_bg[1], col_bg[2], 0.5f};
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_aa(true,
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 52835b5474e..bbf29365710 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -518,7 +518,7 @@ GPUBatch *ui_batch_roundbox_shadow_get(void)
void UI_draw_anti_tria(
float x1, float y1, float x2, float y2, float x3, float y3, const float color[4])
{
- float tri_arr[3][2] = {{x1, y1}, {x2, y2}, {x3, y3}};
+ const float tri_arr[3][2] = {{x1, y1}, {x2, y2}, {x3, y3}};
float draw_color[4];
copy_v4_v4(draw_color, color);
@@ -2568,7 +2568,7 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag)
}
if (state & UI_BUT_REDALERT) {
- uchar red[4] = {255, 0, 0};
+ const uchar red[4] = {255, 0, 0};
if (wt->draw) {
color_blend_v3_v3(wt->wcol.inner, red, 0.4f);
}
@@ -2585,7 +2585,7 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag)
}
if (state & UI_BUT_NODE_ACTIVE) {
- uchar blue[4] = {86, 128, 194};
+ const uchar blue[4] = {86, 128, 194};
color_blend_v3_v3(wt->wcol.inner, blue, 0.3f);
}
}
@@ -4071,7 +4071,7 @@ static void widget_state_label(uiWidgetType *wt, int state, int drawflag)
}
if (state & UI_BUT_REDALERT) {
- uchar red[4] = {255, 0, 0};
+ const uchar red[4] = {255, 0, 0};
color_blend_v3_v3(wt->wcol.text, red, 0.4f);
}
}
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 12ce358a501..c617c921d70 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -735,7 +735,7 @@ void ED_mask_draw_region(
}
if (draw_flag & MASK_DRAWFLAG_OVERLAY) {
- float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
+ const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
float *buffer = mask_rasterize(mask_eval, width, height);
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
diff --git a/source/blender/editors/mesh/editmesh_extrude_spin.c b/source/blender/editors/mesh/editmesh_extrude_spin.c
index 9f1d499bb6a..6dde45a4f5f 100644
--- a/source/blender/editors/mesh/editmesh_extrude_spin.c
+++ b/source/blender/editors/mesh/editmesh_extrude_spin.c
@@ -57,7 +57,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
float cent[3], axis[3];
- float d[3] = {0.0f, 0.0f, 0.0f};
+ const float d[3] = {0.0f, 0.0f, 0.0f};
RNA_float_get_array(op->ptr, "center", cent);
RNA_float_get_array(op->ptr, "axis", axis);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 1f411617c68..6f4f75e802a 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2632,7 +2632,7 @@ static void knifetool_update_mval(KnifeTool_OpData *kcd, const float mval[2])
static void knifetool_update_mval_i(KnifeTool_OpData *kcd, const int mval_i[2])
{
- float mval[2] = {UNPACK2(mval_i)};
+ const float mval[2] = {UNPACK2(mval_i)};
knifetool_update_mval(kcd, mval);
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index bc9bef4dc63..81b8cd70353 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -205,7 +205,7 @@ void ED_object_rotation_from_quat(float rot[3], const float viewquat[4], const c
switch (align_axis) {
case 'X': {
/* Same as 'rv3d->viewinv[1]' */
- float axis_y[4] = {0.0f, 1.0f, 0.0f};
+ const float axis_y[4] = {0.0f, 1.0f, 0.0f};
float quat_y[4], quat[4];
axis_angle_to_quat(quat_y, axis_y, M_PI_2);
mul_qt_qtqt(quat, viewquat, quat_y);
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c
index 28f58a34814..8d8f01dd61a 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -406,7 +406,7 @@ static int voxel_size_edit_modal(bContext *C, wmOperator *op, const wmEvent *eve
return OPERATOR_FINISHED;
}
- float mval[2] = {event->mval[0], event->mval[1]};
+ const float mval[2] = {event->mval[0], event->mval[1]};
float d = cd->init_mval[0] - mval[0];
@@ -470,7 +470,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
BoundBox *bb = BKE_mesh_boundbox_get(cd->active_object);
/* Indices of the Bounding Box faces. */
- int BB_faces[6][4] = {
+ const int BB_faces[6][4] = {
{3, 0, 4, 7},
{1, 2, 6, 5},
{3, 2, 1, 0},
@@ -525,7 +525,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
float d_a[3], d_b[3];
float d_a_proj[2], d_b_proj[2];
float preview_plane_proj[4][3];
- float y_axis_proj[2] = {0.0f, 1.0f};
+ const float y_axis_proj[2] = {0.0f, 1.0f};
mid_v3_v3v3(text_pos, cd->preview_plane[0], cd->preview_plane[2]);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index f2d7ad3ac11..52b572fb0dd 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -1907,7 +1907,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
for (int x = -ofs; x <= ofs; x += ofs / 2) {
for (int y = -ofs; y <= ofs; y += ofs / 2) {
if (x != 0 && y != 0) {
- int mval_ofs[2] = {event->mval[0] + x, event->mval[1] + y};
+ const int mval_ofs[2] = {event->mval[0] + x, event->mval[1] + y};
float n[3];
if (ED_view3d_depth_read_cached_normal(&xfd->vc, mval_ofs, n)) {
add_v3_v3(normal, n);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 9616b8114ba..58fb934ebf0 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -291,7 +291,7 @@ static void region_draw_azone_tab_arrow(ScrArea *area, ARegion *region, AZone *a
/* Workaround for different color spaces between normal areas and the ones using GPUViewports. */
float alpha = WM_region_use_viewport(area, region) ? 0.6f : 0.4f;
- float color[4] = {0.05f, 0.05f, 0.05f, alpha};
+ const float color[4] = {0.05f, 0.05f, 0.05f, alpha};
UI_draw_roundbox_aa(
true, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 07a122c7094..903013460d4 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -112,7 +112,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
int seamless, offset_x, offset_y, nsubparts_x, nsubparts_y;
int components;
const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y));
- float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+ const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
if (ELEM(gpu_format, GPU_RGBA8, GPU_RGBA16F)) {
components = 4;
@@ -203,21 +203,21 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
* at edges of full image. */
if (subpart_w < tex_w) {
void *data = DATA(src_y, src_x + subpart_w - 1);
- int offset[2] = {subpart_w, 0};
- int extent[2] = {1, subpart_h};
+ const int offset[2] = {subpart_w, 0};
+ const int extent[2] = {1, subpart_h};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x);
- int offset[2] = {0, subpart_h};
- int extent[2] = {subpart_w, 1};
+ const int offset[2] = {0, subpart_h};
+ const int extent[2] = {subpart_w, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_w < tex_w && subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
- int offset[2] = {subpart_w, subpart_h};
- int extent[2] = {1, 1};
+ const int offset[2] = {subpart_w, subpart_h};
+ const int extent[2] = {1, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
#undef DATA
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index c5f1063d494..e559d2120e2 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1352,8 +1352,10 @@ static void paint_cursor_sculpt_session_update_and_init(PaintCursorContext *pcon
ViewContext *vc = &pcontext->vc;
SculptCursorGeometryInfo gi;
- float mouse[2] = {pcontext->x - pcontext->region->winrct.xmin,
- pcontext->y - pcontext->region->winrct.ymin};
+ const float mouse[2] = {
+ pcontext->x - pcontext->region->winrct.xmin,
+ pcontext->y - pcontext->region->winrct.ymin,
+ };
/* This updates the active vertex, which is needed for most of the Sculpt/Vertex Colors tools to
* work correctly */
@@ -1457,7 +1459,7 @@ static void paint_cursor_update_object_space_radius(PaintCursorContext *pcontext
static void paint_cursor_drawing_setup_cursor_space(PaintCursorContext *pcontext)
{
float cursor_trans[4][4], cursor_rot[4][4];
- float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
+ const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
float quat[4];
copy_m4_m4(cursor_trans, pcontext->vc.obact->obmat);
translate_m4(cursor_trans, pcontext->location[0], pcontext->location[1], pcontext->location[2]);
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 74e022bf84f..458f021ddb4 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -193,7 +193,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
PaintCurvePoint *pcp;
wmWindow *window = CTX_wm_window(C);
ARegion *region = CTX_wm_region(C);
- float vec[3] = {loc[0], loc[1], 0.0};
+ const float vec[3] = {loc[0], loc[1], 0.0};
int add_index;
int i;
@@ -251,7 +251,7 @@ static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int loc[2] = {event->mval[0], event->mval[1]};
+ const int loc[2] = {event->mval[0], event->mval[1]};
paintcurve_point_add(C, op, loc);
RNA_int_set_array(op->ptr, "location", loc);
return OPERATOR_FINISHED;
@@ -480,7 +480,7 @@ static bool paintcurve_point_select(
static int paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int loc[2] = {UNPACK2(event->mval)};
+ const int loc[2] = {UNPACK2(event->mval)};
bool toggle = RNA_boolean_get(op->ptr, "toggle");
bool extend = RNA_boolean_get(op->ptr, "extend");
if (paintcurve_point_select(C, op, loc, toggle, extend)) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 34c9cac67c8..431ab998f62 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1333,7 +1333,7 @@ void ED_imapaint_bucket_fill(struct bContext *C,
ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
- float mouse_init[2] = {mouse[0], mouse[1]};
+ const float mouse_init[2] = {mouse[0], mouse[1]};
paint_2d_bucket_fill(C, color, NULL, mouse_init, NULL, NULL);
ED_image_undo_push_end();
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 6d588d1450b..d614c800350 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -2163,7 +2163,7 @@ void paint_2d_gradient_fill(
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
float f;
- float p[2] = {x_px - image_init[0], y_px - image_init[1]};
+ const float p[2] = {x_px - image_init[0], y_px - image_init[1]};
switch (br->gradient_fill_mode) {
case BRUSH_GRADIENT_LINEAR: {
@@ -2191,7 +2191,7 @@ void paint_2d_gradient_fill(
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
float f;
- float p[2] = {x_px - image_init[0], y_px - image_init[1]};
+ const float p[2] = {x_px - image_init[0], y_px - image_init[1]};
switch (br->gradient_fill_mode) {
case BRUSH_GRADIENT_LINEAR: {
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index af2762889e8..fa9a0854112 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -3309,7 +3309,7 @@ static void project_paint_face_init(const ProjPaintState *ps,
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax; x++) {
- float puv[2] = {(float)x, (float)y};
+ const float puv[2] = {(float)x, (float)y};
bool in_bounds;
// uv[0] = (((float)x) + 0.5f) / (float)ibuf->x;
/* use offset uvs instead */
@@ -5756,7 +5756,7 @@ void paint_proj_stroke(const bContext *C,
View3D *v3d = CTX_wm_view3d(C);
ARegion *region = CTX_wm_region(C);
float *cursor = scene->cursor.location;
- int mval_i[2] = {(int)pos[0], (int)pos[1]};
+ const int mval_i[2] = {(int)pos[0], (int)pos[1]};
view3d_operator_needs_opengl(C);
@@ -6123,8 +6123,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- float pos[2] = {0.0, 0.0};
- float lastpos[2] = {0.0, 0.0};
+ const float pos[2] = {0.0, 0.0};
+ const float lastpos[2] = {0.0, 0.0};
int a;
project_paint_op(&ps, lastpos, pos);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 0fe6e259d8d..43ff03ea7e2 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -913,7 +913,7 @@ static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *ev
{
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *br = BKE_paint_brush(paint);
- float mvalf[2] = {event->mval[0], event->mval[1]};
+ const float mvalf[2] = {event->mval[0], event->mval[1]};
ARegion *region = CTX_wm_region(C);
StencilControlData *scd;
int mask = RNA_enum_get(op->ptr, "texmode");
@@ -968,7 +968,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
#define PIXEL_MARGIN 5
float mdiff[2];
- float mvalf[2] = {mval[0], mval[1]};
+ const float mvalf[2] = {mval[0], mval[1]};
switch (scd->mode) {
case STENCIL_TRANSLATE:
sub_v2_v2v2(mdiff, mvalf, scd->init_mouse);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 6c5d6f4ee4e..af5afa80eb8 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -169,7 +169,7 @@ float paint_get_tex_pixel(const MTex *mtex, float u, float v, struct ImagePool *
{
float intensity;
float rgba_dummy[4];
- float co[3] = {u, v, 0.0f};
+ const float co[3] = {u, v, 0.0f};
RE_texture_evaluate(mtex, co, thread, pool, false, false, &intensity, rgba_dummy);
@@ -185,7 +185,7 @@ void paint_get_tex_pixel_col(const MTex *mtex,
bool convert_to_linear,
struct ColorSpace *colorspace)
{
- float co[3] = {u, v, 0.0f};
+ const float co[3] = {u, v, 0.0f};
float intensity;
const bool hasrgb = RE_texture_evaluate(mtex, co, thread, pool, false, false, &intensity, rgba);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 83d76c166ce..73014f9f2de 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -757,8 +757,8 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
int y_start = RNA_int_get(op->ptr, "ystart");
int x_end = RNA_int_get(op->ptr, "xend");
int y_end = RNA_int_get(op->ptr, "yend");
- float sco_start[2] = {x_start, y_start};
- float sco_end[2] = {x_end, y_end};
+ const float sco_start[2] = {x_start, y_start};
+ const float sco_end[2] = {x_end, y_end};
const bool is_interactive = (gesture != NULL);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index c0862795594..21fba6479e8 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -979,7 +979,7 @@ void SCULPT_cloth_simulation_limits_draw(const uint gpuattr,
const float alpha)
{
float cursor_trans[4][4], cursor_rot[4][4];
- float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
+ const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
float quat[4];
unit_m4(cursor_trans);
translate_m4(cursor_trans, location[0], location[1], location[2]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c
index 463233fd6fb..e08f477c981 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_paint/sculpt_detail.c
@@ -179,7 +179,7 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, int mx, int my)
SCULPT_vertex_random_access_init(ss);
/* Update the active vertex. */
- float mouse[2] = {mx, my};
+ const float mouse[2] = {mx, my};
SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false);
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, false, false);
@@ -219,7 +219,7 @@ static void sample_detail_dyntopo(bContext *C, ViewContext *vc, ARegion *region,
SCULPT_stroke_modifiers_check(C, ob, brush);
- float mouse[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
+ const float mouse[2] = {mx - region->winrct.xmin, my - region->winrct.ymin};
float ray_start[3], ray_end[3], ray_normal[3];
float depth = SCULPT_raycast_init(vc, mouse, ray_start, ray_end, ray_normal, false);
@@ -316,7 +316,7 @@ static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wm
switch (event->type) {
case LEFTMOUSE:
if (event->val == KM_PRESS) {
- int ss_co[2] = {event->x, event->y};
+ const int ss_co[2] = {event->x, event->y};
int mode = RNA_enum_get(op->ptr, "mode");
sample_detail(C, ss_co[0], ss_co[1], mode);
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index ba11988156c..e39cdc2db23 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -82,7 +82,7 @@ void SCULPT_filter_cache_init(Object *ob, Sculpt *sd, const int undo_type)
ss->filter_cache->random_seed = rand();
- float center[3] = {0.0f};
+ const float center[3] = {0.0f};
SculptSearchSphereData search_data = {
.original = true,
.center = center,
diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
index 60483cc168d..bc493a036f0 100644
--- a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
@@ -174,7 +174,7 @@ static int sculpt_mask_expand_modal(bContext *C, wmOperator *op, const wmEvent *
ARegion *region = CTX_wm_region(C);
float prevclick_f[2];
copy_v2_v2(prevclick_f, op->customdata);
- int prevclick[2] = {(int)prevclick_f[0], (int)prevclick_f[1]};
+ const int prevclick[2] = {(int)prevclick_f[0], (int)prevclick_f[1]};
int len = (int)len_v2v2_int(prevclick, event->mval);
len = abs(len);
int mask_speed = RNA_int_get(op->ptr, "mask_speed");
diff --git a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
index 35f916c8f90..e47a94dff90 100644
--- a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
+++ b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c
@@ -375,7 +375,7 @@ void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes,
/* Calculate the final left and right scrape planes. */
float plane_no[3];
float plane_no_rot[3];
- float y_axis[3] = {0.0f, 1.0f, 0.0f};
+ const float y_axis[3] = {0.0f, 1.0f, 0.0f};
float mat_inv[4][4];
invert_m4_m4(mat_inv, mat);
@@ -418,11 +418,11 @@ void SCULPT_multiplane_scrape_preview_draw(const uint gpuattr,
float offset = ss->cache->radius * 0.25f;
- float p[3] = {0.0f, 0.0f, ss->cache->radius};
- float y_axis[3] = {0.0f, 1.0f, 0.0f};
+ const float p[3] = {0.0f, 0.0f, ss->cache->radius};
+ const float y_axis[3] = {0.0f, 1.0f, 0.0f};
float p_l[3];
float p_r[3];
- float area_center[3] = {0.0f, 0.0f, 0.0f};
+ const float area_center[3] = {0.0f, 0.0f, 0.0f};
rotate_v3_v3v3fl(p_r, p, y_axis, DEG2RADF((angle + 180) * 0.5f));
rotate_v3_v3v3fl(p_l, p, y_axis, DEG2RADF(-(angle + 180) * 0.5f));
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 589831b1c45..63d9889e662 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -114,7 +114,7 @@ static void find_nearest_tracking_segment_cb(void *userdata,
float val)
{
MouseSelectUserData *data = userdata;
- float co[2] = {scene_framenr, val};
+ const float co[2] = {scene_framenr, val};
if (!clip_graph_value_visible(data->sc, value_source)) {
return;
@@ -151,7 +151,7 @@ static void find_nearest_tracking_knot_cb(void *userdata,
float val)
{
MouseSelectUserData *data = userdata;
- float mdiff[2] = {scene_framenr - data->mouse_co[0], val - data->mouse_co[1]};
+ const float mdiff[2] = {scene_framenr - data->mouse_co[0], val - data->mouse_co[1]};
float dist_sq = len_squared_v2(mdiff);
if (!clip_graph_value_visible(data->sc, value_source)) {
@@ -159,7 +159,7 @@ static void find_nearest_tracking_knot_cb(void *userdata,
}
if (data->marker == NULL || dist_sq < data->min_dist_sq) {
- float co[2] = {scene_framenr, val};
+ const float co[2] = {scene_framenr, val};
data->track = track;
data->marker = marker;
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 739701b5595..177a0bc2bcf 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -513,7 +513,7 @@ static bool slide_check_corners(float (*corners)[2])
{
int i, next, prev;
float cross = 0.0f;
- float p[2] = {0.0f, 0.0f};
+ const float p[2] = {0.0f, 0.0f};
if (!isect_point_quad_v2(p, corners[0], corners[1], corners[2], corners[3])) {
return false;
@@ -861,7 +861,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM);
}
else if (data->action == SLIDE_ACTION_OFFSET) {
- float d[2] = {dx, dy};
+ const float d[2] = {dx, dy};
for (int a = 0; a < data->track->markersnr; a++) {
add_v2_v2v2(data->track->markers[a].pos, data->old_markers[a], d);
}
@@ -940,7 +940,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM);
}
else if (data->area == TRACK_AREA_SEARCH) {
- float d[2] = {dx, dy};
+ const float d[2] = {dx, dy};
add_v2_v2v2(data->min, data->old_search_min, d);
add_v2_v2v2(data->max, data->old_search_max, d);
}
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index b6f9ca9589f..615d09a04b2 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -153,9 +153,9 @@ static float dist_to_rect(const float co[2],
const float max[2])
{
float d1, d2, d3, d4;
- float p[2] = {co[0] - pos[0], co[1] - pos[1]};
- float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]};
- float v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]};
+ const float p[2] = {co[0] - pos[0], co[1] - pos[1]};
+ const float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]};
+ const float v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]};
d1 = dist_squared_to_line_segment_v2(p, v1, v2);
d2 = dist_squared_to_line_segment_v2(p, v2, v3);
@@ -169,7 +169,7 @@ static float dist_to_rect(const float co[2],
static float dist_to_crns(const float co[2], const float pos[2], const float crns[4][2])
{
float d1, d2, d3, d4;
- float p[2] = {co[0] - pos[0], co[1] - pos[1]};
+ const float p[2] = {co[0] - pos[0], co[1] - pos[1]};
const float *v1 = crns[0], *v2 = crns[1];
const float *v3 = crns[2], *v4 = crns[3];
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 1038011e480..f70589ac5f1 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -168,9 +168,9 @@ void ED_image_draw_info(Scene *scene,
uchar green[3] = {0, 255, 0};
uchar blue[3] = {100, 100, 255};
#else
- uchar red[3] = {255, 255, 255};
- uchar green[3] = {255, 255, 255};
- uchar blue[3] = {255, 255, 255};
+ const uchar red[3] = {255, 255, 255};
+ const uchar green[3] = {255, 255, 255};
+ const uchar blue[3] = {255, 255, 255};
#endif
float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
float col[4], finalcol[4];
@@ -465,7 +465,7 @@ void ED_image_draw_info(Scene *scene,
static void sima_draw_zbuf_pixels(
float x1, float y1, int rectx, int recty, const int *rect, float zoomx, float zoomy)
{
- float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
+ const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
/* Slowwww */
float *rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
@@ -494,7 +494,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene,
{
float bias, scale, *rectf, clip_end;
int a;
- float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
+ const float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
if (scene->camera && scene->camera->type == OB_CAMERA) {
bias = ((Camera *)scene->camera->data)->clip_start;
@@ -798,7 +798,7 @@ static void draw_udim_tile_grid(uint pos_attr,
{
float x1, y1;
UI_view2d_view_to_region_fl(&region->v2d, x, y, &x1, &y1);
- int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
+ const int gridpos[5][2] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
for (int i = 0; i < 4; i++) {
immAttr3fv(color_attr, color);
immVertex2f(pos_attr, x1 + gridpos[i][0] * stepx, y1 + gridpos[i][1] * stepy);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 6c818257ec7..72533b88406 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -270,12 +270,12 @@ void *info_text_pick(const SpaceInfo *sinfo,
int info_textview_height(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
{
- int mval[2] = {INT_MAX, INT_MAX};
+ const int mval[2] = {INT_MAX, INT_MAX};
return info_textview_main__internal(sinfo, region, reports, false, mval, NULL, NULL);
}
void info_textview_main(const SpaceInfo *sinfo, const ARegion *region, const ReportList *reports)
{
- int mval[2] = {INT_MAX, INT_MAX};
+ const int mval[2] = {INT_MAX, INT_MAX};
info_textview_main__internal(sinfo, region, reports, true, mval, NULL, NULL);
}
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index eee8b989cc2..93a79d9a2bc 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -264,7 +264,7 @@ static bool textview_draw_string(TextViewDrawState *tds,
if (tds->sel[0] != tds->sel[1]) {
textview_step_sel(tds, -final_offset);
- int pos[2] = {tds->xy[0], line_bottom};
+ const int pos[2] = {tds->xy[0], line_bottom};
textview_draw_sel(s, pos, len, tds, bg_sel);
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 52bd4d68649..3fd0b0a5a58 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -986,7 +986,7 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
else {
const float margin = 3.0f;
- float color[4] = {0.0f, 0.0f, 0.0f, 0.33f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 0.33f};
UI_draw_roundbox_aa(true,
rct->xmin - margin,
rct->ymin - margin,
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index a45b415b629..4271eaded99 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2694,7 +2694,7 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle,
int ys,
const int num_elements)
{
- float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ const float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float ufac = 0.25f * UI_UNIT_X;
float offset_x = (float)offsx + UI_UNIT_X * 0.35f;
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7863d2b724d..0f4690c11d5 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -2169,7 +2169,7 @@ static void draw_cache_view(const bContext *C)
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_FINAL_OUT) {
stripe_bot = UI_view2d_region_to_view_y(v2d, V2D_SCROLL_HANDLE_HEIGHT);
stripe_top = stripe_bot + stripe_ht;
- float bg_color[4] = {1.0f, 0.4f, 0.2f, 0.1f};
+ const float bg_color[4] = {1.0f, 0.4f, 0.2f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
immRectf(pos, scene->r.sfra, stripe_bot, scene->r.efra, stripe_top);
@@ -2188,7 +2188,7 @@ static void draw_cache_view(const bContext *C)
stripe_top = stripe_bot + stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_RAW) {
- float bg_color[4] = {1.0f, 0.1f, 0.02f, 0.1f};
+ const float bg_color[4] = {1.0f, 0.1f, 0.02f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
}
@@ -2197,7 +2197,7 @@ static void draw_cache_view(const bContext *C)
stripe_top = stripe_bot + stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED) {
- float bg_color[4] = {0.1f, 0.1f, 0.75f, 0.1f};
+ const float bg_color[4] = {0.1f, 0.1f, 0.75f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
}
@@ -2206,7 +2206,7 @@ static void draw_cache_view(const bContext *C)
stripe_bot = stripe_top - stripe_ht;
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_COMPOSITE) {
- float bg_color[4] = {1.0f, 0.6f, 0.0f, 0.1f};
+ const float bg_color[4] = {1.0f, 0.6f, 0.0f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
}
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 24c55e60513..74cf3c866d3 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -55,7 +55,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *region)
TextLine *tmp;
int l, x, y, w, h, i;
int tgti, *top;
- int mval[2] = {0, 0};
+ const int mval[2] = {0, 0};
if (!st || !st->text) {
return 0;
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 6be436cffb5..201f9dae5d5 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2587,7 +2587,7 @@ static void text_scroll_apply(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceText *st = CTX_wm_space_text(C);
TextScroll *tsc = op->customdata;
- int mval[2] = {event->x, event->y};
+ const int mval[2] = {event->x, event->y};
text_update_character_width(st);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index d78c58c0c64..38784a5c79e 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -1071,7 +1071,7 @@ static void v3d_object_dimension_buts(bContext *C, uiLayout *layout, View3D *v3d
const float lim = FLT_MAX;
for (int i = 0; i < 3; i++) {
uiBut *but;
- char text[3] = {'X' + i, ':', '\0'};
+ const char text[3] = {'X' + i, ':', '\0'};
but = uiDefButF(block,
UI_BTYPE_NUM,
B_TRANSFORM_PANEL_DIMS,
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
index 30212fcd9e5..e17993445df 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_preselect_type.c
@@ -156,7 +156,7 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
if (eve_test) {
BMVert *vert = (BMVert *)eve_test;
float vert_p_co[3], vert_co[3];
- float mval_f[2] = {UNPACK2(vc.mval)};
+ const float mval_f[2] = {UNPACK2(vc.mval)};
mul_v3_m4v3(vert_co, gz_ele->bases[base_index_vert]->object->obmat, vert->co);
ED_view3d_project(vc.region, vert_co, vert_p_co);
float len = len_v2v2(vert_p_co, mval_f);
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 59b2e378955..7799aba5c19 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -909,7 +909,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz)
static int gizmo_ruler_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mval[2])
{
RulerItem *ruler_item_pick = (RulerItem *)gz;
- float mval_fl[2] = {UNPACK2(mval)};
+ const float mval_fl[2] = {UNPACK2(mval)};
int co_index;
/* select and drag */
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index b7219290654..b79632f0a82 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -321,7 +321,7 @@ static void draw_line_bounds(const BoundBox *bounds, const float color[4])
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
- int edges[12][2] = {
+ const int edges[12][2] = {
/* First side. */
{0, 1},
{1, 2},
@@ -507,7 +507,7 @@ static void draw_circle_in_quad(const float v1[2],
float theta = ((2.0f * M_PI) * ((float)i / (float)resolution)) + 0.01f;
float x = cosf(theta);
float y = sinf(theta);
- float pt[2] = {x, y};
+ const float pt[2] = {x, y};
float w[4];
barycentric_weights_v2_quad(UNPACK4(quad), pt, w);
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index c10a88af146..c790a8659ee 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -778,7 +778,7 @@ void ED_view3d_project(const struct ARegion *region, const float world[3], float
{
// viewport is set up to make coordinates relative to the region, not window
RegionView3D *rv3d = region->regiondata;
- int viewport[4] = {0, 0, region->winx, region->winy};
+ const int viewport[4] = {0, 0, region->winx, region->winy};
GPU_matrix_project(world, rv3d->viewmat, rv3d->winmat, viewport, r_region_co);
}
@@ -787,8 +787,8 @@ bool ED_view3d_unproject(
const struct ARegion *region, float regionx, float regiony, float regionz, float world[3])
{
RegionView3D *rv3d = region->regiondata;
- int viewport[4] = {0, 0, region->winx, region->winy};
- float region_co[3] = {regionx, regiony, regionz};
+ const int viewport[4] = {0, 0, region->winx, region->winy};
+ const float region_co[3] = {regionx, regiony, regionz};
return GPU_matrix_unproject(region_co, rv3d->viewmat, rv3d->winmat, viewport, world);
}
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 4e73a2be17e..a264e1560c6 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -1499,7 +1499,7 @@ void ED_view3d_from_m4(const float mat[4][4], float ofs[3], float quat[4], const
*/
void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist)
{
- float iviewquat[4] = {-quat[0], quat[1], quat[2], quat[3]};
+ const float iviewquat[4] = {-quat[0], quat[1], quat[2], quat[3]};
float dvec[3] = {0.0f, 0.0f, dist};
quat_to_mat4(mat, iviewquat);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 64167b83655..2cc41097070 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -387,7 +387,7 @@ static bool walk_floor_distance_get(RegionView3D *rv3d,
const float dvec[3],
float *r_distance)
{
- float ray_normal[3] = {0, 0, -1}; /* down */
+ const float ray_normal[3] = {0, 0, -1}; /* down */
float ray_start[3];
float r_location[3];
float r_normal_dummy[3];
diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c
index 6f447997fb0..573f4550fec 100644
--- a/source/blender/editors/transform/transform_convert_mesh.c
+++ b/source/blender/editors/transform/transform_convert_mesh.c
@@ -754,7 +754,8 @@ void createTransEditVerts(TransInfo *t)
if (tc->use_mirror_axis_any) {
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
bool use_select = (t->flag & T_PROP_EDIT) == 0;
- bool mirror_axis[3] = {tc->use_mirror_axis_x, tc->use_mirror_axis_y, tc->use_mirror_axis_z};
+ const bool mirror_axis[3] = {
+ tc->use_mirror_axis_x, tc->use_mirror_axis_y, tc->use_mirror_axis_z};
editmesh_mirror_data_calc(em, use_select, use_topology, mirror_axis, &mirror_data);
if (mirror_data.vert_map) {
diff --git a/source/blender/editors/transform/transform_gizmo_2d.c b/source/blender/editors/transform/transform_gizmo_2d.c
index dacdb72806c..11cde6a9038 100644
--- a/source/blender/editors/transform/transform_gizmo_2d.c
+++ b/source/blender/editors/transform/transform_gizmo_2d.c
@@ -350,8 +350,8 @@ static void gizmo2d_xform_setup(const bContext *UNUSED(C), wmGizmoGroup *gzgroup
ptr = WM_gizmo_operator_set(ggd->cage, 0, ot_translate, NULL);
RNA_boolean_set(ptr, "release_confirm", 1);
- bool constraint_x[3] = {1, 0, 0};
- bool constraint_y[3] = {0, 1, 0};
+ const bool constraint_x[3] = {1, 0, 0};
+ const bool constraint_y[3] = {0, 1, 0};
ptr = WM_gizmo_operator_set(ggd->cage, ED_GIZMO_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL);
PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
@@ -484,7 +484,7 @@ static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
ARegion *region = CTX_wm_region(C);
GizmoGroup2D *ggd = gzgroup->customdata;
float origin[3] = {UNPACK2(ggd->origin), 0.0f};
- float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f};
+ const float origin_aa[3] = {UNPACK2(ggd->origin), 0.0f};
gizmo2d_origin_to_region(region, origin);
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 3878103fa4e..6155042f555 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -2053,7 +2053,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmGizmoGroup
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
- bool constraint[3] = {x != 1, y != 1, z != 1};
+ const bool constraint[3] = {x != 1, y != 1, z != 1};
ptr = WM_gizmo_operator_set(gz, i, ot_resize, NULL);
if (prop_release_confirm == NULL) {
prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
index 7f6f3e53bc3..ae7cda0bd03 100644
--- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c
@@ -213,7 +213,7 @@ static void gizmo_mesh_extrude_setup(const bContext *C, wmGizmoGroup *gzgroup)
PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate");
RNA_boolean_set(&macroptr, "release_confirm", true);
- bool constraint[3] = {0, 0, 0};
+ const bool constraint[3] = {0, 0, 0};
RNA_boolean_set_array(&macroptr, "constraint_axis", constraint);
}
diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c
index 4a648a77fe1..1886f95beae 100644
--- a/source/blender/editors/transform/transform_mode_edge_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_slide.c
@@ -534,7 +534,7 @@ static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataCo
int sv_tot;
int *sv_table; /* BMVert -> sv_array index */
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
- float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
+ const float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
int numsel, i, loop_nr;
bool use_occlude_geometry = false;
View3D *v3d = NULL;
@@ -894,7 +894,7 @@ static EdgeSlideData *createEdgeSlideVerts_single_side(TransInfo *t, TransDataCo
int sv_tot;
int *sv_table; /* BMVert -> sv_array index */
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
- float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
+ const float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
int loop_nr;
bool use_occlude_geometry = false;
View3D *v3d = NULL;
diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c
index b396317ba7c..38537194af3 100644
--- a/source/blender/editors/transform/transform_mode_vert_slide.c
+++ b/source/blender/editors/transform/transform_mode_vert_slide.c
@@ -126,7 +126,7 @@ static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
{
/* Active object may have no selected vertices. */
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
- float mval_fl[2] = {UNPACK2(mval)};
+ const float mval_fl[2] = {UNPACK2(mval)};
TransDataVertSlideVert *sv;
/* set the vertex to use as a reference for the mouse direction 'curr_sv_index' */
@@ -153,8 +153,8 @@ static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2])
{
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
- float imval_fl[2] = {UNPACK2(t->mouse.imval)};
- float mval_fl[2] = {UNPACK2(mval)};
+ const float imval_fl[2] = {UNPACK2(t->mouse.imval)};
+ const float mval_fl[2] = {UNPACK2(mval)};
float dir[3];
TransDataVertSlideVert *sv;
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index eb14c5bec28..8079795d306 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1214,7 +1214,7 @@ static void cb_mlooptri_edges_get(const int index, int v_index[3], const BVHTree
const MLoopTri *lt = &data->looptri[index];
for (int j = 2, j_next = 0; j_next < 3; j = j_next++) {
const MEdge *ed = &medge[mloop[lt->tri[j]].e];
- uint tri_edge[2] = {mloop[lt->tri[j]].v, mloop[lt->tri[j_next]].v};
+ const uint tri_edge[2] = {mloop[lt->tri[j]].v, mloop[lt->tri[j_next]].v};
if (ELEM(ed->v1, tri_edge[0], tri_edge[1]) && ELEM(ed->v2, tri_edge[0], tri_edge[1])) {
// printf("real edge found\n");
v_index[j] = mloop[lt->tri[j]].e;
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 9f77bf31481..49f11cd6a74 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1348,7 +1348,7 @@ static void uv_map_rotation_matrix(float result[4][4],
float sideangledeg,
float radius)
{
- float offset[4] = {0};
+ const float offset[4] = {0};
uv_map_rotation_matrix_ex(result, rv3d, ob, upangledeg, sideangledeg, radius, offset);
}