Cleanup: declare arrays as const where possible

This commit is contained in:
Campbell Barton
2024-03-28 22:57:57 +11:00
parent 28c53cccd3
commit 686605a6dd
56 changed files with 199 additions and 185 deletions

View File

@@ -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));

View File

@@ -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);
}

View File

@@ -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).

View File

@@ -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)
{

View File

@@ -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]) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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));

View File

@@ -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);

View File

@@ -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},

View File

@@ -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));

View File

@@ -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);
{

View File

@@ -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. */

View File

@@ -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];

View File

@@ -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*/) {

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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},

View File

@@ -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", ""},

View File

@@ -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", "");

View File

@@ -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", "");

View File

@@ -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", ""},

View File

@@ -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", ""},

View File

@@ -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", ""},

View File

@@ -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",

View File

@@ -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;

View File

@@ -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"},

View File

@@ -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);

View File

@@ -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<SetConsoleCursor *>(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);

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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--) {

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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));

View File

@@ -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;

View File

@@ -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++) {

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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++) {

View File

@@ -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;

View File

@@ -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]);

View File

@@ -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},

View File

@@ -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},

View File

@@ -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,

View File

@@ -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"},

View File

@@ -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,

View File

@@ -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");

View File

@@ -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", ""},

View File

@@ -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}};

View File

@@ -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");

View File

@@ -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");

View File

@@ -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",

View File

@@ -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(

View File

@@ -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);
}

View File

@@ -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", ""},