diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc index 20ec79b2f9b..c1ded7e9a0d 100644 --- a/intern/opencolorio/ocio_impl_glsl.cc +++ b/intern/opencolorio/ocio_impl_glsl.cc @@ -512,8 +512,8 @@ static void updateGPUCurveMapping(OCIO_GPUCurveMappping &curvemap, curvemap.cache_id = curve_mapping_settings->cache_id; /* Update texture. */ - int offset[3] = {0, 0, 0}; - int extent[3] = {curve_mapping_settings->lut_size, 0, 0}; + const int offset[3] = {0, 0, 0}; + const int extent[3] = {curve_mapping_settings->lut_size, 0, 0}; const float *pixels = curve_mapping_settings->lut; GPU_texture_update_sub( curvemap.texture, GPU_DATA_FLOAT, pixels, UNPACK3(offset), UNPACK3(extent)); diff --git a/intern/opensubdiv/internal/topology/mesh_topology_test.cc b/intern/opensubdiv/internal/topology/mesh_topology_test.cc index 5a437d7118e..21610b77292 100644 --- a/intern/opensubdiv/internal/topology/mesh_topology_test.cc +++ b/intern/opensubdiv/internal/topology/mesh_topology_test.cc @@ -60,17 +60,17 @@ TEST(MeshTopology, TrivialFaceTopology) EXPECT_EQ(mesh_topology.getNumFaceVertices(2), 5); { - int vertex_indices[] = {0, 1, 2, 3}; + const int vertex_indices[] = {0, 1, 2, 3}; mesh_topology.setFaceVertexIndices(0, 4, vertex_indices); } { - int vertex_indices[] = {4, 5, 6}; + const int vertex_indices[] = {4, 5, 6}; mesh_topology.setFaceVertexIndices(1, 3, vertex_indices); } { - int vertex_indices[] = {7, 8, 9, 10, 11}; + const int vertex_indices[] = {7, 8, 9, 10, 11}; mesh_topology.setFaceVertexIndices(2, 5, vertex_indices); } diff --git a/source/blender/blenkernel/BKE_vfont.hh b/source/blender/blenkernel/BKE_vfont.hh index bf26f162543..4bfedecb257 100644 --- a/source/blender/blenkernel/BKE_vfont.hh +++ b/source/blender/blenkernel/BKE_vfont.hh @@ -102,7 +102,7 @@ bool BKE_vfont_to_curve_ex(Object *ob, CharTrans **r_chartransdata); bool BKE_vfont_to_curve_nubase(Object *ob, eEditFontMode mode, ListBase *r_nubase); -int BKE_vfont_cursor_to_text_index(Object *ob, float cursor_location[2]); +int BKE_vfont_cursor_to_text_index(Object *ob, const float cursor_location[2]); /** * \warning Expects to have access to evaluated data (i.e. passed object should be evaluated one). diff --git a/source/blender/blenkernel/intern/ipo.cc b/source/blender/blenkernel/intern/ipo.cc index 445a4820029..d3c3e8ca1f5 100644 --- a/source/blender/blenkernel/intern/ipo.cc +++ b/source/blender/blenkernel/intern/ipo.cc @@ -1022,8 +1022,8 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *r_array_index) static char *get_rna_access(ID *id, int blocktype, int adrcode, - char actname[], - char constname[], + const char actname[], + const char constname[], Sequence *seq, int *r_array_index) { diff --git a/source/blender/blenkernel/intern/text.cc b/source/blender/blenkernel/intern/text.cc index 5942499a13d..96d95811669 100644 --- a/source/blender/blenkernel/intern/text.cc +++ b/source/blender/blenkernel/intern/text.cc @@ -2270,8 +2270,8 @@ int txt_setcurr_tab_spaces(Text *text, int space) int text_check_bracket(const char ch) { int a; - char opens[] = "([{"; - char close[] = ")]}"; + const char opens[] = "([{"; + const char close[] = ")]}"; for (a = 0; a < (sizeof(opens) - 1); a++) { if (ch == opens[a]) { diff --git a/source/blender/blenkernel/intern/vfont.cc b/source/blender/blenkernel/intern/vfont.cc index c2f596ed6bf..c83d2164b6f 100644 --- a/source/blender/blenkernel/intern/vfont.cc +++ b/source/blender/blenkernel/intern/vfont.cc @@ -2006,7 +2006,7 @@ bool BKE_vfont_to_curve_ex(Object *ob, return data.ok; } -int BKE_vfont_cursor_to_text_index(Object *ob, float cursor_location[2]) +int BKE_vfont_cursor_to_text_index(Object *ob, const float cursor_location[2]) { Curve *cu = (Curve *)ob->data; ListBase *r_nubase = &cu->nurb; diff --git a/source/blender/blenlib/intern/array_utils.c b/source/blender/blenlib/intern/array_utils.c index cb1ffd47903..35fe70902b8 100644 --- a/source/blender/blenlib/intern/array_utils.c +++ b/source/blender/blenlib/intern/array_utils.c @@ -317,7 +317,7 @@ bool _bli_array_iter_spiral_square(const void *arr_v, } /* For check_bounds. */ - int limits[2] = {(arr_shape[0] - 1) * stride[0], stride[0] - stride[1]}; + const int limits[2] = {(arr_shape[0] - 1) * stride[0], stride[0] - stride[1]}; int steps = 0; while (steps < steps_out) { diff --git a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc index fde017c6eb1..a067540a586 100644 --- a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc +++ b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc @@ -294,7 +294,7 @@ TEST(expr_pylike, Eval_Ternary1) TEST(expr_pylike, MultipleArgs) { const char *names[3] = {"x", "y", "x"}; - double values[3] = {1.0, 2.0, 3.0}; + const double values[3] = {1.0, 2.0, 3.0}; ExprPyLike_Parsed *expr = BLI_expr_pylike_parse("x*10 + y", names, ARRAY_SIZE(names)); diff --git a/source/blender/blenlib/tests/BLI_math_color_test.cc b/source/blender/blenlib/tests/BLI_math_color_test.cc index c8d62ab06e5..048d263f3d6 100644 --- a/source/blender/blenlib/tests/BLI_math_color_test.cc +++ b/source/blender/blenlib/tests/BLI_math_color_test.cc @@ -8,7 +8,7 @@ TEST(math_color, RGBToHSVRoundtrip) { - float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; + const float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; float hsv[3], rgb[3]; rgb_to_hsv_v(orig_rgb, hsv); hsv_to_rgb_v(hsv, rgb); @@ -17,7 +17,7 @@ TEST(math_color, RGBToHSVRoundtrip) TEST(math_color, RGBToHSLRoundtrip) { - float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; + const float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; float hsl[3], rgb[3]; rgb_to_hsl_v(orig_rgb, hsl); hsl_to_rgb_v(hsl, rgb); @@ -26,7 +26,7 @@ TEST(math_color, RGBToHSLRoundtrip) TEST(math_color, RGBToYUVRoundtrip) { - float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; + const float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; float yuv[3], rgb[3]; rgb_to_yuv(orig_rgb[0], orig_rgb[1], orig_rgb[2], &yuv[0], &yuv[1], &yuv[2], BLI_YUV_ITU_BT709); yuv_to_rgb(yuv[0], yuv[1], yuv[2], &rgb[0], &rgb[1], &rgb[2], BLI_YUV_ITU_BT709); @@ -35,7 +35,7 @@ TEST(math_color, RGBToYUVRoundtrip) TEST(math_color, RGBToYCCRoundtrip) { - float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; + const float orig_rgb[3] = {0.1f, 0.2f, 0.3f}; float ycc[3], rgb[3]; rgb_to_ycc(orig_rgb[0], orig_rgb[1], orig_rgb[2], &ycc[0], &ycc[1], &ycc[2], BLI_YCC_ITU_BT601); diff --git a/source/blender/blenlib/tests/BLI_math_matrix_test.cc b/source/blender/blenlib/tests/BLI_math_matrix_test.cc index 8af3e9103c7..dd84681d985 100644 --- a/source/blender/blenlib/tests/BLI_math_matrix_test.cc +++ b/source/blender/blenlib/tests/BLI_math_matrix_test.cc @@ -111,7 +111,7 @@ TEST(math_matrix, mul_m3_series) {0.0f, 0.0f, 5.0f}, }; mul_m3_series(matrix, matrix, matrix, matrix); - float expect[3][3] = { + float const expect[3][3] = { {8.0f, 0.0f, 0.0f}, {0.0f, 27.0f, 0.0f}, {0.0f, 0.0f, 125.0f}, @@ -128,7 +128,7 @@ TEST(math_matrix, mul_m4_series) {0.0f, 0.0f, 0.0f, 7.0f}, }; mul_m4_series(matrix, matrix, matrix, matrix); - float expect[4][4] = { + float const expect[4][4] = { {8.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 27.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 125.0f, 0.0f}, diff --git a/source/blender/blenlib/tests/BLI_math_solvers_test.cc b/source/blender/blenlib/tests/BLI_math_solvers_test.cc index d693d8e656c..350c8e4a03e 100644 --- a/source/blender/blenlib/tests/BLI_math_solvers_test.cc +++ b/source/blender/blenlib/tests/BLI_math_solvers_test.cc @@ -8,10 +8,10 @@ TEST(math_solvers, Tridiagonal1) { - float a[1] = {1}; // ignored - float b[1] = {2}; - float c[1] = {1}; // ignored - float d[1] = {4}; + const float a[1] = {1}; // ignored + const float b[1] = {2}; + const float c[1] = {1}; // ignored + const float d[1] = {4}; float x[1]; EXPECT_TRUE(BLI_tridiagonal_solve(a, b, c, d, x, 1)); @@ -20,10 +20,10 @@ TEST(math_solvers, Tridiagonal1) TEST(math_solvers, Tridiagonal3) { - float a[3] = {1, 2, 3}; // 1 ignored - float b[3] = {4, 5, 6}; - float c[3] = {7, 8, 9}; // 9 ignored - float d[3] = {18, 36, 24}; + const float a[3] = {1, 2, 3}; // 1 ignored + const float b[3] = {4, 5, 6}; + const float c[3] = {7, 8, 9}; // 9 ignored + const float d[3] = {18, 36, 24}; float x[3]; EXPECT_TRUE(BLI_tridiagonal_solve(a, b, c, d, x, 3)); @@ -34,10 +34,10 @@ TEST(math_solvers, Tridiagonal3) TEST(math_solvers, CyclicTridiagonal1) { - float a[1] = {1}; - float b[1] = {2}; - float c[1] = {1}; - float d[1] = {4}; + const float a[1] = {1}; + const float b[1] = {2}; + const float c[1] = {1}; + const float d[1] = {4}; float x[1]; EXPECT_TRUE(BLI_tridiagonal_solve_cyclic(a, b, c, d, x, 1)); @@ -46,10 +46,10 @@ TEST(math_solvers, CyclicTridiagonal1) TEST(math_solvers, CyclicTridiagonal2) { - float a[2] = {1, 2}; - float b[2] = {3, 4}; - float c[2] = {5, 6}; - float d[2] = {15, 16}; + const float a[2] = {1, 2}; + const float b[2] = {3, 4}; + const float c[2] = {5, 6}; + const float d[2] = {15, 16}; float x[2]; EXPECT_TRUE(BLI_tridiagonal_solve_cyclic(a, b, c, d, x, 2)); @@ -59,10 +59,10 @@ TEST(math_solvers, CyclicTridiagonal2) TEST(math_solvers, CyclicTridiagonal3) { - float a[3] = {1, 2, 3}; - float b[3] = {4, 5, 6}; - float c[3] = {7, 8, 9}; - float d[3] = {21, 36, 33}; + const float a[3] = {1, 2, 3}; + const float b[3] = {4, 5, 6}; + const float c[3] = {7, 8, 9}; + const float d[3] = {21, 36, 33}; float x[3]; EXPECT_TRUE(BLI_tridiagonal_solve_cyclic(a, b, c, d, x, 3)); diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee/eevee_depth_of_field.cc index 6705fc80134..cdd1ef7bc8e 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.cc @@ -354,7 +354,7 @@ static void dof_bokeh_pass_init(EEVEE_FramebufferList *fbl, } void *owner = (void *)&EEVEE_depth_of_field_init; - int res[2] = {DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE}; + const int res[2] = {DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE}; DRW_PASS_CREATE(psl->dof_bokeh, DRW_STATE_WRITE_COLOR); @@ -393,7 +393,7 @@ static void dof_setup_pass_init(EEVEE_FramebufferList *fbl, void *owner = (void *)&EEVEE_depth_of_field_init; const float *fullres = DRW_viewport_size_get(); - int res[2] = {int(divide_ceil_u(fullres[0], 2)), int(divide_ceil_u(fullres[1], 2))}; + const int res[2] = {int(divide_ceil_u(fullres[0], 2)), int(divide_ceil_u(fullres[1], 2))}; DRW_PASS_CREATE(psl->dof_setup, DRW_STATE_WRITE_COLOR); @@ -428,8 +428,8 @@ static void dof_flatten_tiles_pass_init(EEVEE_FramebufferList *fbl, { void *owner = (void *)&EEVEE_depth_of_field_init; const float *fullres = DRW_viewport_size_get(); - int res[2] = {int(divide_ceil_u(fullres[0], DOF_TILE_DIVISOR)), - int(divide_ceil_u(fullres[1], DOF_TILE_DIVISOR))}; + const int res[2] = {int(divide_ceil_u(fullres[0], DOF_TILE_DIVISOR)), + int(divide_ceil_u(fullres[1], DOF_TILE_DIVISOR))}; DRW_PASS_CREATE(psl->dof_flatten_tiles, DRW_STATE_WRITE_COLOR); @@ -464,8 +464,8 @@ static void dof_dilate_tiles_pass_init(EEVEE_FramebufferList *fbl, { void *owner = (void *)&EEVEE_depth_of_field_init; const float *fullres = DRW_viewport_size_get(); - int res[2] = {int(divide_ceil_u(fullres[0], DOF_TILE_DIVISOR)), - int(divide_ceil_u(fullres[1], DOF_TILE_DIVISOR))}; + const int res[2] = {int(divide_ceil_u(fullres[0], DOF_TILE_DIVISOR)), + int(divide_ceil_u(fullres[1], DOF_TILE_DIVISOR))}; DRW_PASS_CREATE(psl->dof_dilate_tiles_minmax, DRW_STATE_WRITE_COLOR); DRW_PASS_CREATE(psl->dof_dilate_tiles_minabs, DRW_STATE_WRITE_COLOR); @@ -558,10 +558,12 @@ static void dof_reduce_pass_init(EEVEE_FramebufferList *fbl, /* This ensure the mipmaps are aligned for the needed 4 mip levels. * Starts at 2 because already at half resolution. */ int multiple = 2 << (mip_count - 1); - int res[2] = {(multiple * int(divide_ceil_u(fullres[0], multiple))) / 2, - (multiple * int(divide_ceil_u(fullres[1], multiple))) / 2}; + const int res[2] = { + (multiple * int(divide_ceil_u(fullres[0], multiple))) / 2, + (multiple * int(divide_ceil_u(fullres[1], multiple))) / 2, + }; - int quater_res[2] = {int(divide_ceil_u(fullres[0], 4)), int(divide_ceil_u(fullres[1], 4))}; + const int quater_res[2] = {int(divide_ceil_u(fullres[0], 4)), int(divide_ceil_u(fullres[1], 4))}; /* TODO(fclem): Make this dependent of the quality of the gather pass. */ fx->dof_scatter_coc_threshold = 4.0f; @@ -676,11 +678,12 @@ static void dof_gather_pass_init(EEVEE_FramebufferList *fbl, { void *owner = (void *)&EEVEE_depth_of_field_init; const float *fullres = DRW_viewport_size_get(); - int res[2] = {int(divide_ceil_u(fullres[0], 2)), int(divide_ceil_u(fullres[1], 2))}; + const int res[2] = {int(divide_ceil_u(fullres[0], 2)), int(divide_ceil_u(fullres[1], 2))}; int input_size[2]; GPU_texture_get_mipmap_size(txl->dof_reduced_color, 0, input_size); - float uv_correction_fac[2] = {res[0] / float(input_size[0]), res[1] / float(input_size[1])}; - float output_texel_size[2] = {1.0f / res[0], 1.0f / res[1]}; + const float uv_correction_fac[2] = {res[0] / float(input_size[0]), + res[1] / float(input_size[1])}; + const float output_texel_size[2] = {1.0f / res[0], 1.0f / res[1]}; const bool use_bokeh_tx = (fx->dof_bokeh_gather_lut_tx != nullptr); { @@ -845,7 +848,7 @@ static void dof_scatter_pass_init(EEVEE_FramebufferList *fbl, GPU_texture_get_mipmap_size(fx->dof_bg_color_tx, 0, target_size); /* Draw a sprite for every four half-res pixels. */ int sprite_count = (input_size[0] / 2) * (input_size[1] / 2); - float target_texel_size[2] = {1.0f / target_size[0], 1.0f / target_size[1]}; + const float target_texel_size[2] = {1.0f / target_size[0], 1.0f / target_size[1]}; const bool use_bokeh_tx = (fx->dof_bokeh_gather_lut_tx != nullptr); { diff --git a/source/blender/draw/engines/eevee/eevee_volumes.cc b/source/blender/draw/engines/eevee/eevee_volumes.cc index 01afc8256f6..5f217b973b7 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.cc +++ b/source/blender/draw/engines/eevee/eevee_volumes.cc @@ -123,7 +123,7 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) common_data->vol_history_alpha = (txl->volume_prop_scattering == nullptr) ? 0.0f : 0.95f; /* Temporal Super sampling jitter */ - uint ht_primes[3] = {3, 7, 2}; + const uint ht_primes[3] = {3, 7, 2}; uint current_sample = 0; /* If TAA is in use do not use the history buffer. */ diff --git a/source/blender/draw/engines/eevee_next/eevee_shadow.cc b/source/blender/draw/engines/eevee_next/eevee_shadow.cc index 9caee377fef..55200fc2ba4 100644 --- a/source/blender/draw/engines/eevee_next/eevee_shadow.cc +++ b/source/blender/draw/engines/eevee_next/eevee_shadow.cc @@ -118,12 +118,14 @@ void ShadowTileMap::sync_cubeface(const float4x4 &object_mat_, void ShadowTileMap::debug_draw() const { /** Used for debug drawing. */ - float4 debug_color[6] = {{1.0f, 0.1f, 0.1f, 1.0f}, - {0.1f, 1.0f, 0.1f, 1.0f}, - {0.0f, 0.2f, 1.0f, 1.0f}, - {1.0f, 1.0f, 0.3f, 1.0f}, - {0.1f, 0.1f, 0.1f, 1.0f}, - {1.0f, 1.0f, 1.0f, 1.0f}}; + const float4 debug_color[6] = { + {1.0f, 0.1f, 0.1f, 1.0f}, + {0.1f, 1.0f, 0.1f, 1.0f}, + {0.0f, 0.2f, 1.0f, 1.0f}, + {1.0f, 1.0f, 0.3f, 1.0f}, + {0.1f, 0.1f, 0.1f, 1.0f}, + {1.0f, 1.0f, 1.0f, 1.0f}, + }; float4 color = debug_color[((projection_type == SHADOW_PROJECTION_CUBEFACE ? cubeface : level) + 9999) % 6]; diff --git a/source/blender/draw/engines/workbench/workbench_shader_cache.cc b/source/blender/draw/engines/workbench/workbench_shader_cache.cc index 003e4931339..b515c6e2fbf 100644 --- a/source/blender/draw/engines/workbench/workbench_shader_cache.cc +++ b/source/blender/draw/engines/workbench/workbench_shader_cache.cc @@ -26,11 +26,11 @@ void ShaderCache::release() ShaderCache::ShaderCache() { - std::string geometries[] = {"_mesh", "_curves", "_ptcloud"}; - std::string pipelines[] = {"_opaque", "_transparent"}; - std::string lightings[] = {"_flat", "_studio", "_matcap"}; - std::string shaders[] = {"_material", "_texture"}; - std::string clip[] = {"_no_clip", "_clip"}; + const std::string geometries[] = {"_mesh", "_curves", "_ptcloud"}; + const std::string pipelines[] = {"_opaque", "_transparent"}; + const std::string lightings[] = {"_flat", "_studio", "_matcap"}; + const std::string shaders[] = {"_material", "_texture"}; + const std::string clip[] = {"_no_clip", "_clip"}; static_assert(std::size(geometries) == geometry_type_len); static_assert(std::size(pipelines) == pipeline_type_len); static_assert(std::size(lightings) == lighting_type_len); @@ -49,9 +49,9 @@ ShaderCache::ShaderCache() } } - std::string cavity[] = {"_no_cavity", "_cavity"}; - std::string curvature[] = {"_no_curvature", "_curvature"}; - std::string shadow[] = {"_no_shadow", "_shadow"}; + const std::string cavity[] = {"_no_cavity", "_cavity"}; + const std::string curvature[] = {"_no_curvature", "_curvature"}; + const std::string shadow[] = {"_no_shadow", "_shadow"}; for (auto l : IndexRange(lighting_type_len)) { for (auto ca : IndexRange(2) /*cavity*/) { @@ -64,9 +64,9 @@ ShaderCache::ShaderCache() } } - std::string pass[] = {"_fail", "_pass"}; - std::string manifold[] = {"_no_manifold", "_manifold"}; - std::string caps[] = {"_no_caps", "_caps"}; + const std::string pass[] = {"_fail", "_pass"}; + const std::string manifold[] = {"_no_manifold", "_manifold"}; + const std::string caps[] = {"_no_caps", "_caps"}; for (auto p : IndexRange(2) /*pass*/) { for (auto m : IndexRange(2) /*manifold*/) { @@ -77,10 +77,10 @@ ShaderCache::ShaderCache() } } - std::string smoke[] = {"_object", "_smoke"}; - std::string interpolation[] = {"_linear", "_cubic", "_closest"}; - std::string coba[] = {"_no_coba", "_coba"}; - std::string slice[] = {"_no_slice", "_slice"}; + const std::string smoke[] = {"_object", "_smoke"}; + const std::string interpolation[] = {"_linear", "_cubic", "_closest"}; + const std::string coba[] = {"_no_coba", "_coba"}; + const std::string slice[] = {"_no_slice", "_slice"}; for (auto sm : IndexRange(2) /*smoke*/) { for (auto i : IndexRange(3) /*interpolation*/) { diff --git a/source/blender/draw/engines/workbench/workbench_shadow.cc b/source/blender/draw/engines/workbench/workbench_shadow.cc index 339215a5ac8..5d67b23d1a7 100644 --- a/source/blender/draw/engines/workbench/workbench_shadow.cc +++ b/source/blender/draw/engines/workbench/workbench_shadow.cc @@ -56,40 +56,46 @@ void ShadowPass::ShadowView::setup(View &view, float3 light_direction, bool forc const int z_pos = 4; /* Near */ const int z_neg = 2; /* Far */ - int3 corner_faces[8] = {{x_neg, y_neg, z_pos}, - {x_neg, y_neg, z_neg}, - {x_neg, y_pos, z_neg}, - {x_neg, y_pos, z_pos}, - {x_pos, y_neg, z_pos}, - {x_pos, y_neg, z_neg}, - {x_pos, y_pos, z_neg}, - {x_pos, y_pos, z_pos}}; + const int3 corner_faces[8] = { + {x_neg, y_neg, z_pos}, + {x_neg, y_neg, z_neg}, + {x_neg, y_pos, z_neg}, + {x_neg, y_pos, z_pos}, + {x_pos, y_neg, z_pos}, + {x_pos, y_neg, z_neg}, + {x_pos, y_pos, z_neg}, + {x_pos, y_pos, z_pos}, + }; - int2 edge_faces[12] = {{x_neg, y_neg}, - {x_neg, z_neg}, - {x_neg, y_pos}, - {x_neg, z_pos}, - {y_neg, x_pos}, - {z_neg, x_pos}, - {y_pos, x_pos}, - {z_pos, x_pos}, - {y_neg, z_pos}, - {z_neg, y_neg}, - {y_pos, z_neg}, - {z_pos, y_pos}}; + const int2 edge_faces[12] = { + {x_neg, y_neg}, + {x_neg, z_neg}, + {x_neg, y_pos}, + {x_neg, z_pos}, + {y_neg, x_pos}, + {z_neg, x_pos}, + {y_pos, x_pos}, + {z_pos, x_pos}, + {y_neg, z_pos}, + {z_neg, y_neg}, + {y_pos, z_neg}, + {z_pos, y_pos}, + }; - int2 edge_corners[12] = {{0, 1}, - {1, 2}, - {2, 3}, - {3, 0}, - {4, 5}, - {5, 6}, - {6, 7}, - {7, 4}, - {0, 4}, - {1, 5}, - {2, 6}, - {3, 7}}; + const int2 edge_corners[12] = { + {0, 1}, + {1, 2}, + {2, 3}, + {3, 0}, + {4, 5}, + {5, 6}, + {6, 7}, + {7, 4}, + {0, 4}, + {1, 5}, + {2, 6}, + {3, 7}, + }; BoundBox frustum_corners; DRW_culling_frustum_corners_get(nullptr, &frustum_corners); diff --git a/source/blender/editors/curve/editfont.cc b/source/blender/editors/curve/editfont.cc index a7890d1cb61..f8cbf2413a6 100644 --- a/source/blender/editors/curve/editfont.cc +++ b/source/blender/editors/curve/editfont.cc @@ -670,7 +670,7 @@ static void text_insert_unicode_confirm(bContext *C, void *arg_block, void *arg_ if (val > 31 && val < 0x10FFFF) { Object *obedit = CTX_data_edit_object(C); if (obedit) { - char32_t utf32[2] = {val, 0}; + const char32_t utf32[2] = {val, 0}; font_paste_wchar(obedit, utf32, 1, nullptr); text_update_edited(C, obedit, FO_EDIT); } diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.cc index fa0d1a02a4a..410ba8a8747 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.cc @@ -535,7 +535,7 @@ static void GIZMO_GT_arrow_3d(wmGizmoType *gzt) gzt->struct_size = sizeof(ArrowGizmo3D); /* rna */ - static EnumPropertyItem rna_enum_draw_style_items[] = { + static const EnumPropertyItem rna_enum_draw_style_items[] = { {ED_GIZMO_ARROW_STYLE_NORMAL, "NORMAL", 0, "Normal", ""}, {ED_GIZMO_ARROW_STYLE_CROSS, "CROSS", 0, "Cross", ""}, {ED_GIZMO_ARROW_STYLE_BOX, "BOX", 0, "Box", ""}, @@ -543,12 +543,12 @@ static void GIZMO_GT_arrow_3d(wmGizmoType *gzt) {ED_GIZMO_ARROW_STYLE_PLANE, "PLANE", 0, "Plane", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_draw_options_items[] = { + static const EnumPropertyItem rna_enum_draw_options_items[] = { {ED_GIZMO_ARROW_DRAW_FLAG_STEM, "STEM", 0, "Stem", ""}, {ED_GIZMO_ARROW_DRAW_FLAG_ORIGIN, "ORIGIN", 0, "Origin", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_transform_items[] = { + static const EnumPropertyItem rna_enum_transform_items[] = { {ED_GIZMO_ARROW_XFORM_FLAG_INVERTED, "INVERT", 0, "Inverted", ""}, {ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED, "CONSTRAIN", 0, "Constrained", ""}, {0, nullptr, 0, nullptr, nullptr}, diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.cc index 7a8409fa15e..297fbdcfa2e 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.cc @@ -398,7 +398,7 @@ static void GIZMO_GT_button_2d(wmGizmoType *gzt) gzt->struct_size = sizeof(ButtonGizmo2D); /* rna */ - static EnumPropertyItem rna_enum_draw_options[] = { + static const EnumPropertyItem rna_enum_draw_options[] = { {ED_GIZMO_BUTTON_SHOW_OUTLINE, "OUTLINE", 0, "Outline", ""}, {ED_GIZMO_BUTTON_SHOW_BACKDROP, "BACKDROP", 0, "Backdrop", ""}, {ED_GIZMO_BUTTON_SHOW_HELPLINE, "HELPLINE", 0, "Help Line", ""}, diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.cc index cb92d6621a5..569003724c8 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.cc @@ -1329,24 +1329,24 @@ static void GIZMO_GT_cage_2d(wmGizmoType *gzt) gzt->struct_size = sizeof(wmGizmo); /* rna */ - static EnumPropertyItem rna_enum_draw_style[] = { + static const EnumPropertyItem rna_enum_draw_style[] = { {ED_GIZMO_CAGE2D_STYLE_BOX, "BOX", 0, "Box", ""}, {ED_GIZMO_CAGE2D_STYLE_BOX_TRANSFORM, "BOX_TRANSFORM", 0, "Box Transform", ""}, {ED_GIZMO_CAGE2D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_transform[] = { + static const EnumPropertyItem rna_enum_transform[] = { {ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""}, {ED_GIZMO_CAGE_XFORM_FLAG_ROTATE, "ROTATE", 0, "Rotate", ""}, {ED_GIZMO_CAGE_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, {ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_draw_options[] = { + static const EnumPropertyItem rna_enum_draw_options[] = { {ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static float unit_v2[2] = {1.0f, 1.0f}; + static const float unit_v2[2] = {1.0f, 1.0f}; RNA_def_float_vector( gzt->srna, "dimensions", 2, unit_v2, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX); RNA_def_enum_flag(gzt->srna, "transform", rna_enum_transform, 0, "Transform Options", ""); diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.cc index ec4075bc330..d68b520cc58 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.cc @@ -644,22 +644,22 @@ static void GIZMO_GT_cage_3d(wmGizmoType *gzt) gzt->struct_size = sizeof(wmGizmo); /* rna */ - static EnumPropertyItem rna_enum_draw_style[] = { + static const EnumPropertyItem rna_enum_draw_style[] = { {ED_GIZMO_CAGE3D_STYLE_BOX, "BOX", 0, "Box", ""}, {ED_GIZMO_CAGE3D_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_transform[] = { + static const EnumPropertyItem rna_enum_transform[] = { {ED_GIZMO_CAGE_XFORM_FLAG_TRANSLATE, "TRANSLATE", 0, "Move", ""}, {ED_GIZMO_CAGE_XFORM_FLAG_SCALE, "SCALE", 0, "Scale", ""}, {ED_GIZMO_CAGE_XFORM_FLAG_SCALE_UNIFORM, "SCALE_UNIFORM", 0, "Scale Uniform", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_draw_options[] = { + static const EnumPropertyItem rna_enum_draw_options[] = { {ED_GIZMO_CAGE_DRAW_FLAG_XFORM_CENTER_HANDLE, "XFORM_CENTER_HANDLE", 0, "Center Handle", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static float unit_v3[3] = {1.0f, 1.0f, 1.0f}; + static const float unit_v3[3] = {1.0f, 1.0f, 1.0f}; RNA_def_float_vector( gzt->srna, "dimensions", 3, unit_v3, 0, FLT_MAX, "Dimensions", "", 0.0f, FLT_MAX); RNA_def_enum_flag(gzt->srna, "transform", rna_enum_transform, 0, "Transform Options", ""); diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.cc index b844a15485d..0d079c708c9 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.cc @@ -682,7 +682,7 @@ static void GIZMO_GT_dial_3d(wmGizmoType *gzt) gzt->struct_size = sizeof(wmGizmo); /* rna */ - static EnumPropertyItem rna_enum_draw_options[] = { + static const EnumPropertyItem rna_enum_draw_options[] = { {ED_GIZMO_DIAL_DRAW_FLAG_CLIP, "CLIP", 0, "Clipped", ""}, {ED_GIZMO_DIAL_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, {ED_GIZMO_DIAL_DRAW_FLAG_FILL_SELECT, "FILL_SELECT", 0, "Use fill for selection test", ""}, diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.cc index f61efa54393..479e90511e6 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.cc @@ -449,12 +449,12 @@ static void GIZMO_GT_move_3d(wmGizmoType *gzt) gzt->struct_size = sizeof(MoveGizmo3D); /* rna */ - static EnumPropertyItem rna_enum_draw_style[] = { + static const EnumPropertyItem rna_enum_draw_style[] = { {ED_GIZMO_MOVE_STYLE_RING_2D, "RING_2D", 0, "Ring", ""}, {ED_GIZMO_MOVE_STYLE_CROSS_2D, "CROSS_2D", 0, "Ring", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_draw_options[] = { + static const EnumPropertyItem rna_enum_draw_options[] = { {ED_GIZMO_MOVE_DRAW_FLAG_FILL, "FILL", 0, "Filled", ""}, {ED_GIZMO_MOVE_DRAW_FLAG_FILL_SELECT, "FILL_SELECT", 0, "Use fill for selection test", ""}, {ED_GIZMO_MOVE_DRAW_FLAG_ALIGN_VIEW, "ALIGN_VIEW", 0, "Align View", ""}, diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.cc b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.cc index 5f4c37be638..30a9cf76264 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.cc +++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.cc @@ -256,7 +256,7 @@ static void GIZMO_GT_primitive_3d(wmGizmoType *gzt) gzt->struct_size = sizeof(PrimitiveGizmo3D); - static EnumPropertyItem rna_enum_draw_style[] = { + static const EnumPropertyItem rna_enum_draw_style[] = { {ED_GIZMO_PRIMITIVE_STYLE_PLANE, "PLANE", 0, "Plane", ""}, {ED_GIZMO_PRIMITIVE_STYLE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {ED_GIZMO_PRIMITIVE_STYLE_ANNULUS, "ANNULUS", 0, "Annulus", ""}, diff --git a/source/blender/editors/gpencil_legacy/gpencil_edit.cc b/source/blender/editors/gpencil_legacy/gpencil_edit.cc index 78afe8fef79..4d8a3786f2c 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_edit.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_edit.cc @@ -2786,7 +2786,7 @@ static int gpencil_dissolve_exec(bContext *C, wmOperator *op) void GPENCIL_OT_dissolve(wmOperatorType *ot) { - static EnumPropertyItem prop_gpencil_dissolve_types[] = { + static const EnumPropertyItem prop_gpencil_dissolve_types[] = { {GP_DISSOLVE_POINTS, "POINTS", 0, "Dissolve", "Dissolve selected points"}, {GP_DISSOLVE_BETWEEN, "BETWEEN", diff --git a/source/blender/editors/gpencil_legacy/gpencil_fill.cc b/source/blender/editors/gpencil_legacy/gpencil_fill.cc index 77a755d4414..b0c66af13c9 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_fill.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_fill.cc @@ -258,8 +258,11 @@ static void gpencil_delete_temp_stroke_extension(tGPDfill *tgpf, const bool all_ } } -static bool extended_bbox_overlap( - float min1[3], float max1[3], float min2[3], float max2[3], float extend) +static bool extended_bbox_overlap(const float min1[3], + const float max1[3], + const float min2[3], + const float max2[3], + float extend) { for (int axis = 0; axis < 3; axis++) { float intersection_min = max_ff(min1[axis], min2[axis]) - extend; diff --git a/source/blender/editors/gpencil_legacy/gpencil_vertex_ops.cc b/source/blender/editors/gpencil_legacy/gpencil_vertex_ops.cc index 0816b1dbd4b..e4e20ead33c 100644 --- a/source/blender/editors/gpencil_legacy/gpencil_vertex_ops.cc +++ b/source/blender/editors/gpencil_legacy/gpencil_vertex_ops.cc @@ -1138,7 +1138,7 @@ static int gpencil_stroke_reset_vertex_color_exec(bContext *C, wmOperator *op) void GPENCIL_OT_stroke_reset_vertex_color(wmOperatorType *ot) { - static EnumPropertyItem mode_types_items[] = { + static const EnumPropertyItem mode_types_items[] = { {GPPAINT_MODE_STROKE, "STROKE", 0, "Stroke", "Reset Vertex Color to Stroke only"}, {GPPAINT_MODE_FILL, "FILL", 0, "Fill", "Reset Vertex Color to Fill only"}, {GPPAINT_MODE_BOTH, "BOTH", 0, "Stroke & Fill", "Reset Vertex Color to Stroke and Fill"}, diff --git a/source/blender/editors/interface/interface_draw.cc b/source/blender/editors/interface/interface_draw.cc index cd76cc91da5..4698759e921 100644 --- a/source/blender/editors/interface/interface_draw.cc +++ b/source/blender/editors/interface/interface_draw.cc @@ -904,7 +904,7 @@ static void vectorscope_draw_target( float y, u, v; float tangle = 0.0f, tampli; float dangle, dampli; - char labelstr[2] = {label, '\0'}; + const char labelstr[2] = {label, '\0'}; rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v, BLI_YUV_ITU_BT709); diff --git a/source/blender/editors/space_console/console_ops.cc b/source/blender/editors/space_console/console_ops.cc index 6d54ab32453..84a037067bf 100644 --- a/source/blender/editors/space_console/console_ops.cc +++ b/source/blender/editors/space_console/console_ops.cc @@ -1280,7 +1280,7 @@ static void console_modal_select_apply(bContext *C, wmOperator *op, const wmEven ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); SetConsoleCursor *scu = static_cast(op->customdata); - int sel_prev[2] = {sc->sel_start, sc->sel_end}; + const int sel_prev[2] = {sc->sel_start, sc->sel_end}; console_cursor_set_to_pos(sc, region, scu, event); diff --git a/source/blender/editors/space_graph/graph_draw.cc b/source/blender/editors/space_graph/graph_draw.cc index 31c38bb4fec..2ebbd3f00f3 100644 --- a/source/blender/editors/space_graph/graph_draw.cc +++ b/source/blender/editors/space_graph/graph_draw.cc @@ -184,7 +184,7 @@ static void set_fcurve_vertex_color(FCurve *fcu, bool sel) * NOTE: the caller MUST HAVE GL_LINE_SMOOTH & GL_BLEND ENABLED, otherwise the controls don't * have a consistent appearance (due to off-pixel alignments). */ -static void draw_cross(float position[2], float scale[2], uint attr_id) +static void draw_cross(float position[2], const float scale[2], uint attr_id) { GPU_matrix_push(); GPU_matrix_translate_2fv(position); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.cc b/source/blender/editors/space_sequencer/sequencer_scopes.cc index 8b5aea97d8d..9b1a8529aea 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.cc +++ b/source/blender/editors/space_sequencer/sequencer_scopes.cc @@ -123,7 +123,7 @@ ImBuf *make_waveform_view_from_ibuf(const ImBuf *ibuf) * overhead, so instead get luma coefficients as 16-bit integers. */ float coeffs[3]; IMB_colormanagement_get_luminance_coefficients(coeffs); - int muls[3] = {int(coeffs[0] * 65535), int(coeffs[1] * 65535), int(coeffs[2] * 65535)}; + const int muls[3] = {int(coeffs[0] * 65535), int(coeffs[1] * 65535), int(coeffs[2] * 65535)}; /* Parallel over x, since each column is easily independent from others. */ threading::parallel_for(IndexRange(ibuf->x), 32, [&](IndexRange x_range) { diff --git a/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc b/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc index 5f40a9d39ab..c1c8f4ae331 100644 --- a/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc +++ b/source/blender/editors/uvedit/uvedit_clipboard_graph_iso.cc @@ -155,7 +155,7 @@ static void add_bidomain(uint8_t domains[][BDS], (*bd_pos)++; } -static int calc_bound(uint8_t domains[][BDS], int bd_pos, int cur_pos) +static int calc_bound(const uint8_t domains[][BDS], int bd_pos, int cur_pos) { int bound = 0; for (int i = bd_pos - 1; i >= 0 && domains[i][P] == cur_pos; i--) { diff --git a/source/blender/geometry/intern/uv_parametrizer.cc b/source/blender/geometry/intern/uv_parametrizer.cc index 9f3c0eded08..f106d24bbe0 100644 --- a/source/blender/geometry/intern/uv_parametrizer.cc +++ b/source/blender/geometry/intern/uv_parametrizer.cc @@ -3800,8 +3800,8 @@ static void p_add_ngon(ParamHandle *handle, const ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], vkeys[v2]}; const float *tri_co[3] = {co[v0], co[v1], co[v2]}; float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]}; - bool tri_pin[3] = {pin[v0], pin[v1], pin[v2]}; - bool tri_select[3] = {select[v0], select[v1], select[v2]}; + const bool tri_pin[3] = {pin[v0], pin[v1], pin[v2]}; + const bool tri_select[3] = {select[v0], select[v1], select[v2]}; uv_parametrizer_face_add(handle, key, 3, tri_vkeys, tri_co, tri_uv, tri_pin, tri_select); } diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc index 984557ddb8e..23a473fbfa2 100644 --- a/source/blender/gpu/intern/gpu_matrix.cc +++ b/source/blender/gpu/intern/gpu_matrix.cc @@ -505,7 +505,7 @@ bool GPU_matrix_unproject_3fv(const float win[3], float r_world[3]) { zero_v3(r_world); - float in[3] = { + const float in[3] = { 2 * ((win[0] - view[0]) / view[2]) - 1.0f, 2 * ((win[1] - view[1]) / view[3]) - 1.0f, 2 * win[2] - 1.0f, diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc index e5629d44a5c..f69529d32d6 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.cc +++ b/source/blender/gpu/intern/gpu_select_sample_query.cc @@ -84,7 +84,7 @@ void gpu_select_query_begin(GPUSelectBuffer *buffer, * get rejected before the depth test. Should probably cull rect against * the viewport but this is a rare case I think */ - int viewport[4] = { + const int viewport[4] = { UNPACK2(g_query_state.viewport), BLI_rcti_size_x(input), BLI_rcti_size_y(input)}; GPU_viewport(UNPACK4(viewport)); diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 82aa5afcd65..95b546a38f4 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -436,7 +436,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(const char *name, blender::gpu::Vert GPUTexture *GPU_texture_create_error(int dimension, bool is_array) { - float pixel[4] = {1.0f, 0.0f, 1.0f, 1.0f}; + const float pixel[4] = {1.0f, 0.0f, 1.0f, 1.0f}; int w = 1; int h = (dimension < 2 && !is_array) ? 0 : 1; int d = (dimension < 3 && !is_array) ? 0 : 1; diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc index 8898395dac0..efba795bace 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.cc +++ b/source/blender/gpu/intern/gpu_vertex_format.cc @@ -243,7 +243,7 @@ void GPU_vertformat_attr_rename(GPUVertFormat *format, int attr_id, const char * /* Encode 8 original bytes into 11 safe bytes. */ static void safe_bytes(char out[11], const char data[8]) { - char safe_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + const char safe_chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; uint64_t in = *(uint64_t *)data; for (int i = 0; i < 11; i++) { diff --git a/source/blender/gpu/intern/gpu_viewport.cc b/source/blender/gpu/intern/gpu_viewport.cc index cf804db19e7..c755b5917a3 100644 --- a/source/blender/gpu/intern/gpu_viewport.cc +++ b/source/blender/gpu/intern/gpu_viewport.cc @@ -121,7 +121,7 @@ DRWData **GPU_viewport_data_get(GPUViewport *viewport) static void gpu_viewport_textures_create(GPUViewport *viewport) { int *size = viewport->size; - float empty_pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + float const empty_pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f}; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; if (viewport->color_render_tx[0] == nullptr) { diff --git a/source/blender/gpu/vulkan/vk_data_conversion_test.cc b/source/blender/gpu/vulkan/vk_data_conversion_test.cc index 58b3b02feb3..03059975964 100644 --- a/source/blender/gpu/vulkan/vk_data_conversion_test.cc +++ b/source/blender/gpu/vulkan/vk_data_conversion_test.cc @@ -257,7 +257,7 @@ TEST(VulkanDataConversion, vertex_format_multiple_attributes) TEST(VulkanDataConversion, texture_rgb16f_as_floats_to_rgba16f) { const size_t num_pixels = 4; - float input[] = { + const float input[] = { 1.0, 0.5, 0.2, @@ -289,7 +289,7 @@ TEST(VulkanDataConversion, texture_rgb16f_as_floats_to_rgba16f) TEST(VulkanDataConversion, texture_rgb32f_as_floats_to_rgba32f) { const size_t num_pixels = 4; - float input[] = { + const float input[] = { 1.0, 0.5, 0.2, diff --git a/source/blender/imbuf/intern/rectop.cc b/source/blender/imbuf/intern/rectop.cc index 6533d7b4c05..15c0e901b00 100644 --- a/source/blender/imbuf/intern/rectop.cc +++ b/source/blender/imbuf/intern/rectop.cc @@ -1107,7 +1107,7 @@ void IMB_rectfill_area_replace( return; } - uchar col_char[4] = { + const uchar col_char[4] = { uchar(col[0] * 255), uchar(col[1] * 255), uchar(col[2] * 255), uchar(col[3] * 255)}; for (int y = y1; y < y2; y++) { diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index ddda4213119..2a17e8dab3e 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -71,7 +71,7 @@ std::string get_object_dag_path_name(const Object *const ob, Object *dupli_paren return name; } -Imath::M44d convert_matrix_datatype(float mat[4][4]) +Imath::M44d convert_matrix_datatype(const float mat[4][4]) { Imath::M44d m; diff --git a/source/blender/io/alembic/intern/abc_util.h b/source/blender/io/alembic/intern/abc_util.h index 67e03e11f58..16bae242618 100644 --- a/source/blender/io/alembic/intern/abc_util.h +++ b/source/blender/io/alembic/intern/abc_util.h @@ -49,7 +49,7 @@ std::string get_valid_abc_name(const char *name); std::string get_object_dag_path_name(const Object *const ob, Object *dupli_parent); /* Convert from float to Alembic matrix representations. Does NOT convert from Z-up to Y-up. */ -Imath::M44d convert_matrix_datatype(float mat[4][4]); +Imath::M44d convert_matrix_datatype(const float mat[4][4]); /* Convert from Alembic to float matrix representations. Does NOT convert from Y-up to Z-up. */ void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4]); diff --git a/source/blender/io/alembic/tests/abc_matrix_test.cc b/source/blender/io/alembic/tests/abc_matrix_test.cc index 3d80466f15a..a9afe4d9ec2 100644 --- a/source/blender/io/alembic/tests/abc_matrix_test.cc +++ b/source/blender/io/alembic/tests/abc_matrix_test.cc @@ -164,12 +164,12 @@ TEST(abc_matrix, CopyM44AxisSwap_YfromZ) copy_m44_axis_swap(result, input, ABC_YUP_FROM_ZUP); /* Check the resulting rotation & translation. */ - float trans[4] = {1.0f, 3.0f, -2.0f, 1.0f}; + const float trans[4] = {1.0f, 3.0f, -2.0f, 1.0f}; EXPECT_V4_NEAR(trans, result[3], 1e-5f); /* This matrix was created by rotating a cube in Blender over * (X=10, Y=30, Z=-20 degrees in XZY order) and translating over (1, 3, -2) */ - float expect[4][4] = { + const float expect[4][4] = { {0.813797652721f, -0.342020124197f, -0.469846338033f, 0.0f}, {0.378522306680f, 0.925416588783f, -0.018028317019f, 0.0f}, {0.440969616174f, -0.163175910711f, 0.882564127445f, 0.0f}, @@ -198,7 +198,7 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_YfromZ) /* This matrix was created by rotating a cube in Blender over * (X=10, Y=30, Z=-20 degrees in XZY order), translating over (1, 3, -2) * and scaling over (4, 6, 5). */ - float expect[4][4] = { + const float expect[4][4] = { {3.255190610885f, -1.368080496788f, -1.879385352134f, 0.0f}, {2.271133899688f, 5.552499771118f, -0.108169898390f, 0.0f}, {2.204848051071f, -0.815879583358f, 4.412820816040f, 0.0f}, @@ -224,7 +224,7 @@ TEST(abc_matrix, CopyM44AxisSwap_ZfromY) /* This matrix was created by rotating a cube in Blender over * (X=10, Y=20, Z=30 degrees in XYZ order) and translating over (1, 2, 3) */ - float expect[4][4] = { + const float expect[4][4] = { {0.813797652721f, 0.469846338033f, -0.342020124197f, 0.0f}, {-0.44096961617f, 0.882564127445f, 0.163175910711f, 0.0f}, {0.378522306680f, 0.018028317019f, 0.925416588783f, 0.0f}, @@ -253,7 +253,7 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_ZfromY) /* This matrix was created by rotating a cube in Blender over * (X=10, Y=20, Z=30 degrees in XYZ order), translating over (1, 2, 3), * and scaling by (4, 5, 6). */ - float expect[4][4] = { + const float expect[4][4] = { {3.25519061088f, 1.879385352134f, -1.36808049678f, 0.0f}, {-2.2048480510f, 4.412820816040f, 0.81587958335f, 0.0f}, {2.27113389968f, 0.108169898390f, 5.55249977111f, 0.0f}, @@ -280,7 +280,7 @@ TEST(abc_matrix, CopyM44AxisSwapWithScale_gimbal_ZfromY) /* Since the rotation is only over the X-axis, it should not change. * The translation does change. */ - float expect[4][4] = { + const float expect[4][4] = { {1.000f, 0.000f, 0.000f, 0.000f}, {0.000f, 0.000f, -1.000f, 0.000f}, {0.000f, 1.000f, 0.000f, 0.000f}, diff --git a/source/blender/makesrna/intern/rna_brush.cc b/source/blender/makesrna/intern/rna_brush.cc index b721de0f2a6..9b52290d733 100644 --- a/source/blender/makesrna/intern/rna_brush.cc +++ b/source/blender/makesrna/intern/rna_brush.cc @@ -1459,14 +1459,14 @@ static void rna_def_gpencil_options(BlenderRNA *brna) PropertyRNA *prop; /* modes */ - static EnumPropertyItem gppaint_mode_types_items[] = { + static const EnumPropertyItem gppaint_mode_types_items[] = { {GPPAINT_MODE_STROKE, "STROKE", 0, "Stroke", "Vertex Color affects to Stroke only"}, {GPPAINT_MODE_FILL, "FILL", 0, "Fill", "Vertex Color affects to Fill only"}, {GPPAINT_MODE_BOTH, "BOTH", 0, "Stroke & Fill", "Vertex Color affects to Stroke and Fill"}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem rna_enum_gpencil_brush_caps_types_items[] = { + static const EnumPropertyItem rna_enum_gpencil_brush_caps_types_items[] = { {GP_STROKE_CAP_ROUND, "ROUND", ICON_GP_CAPS_ROUND, "Round", ""}, {GP_STROKE_CAP_FLAT, "FLAT", ICON_GP_CAPS_FLAT, "Flat", ""}, {0, nullptr, 0, nullptr, nullptr}, diff --git a/source/blender/makesrna/intern/rna_fluid.cc b/source/blender/makesrna/intern/rna_fluid.cc index 6657581dbef..3e5cce2bf6e 100644 --- a/source/blender/makesrna/intern/rna_fluid.cc +++ b/source/blender/makesrna/intern/rna_fluid.cc @@ -1242,7 +1242,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem domain_types[] = { + static const EnumPropertyItem domain_types[] = { {FLUID_DOMAIN_TYPE_GAS, "GAS", 0, "Gas", "Create domain for gases"}, {FLUID_DOMAIN_TYPE_LIQUID, "LIQUID", 0, "Liquid", "Create domain for liquids"}, {0, nullptr, 0, nullptr, nullptr}}; @@ -1266,7 +1266,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem cache_types[] = { + static const EnumPropertyItem cache_types[] = { {FLUID_DOMAIN_CACHE_REPLAY, "REPLAY", 0, "Replay", "Use the timeline to bake the scene"}, {FLUID_DOMAIN_CACHE_MODULAR, "MODULAR", @@ -1277,12 +1277,12 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}}; /* OpenVDB data depth - generated dynamically based on domain type */ - static EnumPropertyItem fluid_data_depth_items[] = { + static const EnumPropertyItem fluid_data_depth_items[] = { {0, "NONE", 0, "", ""}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem fluid_mesh_quality_items[] = { + static const EnumPropertyItem fluid_mesh_quality_items[] = { {FLUID_DOMAIN_MESH_IMPROVED, "IMPROVED", 0, @@ -1297,7 +1297,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem fluid_guide_source_items[] = { + static const EnumPropertyItem fluid_guide_source_items[] = { {FLUID_DOMAIN_GUIDE_SRC_DOMAIN, "DOMAIN", 0, @@ -1314,7 +1314,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) }; /* Cache type - generated dynamically based on domain type */ - static EnumPropertyItem cache_file_type_items[] = { + static const EnumPropertyItem cache_file_type_items[] = { {0, "NONE", 0, "", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -1434,7 +1434,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) "Create one particle system that contains all three secondary particle types"}, {0, nullptr, 0, nullptr, nullptr}}; - static EnumPropertyItem simulation_methods[] = { + static const EnumPropertyItem simulation_methods[] = { {FLUID_DOMAIN_METHOD_FLIP, "FLIP", 0, @@ -2676,7 +2676,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem flow_behavior_items[] = { + static const EnumPropertyItem flow_behavior_items[] = { {FLUID_FLOW_BEHAVIOR_INFLOW, "INFLOW", 0, "Inflow", "Add fluid to simulation"}, {FLUID_FLOW_BEHAVIOR_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete fluid from simulation"}, {FLUID_FLOW_BEHAVIOR_GEOMETRY, @@ -2688,7 +2688,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) }; /* Flow source - generated dynamically based on flow type */ - static EnumPropertyItem flow_sources[] = { + static const EnumPropertyItem flow_sources[] = { {0, "NONE", 0, "", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -2909,13 +2909,13 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) static void rna_def_fluid_effector_settings(BlenderRNA *brna) { - static EnumPropertyItem effector_type_items[] = { + static const EnumPropertyItem effector_type_items[] = { {FLUID_EFFECTOR_TYPE_COLLISION, "COLLISION", 0, "Collision", "Create collision object"}, {FLUID_EFFECTOR_TYPE_GUIDE, "GUIDE", 0, "Guide", "Create guide object"}, {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem fluid_guide_mode_items[] = { + static const EnumPropertyItem fluid_guide_mode_items[] = { {FLUID_EFFECTOR_GUIDE_MAX, "MAXIMUM", 0, diff --git a/source/blender/makesrna/intern/rna_gpencil_legacy.cc b/source/blender/makesrna/intern/rna_gpencil_legacy.cc index 9e0dd54f093..cfb405bfb0b 100644 --- a/source/blender/makesrna/intern/rna_gpencil_legacy.cc +++ b/source/blender/makesrna/intern/rna_gpencil_legacy.cc @@ -2444,9 +2444,9 @@ static void rna_def_gpencil_data(BlenderRNA *brna) PropertyRNA *prop; FunctionRNA *func; - static float default_1[4] = {0.6f, 0.6f, 0.6f, 0.5f}; - static float onion_dft1[3] = {0.145098f, 0.419608f, 0.137255f}; /* green */ - static float onion_dft2[3] = {0.125490f, 0.082353f, 0.529412f}; /* blue */ + static const float default_1[4] = {0.6f, 0.6f, 0.6f, 0.5f}; + static const float onion_dft1[3] = {0.145098f, 0.419608f, 0.137255f}; /* green */ + static const float onion_dft2[3] = {0.125490f, 0.082353f, 0.529412f}; /* blue */ static const EnumPropertyItem stroke_thickness_items[] = { {0, "WORLDSPACE", 0, "World Space", "Set stroke thickness relative to the world space"}, diff --git a/source/blender/makesrna/intern/rna_gpencil_legacy_modifier.cc b/source/blender/makesrna/intern/rna_gpencil_legacy_modifier.cc index 4e1efc80c0e..91c713317f8 100644 --- a/source/blender/makesrna/intern/rna_gpencil_legacy_modifier.cc +++ b/source/blender/makesrna/intern/rna_gpencil_legacy_modifier.cc @@ -1335,7 +1335,7 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_gpencil_simplify_mode_items[] = { + static const EnumPropertyItem prop_gpencil_simplify_mode_items[] = { {GP_SIMPLIFY_FIXED, "FIXED", ICON_IPO_CONSTANT, @@ -1572,7 +1572,7 @@ static void rna_def_modifier_gpenciloffset(BlenderRNA *brna) PropertyRNA *prop; RNA_define_lib_overridable(true); - static EnumPropertyItem rna_enum_offset_mode_items[] = { + static const EnumPropertyItem rna_enum_offset_mode_items[] = { {GP_OFFSET_RANDOM, "RANDOM", 0, "Random", "Randomize stroke offset"}, {GP_OFFSET_LAYER, "LAYER", 0, "Layer", "Offset layers by the same factor"}, {GP_OFFSET_STROKE, @@ -1718,7 +1718,7 @@ static void rna_def_modifier_gpenciltint(BlenderRNA *brna) PropertyRNA *prop; /* modes */ - static EnumPropertyItem tint_mode_types_items[] = { + static const EnumPropertyItem tint_mode_types_items[] = { {GPPAINT_MODE_STROKE, "STROKE", 0, "Stroke", "Vertex Color affects to Stroke only"}, {GPPAINT_MODE_FILL, "FILL", 0, "Fill", "Vertex Color affects to Fill only"}, {GPPAINT_MODE_BOTH, "BOTH", 0, "Stroke & Fill", "Vertex Color affects to Stroke and Fill"}, @@ -2456,7 +2456,7 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna) static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) { - static EnumPropertyItem prop_gpencil_build_mode_items[] = { + static const EnumPropertyItem prop_gpencil_build_mode_items[] = { {GP_BUILD_MODE_SEQUENTIAL, "SEQUENTIAL", 0, @@ -2475,7 +2475,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem prop_gpencil_build_transition_items[] = { + static const EnumPropertyItem prop_gpencil_build_transition_items[] = { {GP_BUILD_TRANSITION_GROW, "GROW", 0, @@ -2497,7 +2497,7 @@ static void rna_def_modifier_gpencilbuild(BlenderRNA *brna) {0, nullptr, 0, nullptr, nullptr}, }; - static EnumPropertyItem prop_gpencil_build_time_align_items[] = { + static const EnumPropertyItem prop_gpencil_build_time_align_items[] = { {GP_BUILD_TIMEALIGN_START, "START", 0, diff --git a/source/blender/makesrna/intern/rna_node_socket.cc b/source/blender/makesrna/intern/rna_node_socket.cc index d2c65fc6fc9..25d2569a657 100644 --- a/source/blender/makesrna/intern/rna_node_socket.cc +++ b/source/blender/makesrna/intern/rna_node_socket.cc @@ -489,7 +489,7 @@ static void rna_def_node_socket(BlenderRNA *brna) {SOCK_DISPLAY_SHAPE_DIAMOND_DOT, "DIAMOND_DOT", 0, "Diamond with inner dot", ""}, {0, nullptr, 0, nullptr, nullptr}}; - static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; + static const float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; srna = RNA_def_struct(brna, "NodeSocket", nullptr); RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node"); @@ -674,7 +674,7 @@ static void rna_def_node_socket_standard(BlenderRNA *brna) PropertyRNA *parm; FunctionRNA *func; - static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; + static const float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f}; srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket"); RNA_def_struct_sdna(srna, "bNodeSocket"); diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index d3d4d961319..f9f68cbd9eb 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -3466,7 +3466,7 @@ static void rna_def_text(StructRNA *srna) static void rna_def_color_mix(StructRNA *srna) { - static EnumPropertyItem blend_color_items[] = { + static const EnumPropertyItem blend_color_items[] = { {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""}, {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""}, {SEQ_TYPE_COLOR_BURN, "BURN", 0, "Color Burn", ""}, diff --git a/source/blender/makesrna/intern/rna_shader_fx.cc b/source/blender/makesrna/intern/rna_shader_fx.cc index 59153d4ffa0..95ce6860757 100644 --- a/source/blender/makesrna/intern/rna_shader_fx.cc +++ b/source/blender/makesrna/intern/rna_shader_fx.cc @@ -282,7 +282,7 @@ static void rna_def_shader_fx_wave(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_shaderfx_wave_type_items[] = { + static const EnumPropertyItem prop_shaderfx_wave_type_items[] = { {0, "HORIZONTAL", 0, "Horizontal", ""}, {1, "VERTICAL", 0, "Vertical", ""}, {0, nullptr, 0, nullptr, nullptr}}; @@ -406,7 +406,7 @@ static void rna_def_shader_fx_rim(BlenderRNA *brna) static void rna_def_shader_fx_shadow(BlenderRNA *brna) { - static EnumPropertyItem prop_shaderfx_shadow_type_items[] = { + static const EnumPropertyItem prop_shaderfx_shadow_type_items[] = { {0, "HORIZONTAL", 0, "Horizontal", ""}, {1, "VERTICAL", 0, "Vertical", ""}, {0, nullptr, 0, nullptr, nullptr}}; diff --git a/source/blender/makesrna/intern/rna_ui_api.cc b/source/blender/makesrna/intern/rna_ui_api.cc index fa2cac3b744..27a8f56bbf7 100644 --- a/source/blender/makesrna/intern/rna_ui_api.cc +++ b/source/blender/makesrna/intern/rna_ui_api.cc @@ -1096,7 +1096,7 @@ void RNA_api_ui_layout(StructRNA *srna) {0, nullptr, 0, nullptr, nullptr}, }; - static float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f}; + static const float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "rna_uiLayoutRowWithHeading"); diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 348e7d934e5..ebea4b45dab 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -4660,8 +4660,8 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static float default_dir[3] = {0.0f, 0.0f, 1.0f}; - static float default_col[3] = {0.8f, 0.8f, 0.8f}; + static const float default_dir[3] = {0.0f, 0.0f, 1.0f}; + static const float default_col[3] = {0.8f, 0.8f, 0.8f}; srna = RNA_def_struct(brna, "UserSolidLight", nullptr); RNA_def_struct_sdna(srna, "SolidLight"); diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.cc b/source/blender/makesrna/intern/rna_wm_gizmo.cc index 64fcc656f07..f4fca6fc1f8 100644 --- a/source/blender/makesrna/intern/rna_wm_gizmo.cc +++ b/source/blender/makesrna/intern/rna_wm_gizmo.cc @@ -1082,7 +1082,7 @@ static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_return(func, parm); /* wmGizmo.handler */ - static EnumPropertyItem tweak_actions[] = { + static const EnumPropertyItem tweak_actions[] = { {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""}, {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""}, {0, nullptr, 0, nullptr, nullptr}, @@ -1391,7 +1391,7 @@ static void rna_def_gizmogroup(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* bl_options */ - static EnumPropertyItem gizmogroup_flag_items[] = { + static const EnumPropertyItem gizmogroup_flag_items[] = { {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D", "Use in 3D viewport"}, {WM_GIZMOGROUPTYPE_SCALE, "SCALE", diff --git a/source/blender/makesrna/intern/rna_world.cc b/source/blender/makesrna/intern/rna_world.cc index fc3b7b7c867..962f7d25c6e 100644 --- a/source/blender/makesrna/intern/rna_world.cc +++ b/source/blender/makesrna/intern/rna_world.cc @@ -211,7 +211,7 @@ void RNA_def_world(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static float default_world_color[] = {0.05f, 0.05f, 0.05f}; + static const float default_world_color[] = {0.05f, 0.05f, 0.05f}; srna = RNA_def_struct(brna, "World", "ID"); RNA_def_struct_ui_text( diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc index 1ca1809a301..daeb3f28a0b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -105,7 +105,7 @@ static int node_shader_gpu_volume_principled(GPUMaterial *mat, } /* Default values if attributes not found. */ - static float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; if (!density) { density = GPU_constant(white); } diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc index 6ee92d0c672..95800f5752b 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_group.cc @@ -632,7 +632,7 @@ wmKeyMap *wm_gizmogroup_tweak_modal_keymap(wmKeyConfig *keyconf) wmKeyMap *keymap; char name[KMAP_MAX_NAME]; - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {TWEAK_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {TWEAK_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {TWEAK_MODAL_PRECISION_ON, "PRECISION_ON", 0, "Enable Precision", ""},