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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-25 11:33:28 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 13:17:08 +0300
commitf68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch)
tree2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/editors
parentc7b247a118e302a3afc6473797e53b6af28b69e2 (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/asset/intern/asset_ops.cc4
-rw-r--r--source/blender/editors/curves/intern/curves_add.cc2
-rw-r--r--source/blender/editors/curves/intern/curves_ops.cc2
-rw-r--r--source/blender/editors/gpencil/gpencil_bake_animation.cc4
-rw-r--r--source/blender/editors/gpencil/gpencil_mesh.cc4
-rw-r--r--source/blender/editors/interface/interface.cc126
-rw-r--r--source/blender/editors/interface/interface_dropboxes.cc2
-rw-r--r--source/blender/editors/interface/interface_panel.cc26
-rw-r--r--source/blender/editors/interface/interface_query.cc2
-rw-r--r--source/blender/editors/interface/interface_region_color_picker.cc2
-rw-r--r--source/blender/editors/interface/interface_region_popover.cc6
-rw-r--r--source/blender/editors/interface/interface_region_search.cc2
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.cc2
-rw-r--r--source/blender/editors/interface/interface_style.cc32
-rw-r--r--source/blender/editors/interface/interface_template_list.cc8
-rw-r--r--source/blender/editors/interface/interface_template_search_menu.cc8
-rw-r--r--source/blender/editors/interface/interface_utils.cc4
-rw-r--r--source/blender/editors/interface/view2d.cc108
-rw-r--r--source/blender/editors/interface/view2d_draw.cc10
-rw-r--r--source/blender/editors/interface/view2d_edge_pan.cc16
-rw-r--r--source/blender/editors/interface/view2d_ops.cc10
-rw-r--r--source/blender/editors/interface/views/grid_view.cc4
-rw-r--r--source/blender/editors/mesh/editface.cc6
-rw-r--r--source/blender/editors/mesh/mesh_data.cc4
-rw-r--r--source/blender/editors/mesh/meshtools.cc8
-rw-r--r--source/blender/editors/object/object_add.cc2
-rw-r--r--source/blender/editors/object/object_modifier.cc2
-rw-r--r--source/blender/editors/object/object_remesh.cc10
-rw-r--r--source/blender/editors/object/object_transform.cc4
-rw-r--r--source/blender/editors/render/render_preview.cc18
-rw-r--r--source/blender/editors/render/render_shading.cc2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_brush.cc2
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_density.cc4
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_ops.cc2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc10
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.cc10
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_automasking.cc2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.cc4
-rw-r--r--source/blender/editors/space_file/filelist.cc14
-rw-r--r--source/blender/editors/space_node/drawnode.cc2
-rw-r--r--source/blender/editors/space_node/node_draw.cc46
-rw-r--r--source/blender/editors/space_node/node_edit.cc4
-rw-r--r--source/blender/editors/space_node/node_gizmo.cc4
-rw-r--r--source/blender/editors/space_node/node_relationships.cc2
-rw-r--r--source/blender/editors/space_node/node_select.cc5
-rw-r--r--source/blender/editors/space_node/node_view.cc24
-rw-r--r--source/blender/editors/space_node/space_node.cc6
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.cc118
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.cc8
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.cc2
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_layout.cc4
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc4
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.cc4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.cc20
-rw-r--r--source/blender/editors/transform/transform_snap_object.cc2
-rw-r--r--source/blender/editors/uvedit/uvedit_islands.cc2
57 files changed, 373 insertions, 374 deletions
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index ba7b56db3ec..5aac4f02b03 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -925,9 +925,9 @@ static bool has_external_files(Main *bmain, struct ReportList *reports)
callback_info.reports,
RPT_ERROR,
"Unable to copy bundle due to %zu external dependencies; more details on the console",
- (size_t)callback_info.external_files.size());
+ size_t(callback_info.external_files.size()));
printf("Unable to copy bundle due to %zu external dependencies:\n",
- (size_t)callback_info.external_files.size());
+ size_t(callback_info.external_files.size()));
for (const std::string &path : callback_info.external_files) {
printf(" \"%s\"\n", path.c_str());
}
diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc
index f234a58f439..edcd1e32cc1 100644
--- a/source/blender/editors/curves/intern/curves_add.cc
+++ b/source/blender/editors/curves/intern/curves_add.cc
@@ -125,7 +125,7 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi
float3 co = no;
for (int key = 0; key < points_per_curve; key++) {
- float t = key / (float)(points_per_curve - 1);
+ float t = key / float(points_per_curve - 1);
curve_positions[key] = co;
curve_radii[key] = 0.02f * (1.0f - t);
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc
index eb3e40f9f76..2c643225072 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -336,7 +336,7 @@ static void try_convert_single_object(Object &curves_ob,
HairKey &key = hair_keys[key_i];
copy_v3_v3(key.co, key_pos_ha);
- key.time = 100.0f * key_i / (float)(hair_keys.size() - 1);
+ key.time = 100.0f * key_i / float(hair_keys.size() - 1);
}
}
diff --git a/source/blender/editors/gpencil/gpencil_bake_animation.cc b/source/blender/editors/gpencil/gpencil_bake_animation.cc
index 28d4e1c6d42..927bb83ef51 100644
--- a/source/blender/editors/gpencil/gpencil_bake_animation.cc
+++ b/source/blender/editors/gpencil/gpencil_bake_animation.cc
@@ -119,7 +119,7 @@ static void animdata_keyframe_list_get(ListBase *ob_list,
/* Keyframe number is x value of point. */
if ((bezt->f2 & SELECT) || (!only_selected)) {
/* Insert only one key for each keyframe number. */
- int key = (int)bezt->vec[1][0];
+ int key = int(bezt->vec[1][0]);
if (!BLI_ghash_haskey(r_keyframes, POINTER_FROM_INT(key))) {
BLI_ghash_insert(r_keyframes, POINTER_FROM_INT(key), POINTER_FROM_INT(key));
}
@@ -243,7 +243,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op
}
/* Loop all frame range. */
- int oldframe = (int)DEG_get_ctime(depsgraph);
+ int oldframe = int(DEG_get_ctime(depsgraph));
int key = -1;
/* Get list of keyframes. */
diff --git a/source/blender/editors/gpencil/gpencil_mesh.cc b/source/blender/editors/gpencil/gpencil_mesh.cc
index 739a1b319c3..11d865f814c 100644
--- a/source/blender/editors/gpencil/gpencil_mesh.cc
+++ b/source/blender/editors/gpencil/gpencil_mesh.cc
@@ -91,7 +91,7 @@ static void animdata_keyframe_list_get(ListBase *ob_list,
/* Keyframe number is x value of point. */
if ((bezt->f2 & SELECT) || (!only_selected)) {
/* Insert only one key for each keyframe number. */
- int key = (int)bezt->vec[1][0];
+ int key = int(bezt->vec[1][0]);
if (!BLI_ghash_haskey(r_keyframes, POINTER_FROM_INT(key))) {
BLI_ghash_insert(r_keyframes, POINTER_FROM_INT(key), POINTER_FROM_INT(key));
}
@@ -261,7 +261,7 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op)
}
/* Loop all frame range. */
- int oldframe = (int)DEG_get_ctime(depsgraph);
+ int oldframe = int(DEG_get_ctime(depsgraph));
int key = -1;
/* Get list of keyframes. */
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index 64f7e035d3f..b2d2fa64fde 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -133,10 +133,10 @@ void ui_block_to_region_fl(const ARegion *region, uiBlock *block, float *r_x, fl
gy += block->panel->ofsy;
}
- *r_x = ((float)getsizex) * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] +
- block->winmat[3][0]));
- *r_y = ((float)getsizey) * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] +
- block->winmat[3][1]));
+ *r_x = float(getsizex) * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] +
+ block->winmat[3][0]));
+ *r_y = float(getsizey) * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] +
+ block->winmat[3][1]));
}
void ui_block_to_window_fl(const ARegion *region, uiBlock *block, float *r_x, float *r_y)
@@ -153,8 +153,8 @@ void ui_block_to_window(const ARegion *region, uiBlock *block, int *r_x, int *r_
ui_block_to_window_fl(region, block, &fx, &fy);
- *r_x = (int)lround(fx);
- *r_y = (int)lround(fy);
+ *r_x = int(lround(fx));
+ *r_y = int(lround(fy));
}
void ui_block_to_region_rctf(const ARegion *region,
@@ -195,13 +195,13 @@ void ui_window_to_block_fl(const ARegion *region, uiBlock *block, float *r_x, fl
const int sx = region->winrct.xmin;
const int sy = region->winrct.ymin;
- const float a = 0.5f * ((float)getsizex) * block->winmat[0][0];
- const float b = 0.5f * ((float)getsizex) * block->winmat[1][0];
- const float c = 0.5f * ((float)getsizex) * (1.0f + block->winmat[3][0]);
+ const float a = 0.5f * float(getsizex) * block->winmat[0][0];
+ const float b = 0.5f * float(getsizex) * block->winmat[1][0];
+ const float c = 0.5f * float(getsizex) * (1.0f + block->winmat[3][0]);
- const float d = 0.5f * ((float)getsizey) * block->winmat[0][1];
- const float e = 0.5f * ((float)getsizey) * block->winmat[1][1];
- const float f = 0.5f * ((float)getsizey) * (1.0f + block->winmat[3][1]);
+ const float d = 0.5f * float(getsizey) * block->winmat[0][1];
+ const float e = 0.5f * float(getsizey) * block->winmat[1][1];
+ const float f = 0.5f * float(getsizey) * (1.0f + block->winmat[3][1]);
const float px = *r_x - sx;
const float py = *r_y - sy;
@@ -232,8 +232,8 @@ void ui_window_to_block(const ARegion *region, uiBlock *block, int *r_x, int *r_
ui_window_to_block_fl(region, block, &fx, &fy);
- *r_x = (int)lround(fx);
- *r_y = (int)lround(fy);
+ *r_x = int(lround(fx));
+ *r_y = int(lround(fy));
}
void ui_window_to_region(const ARegion *region, int *r_x, int *r_y)
@@ -279,8 +279,8 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
rcti rect;
ui_but_to_pixelrect(&rect, region, block, static_cast<const uiBut *>(block->buttons.last));
- const float buttons_width = (float)rect.xmax + UI_HEADER_OFFSET;
- const float region_width = (float)region->sizex * U.dpi_fac;
+ const float buttons_width = float(rect.xmax) + UI_HEADER_OFFSET;
+ const float region_width = float(region->sizex) * U.dpi_fac;
if (region_width <= buttons_width) {
return;
@@ -296,7 +296,7 @@ static void ui_update_flexible_spacing(const ARegion *region, uiBlock *block)
}
const float view_scale_x = UI_view2d_scale_get_x(&region->v2d);
- const float segment_width = region_width / (float)sepr_flex_len;
+ const float segment_width = region_width / float(sepr_flex_len);
float offset = 0, remaining_space = region_width - buttons_width;
int i = 0;
LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
@@ -502,8 +502,8 @@ static void ui_block_bounds_calc_centered(wmWindow *window, uiBlock *block)
static void ui_block_bounds_calc_centered_pie(uiBlock *block)
{
const int xy[2] = {
- (int)block->pie_data.pie_center_spawned[0],
- (int)block->pie_data.pie_center_spawned[1],
+ int(block->pie_data.pie_center_spawned[0]),
+ int(block->pie_data.pie_center_spawned[1]),
};
UI_block_translate(block, xy[0], xy[1]);
@@ -682,7 +682,7 @@ static int ui_but_calc_float_precision(uiBut *but, double value)
return 0;
}
- int prec = (int)ui_but_get_float_precision(but);
+ int prec = int(ui_but_get_float_precision(but));
/* first check for various special cases:
* * If button is radians, we want additional precision (see T39861).
@@ -1411,7 +1411,7 @@ static bool ui_but_event_property_operator_string(const bContext *C,
ui_def_but_rna__menu,
ui_def_but_rna__panel_type,
ui_def_but_rna__menu_type)) {
- prop_enum_value = (int)but->hardmin;
+ prop_enum_value = int(but->hardmin);
ptr = &but_parent->rnapoin;
prop = but_parent->rnaprop;
prop_enum_value_ok = true;
@@ -1804,7 +1804,7 @@ static void ui_but_predefined_extra_operator_icons_add(uiBut *but)
return;
}
}
- ui_but_extra_operator_icon_add_ptr(but, optype, WM_OP_INVOKE_DEFAULT, (int)icon);
+ ui_but_extra_operator_icon_add_ptr(but, optype, WM_OP_INVOKE_DEFAULT, int(icon));
}
}
@@ -1853,7 +1853,7 @@ static void ui_but_validate(const uiBut *but)
uiButNumber *number_but = (uiButNumber *)but;
if (ELEM(but->pointype, UI_BUT_POIN_CHAR, UI_BUT_POIN_SHORT, UI_BUT_POIN_INT)) {
- BLI_assert((int)number_but->step_size > 0);
+ BLI_assert(int(number_but->step_size) > 0);
}
}
}
@@ -2165,7 +2165,7 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N);
int lvalue;
UI_GET_BUT_VALUE_INIT(but, *value);
- lvalue = (int)*value;
+ lvalue = int(*value);
if (UI_BITBUT_TEST(lvalue, (but->bitnr))) {
is_push = state;
}
@@ -2187,7 +2187,7 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
case UI_BTYPE_ICON_TOGGLE:
case UI_BTYPE_CHECKBOX:
UI_GET_BUT_VALUE_INIT(but, *value);
- if (*value != (double)but->hardmin) {
+ if (*value != double(but->hardmin)) {
is_push = true;
}
break;
@@ -2220,12 +2220,12 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
UI_GET_BUT_VALUE_INIT(but, *value);
/* support for rna enum buts */
if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
- if ((int)*value & (int)but->hardmax) {
+ if (int(*value) & int(but->hardmax)) {
is_push = true;
}
}
else {
- if (*value == (double)but->hardmax) {
+ if (*value == double(but->hardmax)) {
is_push = true;
}
}
@@ -2246,7 +2246,7 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
}
if ((but->drawflag & UI_BUT_CHECKBOX_INVERT) && (is_push != -1)) {
- is_push = !((bool)is_push);
+ is_push = !bool(is_push);
}
return is_push;
}
@@ -2315,9 +2315,9 @@ void ui_but_v3_get(uiBut *but, float vec[3])
}
else if (but->pointype == UI_BUT_POIN_CHAR) {
const char *cp = (char *)but->poin;
- vec[0] = ((float)cp[0]) / 255.0f;
- vec[1] = ((float)cp[1]) / 255.0f;
- vec[2] = ((float)cp[2]) / 255.0f;
+ vec[0] = float(cp[0]) / 255.0f;
+ vec[1] = float(cp[1]) / 255.0f;
+ vec[2] = float(cp[2]) / 255.0f;
}
else if (but->pointype == UI_BUT_POIN_FLOAT) {
const float *fp = (float *)but->poin;
@@ -2363,9 +2363,9 @@ void ui_but_v3_set(uiBut *but, const float vec[3])
}
else if (but->pointype == UI_BUT_POIN_CHAR) {
char *cp = (char *)but->poin;
- cp[0] = (char)lround(vec[0] * 255.0f);
- cp[1] = (char)lround(vec[1] * 255.0f);
- cp[2] = (char)lround(vec[2] * 255.0f);
+ cp[0] = char(lround(vec[0] * 255.0f));
+ cp[1] = char(lround(vec[1] * 255.0f));
+ cp[2] = char(lround(vec[2] * 255.0f));
}
else if (but->pointype == UI_BUT_POIN_FLOAT) {
float *fp = (float *)but->poin;
@@ -2572,10 +2572,10 @@ void ui_but_value_set(uiBut *but, double value)
break;
case PROP_INT:
if (RNA_property_array_check(prop)) {
- RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
+ RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, int(value));
}
else {
- RNA_property_int_set(&but->rnapoin, prop, (int)value);
+ RNA_property_int_set(&but->rnapoin, prop, int(value));
}
break;
case PROP_FLOAT:
@@ -2588,7 +2588,7 @@ void ui_but_value_set(uiBut *but, double value)
break;
case PROP_ENUM:
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
- int ivalue = (int)value;
+ int ivalue = int(value);
/* toggle for enum/flag buttons */
ivalue ^= RNA_property_enum_get(&but->rnapoin, prop);
RNA_property_enum_set(&but->rnapoin, prop, ivalue);
@@ -2621,7 +2621,7 @@ void ui_but_value_set(uiBut *but, double value)
value = round_db_to_int_clamp(value);
}
else if (but->pointype == UI_BUT_POIN_FLOAT) {
- float fval = (float)value;
+ float fval = float(value);
if (fval >= -0.00001f && fval <= 0.00001f) {
/* prevent negative zero */
fval = 0.0f;
@@ -2634,16 +2634,16 @@ void ui_but_value_set(uiBut *but, double value)
value = *but->editval = value;
}
else if (but->pointype == UI_BUT_POIN_CHAR) {
- value = *((char *)but->poin) = (char)value;
+ value = *((char *)but->poin) = char(value);
}
else if (but->pointype == UI_BUT_POIN_SHORT) {
- value = *((short *)but->poin) = (short)value;
+ value = *((short *)but->poin) = short(value);
}
else if (but->pointype == UI_BUT_POIN_INT) {
- value = *((int *)but->poin) = (int)value;
+ value = *((int *)but->poin) = int(value);
}
else if (but->pointype == UI_BUT_POIN_FLOAT) {
- value = *((float *)but->poin) = (float)value;
+ value = *((float *)but->poin) = float(value);
}
}
@@ -2721,7 +2721,7 @@ static void ui_get_but_string_unit(
/* Use precision override? */
if (float_precision == -1) {
/* Sanity checks */
- precision = (int)ui_but_get_float_precision(but);
+ precision = int(ui_but_get_float_precision(but));
if (precision > UI_PRECISION_FLOAT_MAX) {
precision = UI_PRECISION_FLOAT_MAX;
}
@@ -2763,7 +2763,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
BLI_assert(step > 0.0);
- step_final = (step / scale_unit) / (double)UI_PRECISION_FLOAT_SCALE;
+ step_final = (step / scale_unit) / double(UI_PRECISION_FLOAT_SCALE);
if (step == step_unit) {
/* Logic here is to scale by the original 'step_orig'
@@ -2775,7 +2775,7 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
step_final *= step_orig;
}
- return (float)step_final;
+ return float(step_final);
}
void ui_but_string_get_ex(uiBut *but,
@@ -2904,7 +2904,7 @@ void ui_but_string_get_ex(uiBut *but,
}
}
else {
- BLI_snprintf(str, maxlen, "%d", (int)value);
+ BLI_snprintf(str, maxlen, "%d", int(value));
}
}
}
@@ -3211,10 +3211,10 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
}
/* not that we use hard limits here */
- if (value < (double)but->hardmin) {
+ if (value < double(but->hardmin)) {
value = but->hardmin;
}
- if (value > (double)but->hardmax) {
+ if (value > double(but->hardmax)) {
value = but->hardmax;
}
@@ -3307,8 +3307,8 @@ void ui_but_range_set_soft(uiBut *but)
if (is_array) {
int value_range[2];
RNA_property_int_get_array_range(&but->rnapoin, but->rnaprop, value_range);
- value_min = (double)value_range[0];
- value_max = (double)value_range[1];
+ value_min = double(value_range[0]);
+ value_max = double(value_range[1]);
}
else {
value_min = value_max = ui_but_value_get(but);
@@ -3319,8 +3319,8 @@ void ui_but_range_set_soft(uiBut *but)
float fmin, fmax, fstep, fprecision;
RNA_property_float_ui_range(&but->rnapoin, but->rnaprop, &fmin, &fmax, &fstep, &fprecision);
- softmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin;
- softmax = (fmax == FLT_MAX) ? (float)1e4 : fmax;
+ softmin = (fmin == -FLT_MAX) ? float(-1e4) : fmin;
+ softmax = (fmax == FLT_MAX) ? float(1e4) : fmax;
// step = fstep; /* UNUSED */
// precision = fprecision; /* UNUSED */
@@ -3328,8 +3328,8 @@ void ui_but_range_set_soft(uiBut *but)
if (is_array && !(subtype == PROP_COLOR && but->rnaindex == 3)) {
float value_range[2];
RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range);
- value_min = (double)value_range[0];
- value_max = (double)value_range[1];
+ value_min = double(value_range[0]);
+ value_max = double(value_range[1]);
}
else {
value_min = value_max = ui_but_value_get(but);
@@ -3348,8 +3348,8 @@ void ui_but_range_set_soft(uiBut *but)
softmin = soft_range_round_down(value_min, softmin);
}
- if (softmin < (double)but->hardmin) {
- softmin = (double)but->hardmin;
+ if (softmin < double(but->hardmin)) {
+ softmin = double(but->hardmin);
}
}
if (value_max - 1e-10 > softmax) {
@@ -3360,7 +3360,7 @@ void ui_but_range_set_soft(uiBut *but)
softmax = soft_range_round_up(value_max, softmax);
}
- if (softmax > (double)but->hardmax) {
+ if (softmax > double(but->hardmax)) {
softmax = but->hardmax;
}
}
@@ -3810,7 +3810,7 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
ui_but_build_drawstr_float(but, value);
}
else {
- ui_but_build_drawstr_int(but, (int)value);
+ ui_but_build_drawstr_int(but, int(value));
}
break;
@@ -3843,7 +3843,7 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
}
else {
UI_GET_BUT_VALUE_INIT(but, value);
- str = WM_key_event_string((short)value, false);
+ str = WM_key_event_string(short(value), false);
}
BLI_snprintf(but->drawstr, UI_MAX_DRAW_STR, "%s%s", but->str, str);
break;
@@ -4573,7 +4573,7 @@ static uiBut *ui_def_but_rna(uiBlock *block,
value = RNA_property_enum_get(ptr, prop);
}
else {
- value = (int)max;
+ value = int(max);
}
const int i = RNA_enum_from_value(item, value);
@@ -5938,7 +5938,7 @@ void UI_but_unit_type_set(uiBut *but, const int unit_type)
int UI_but_unit_type_get(const uiBut *but)
{
- const int ownUnit = (int)but->unit_type;
+ const int ownUnit = int(but->unit_type);
/* own unit define always takes precedence over RNA provided, allowing for overriding
* default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
@@ -6663,8 +6663,8 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
/* enum property */
ptr = &but->rnapoin;
prop = but->rnaprop;
- value = (ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_TAB)) ? (int)but->hardmax :
- (int)ui_but_value_get(but);
+ value = (ELEM(but->type, UI_BTYPE_ROW, UI_BTYPE_TAB)) ? int(but->hardmax) :
+ int(ui_but_value_get(but));
}
else if (but->optype) {
PointerRNA *opptr = UI_but_operator_ptr_get(but);
diff --git a/source/blender/editors/interface/interface_dropboxes.cc b/source/blender/editors/interface/interface_dropboxes.cc
index b72d8d2c238..378162a120e 100644
--- a/source/blender/editors/interface/interface_dropboxes.cc
+++ b/source/blender/editors/interface/interface_dropboxes.cc
@@ -87,7 +87,7 @@ static bool ui_drop_material_poll(bContext *C, wmDrag *drag, const wmEvent *UNUS
static void ui_drop_material_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
{
const ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, ID_MA);
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
}
static char *ui_drop_material_tooltip(bContext *C,
diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc
index 90572c45e8b..d25302616e5 100644
--- a/source/blender/editors/interface/interface_panel.cc
+++ b/source/blender/editors/interface/interface_panel.cc
@@ -142,7 +142,7 @@ static bool panel_active_animation_changed(ListBase *lb,
}
/* Detect changes in panel expansions. */
- if ((bool)(panel->runtime_flag & PANEL_WAS_CLOSED) != UI_panel_is_closed(panel)) {
+ if (bool(panel->runtime_flag & PANEL_WAS_CLOSED) != UI_panel_is_closed(panel)) {
*r_panel_animation = panel;
return false;
}
@@ -1232,7 +1232,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
rect->xmin,
rect->xmax,
rect->ymax,
- rect->ymax + (int)floor(PNL_HEADER / block->aspect + 0.001f),
+ rect->ymax + int(floor(PNL_HEADER / block->aspect + 0.001f)),
};
if (show_background) {
@@ -1368,7 +1368,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
}
if (y_ofs > BLI_rcti_size_y(&v2d->mask)) {
- scaletabs = (float)BLI_rcti_size_y(&v2d->mask) / (float)y_ofs;
+ scaletabs = float(BLI_rcti_size_y(&v2d->mask)) / float(y_ofs);
LISTBASE_FOREACH (PanelCategoryDyn *, pc_dyn, &region->panels_category) {
rcti *rct = &pc_dyn->rect;
@@ -1705,12 +1705,12 @@ static bool uiAlignPanelStep(ARegion *region, const float factor, const bool dra
}
if (ps->new_offset_x != ps->panel->ofsx) {
- const float x = interpf((float)ps->new_offset_x, (float)ps->panel->ofsx, factor);
+ const float x = interpf(float(ps->new_offset_x), float(ps->panel->ofsx), factor);
ps->panel->ofsx = round_fl_to_int(x);
changed = true;
}
if (ps->new_offset_y != ps->panel->ofsy) {
- const float y = interpf((float)ps->new_offset_y, (float)ps->panel->ofsy, factor);
+ const float y = interpf(float(ps->new_offset_y), float(ps->panel->ofsy), factor);
ps->panel->ofsy = round_fl_to_int(y);
changed = true;
}
@@ -1875,13 +1875,13 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel)
/* Keep the drag position in the region with a small pad to keep the panel visible. */
const int y = clamp_i(event->xy[1], region->winrct.ymin, region->winrct.ymax + DRAG_REGION_PAD);
- float dy = (float)(y - data->starty);
+ float dy = float(y - data->starty);
/* Adjust for region zoom. */
- dy *= BLI_rctf_size_y(&region->v2d.cur) / (float)BLI_rcti_size_y(&region->winrct);
+ dy *= BLI_rctf_size_y(&region->v2d.cur) / float(BLI_rcti_size_y(&region->winrct));
/* Add the movement of the view due to edge scrolling while dragging. */
- dy += ((float)region->v2d.cur.ymin - data->start_cur_ymin);
+ dy += (float(region->v2d.cur.ymin) - data->start_cur_ymin);
panel->ofsy = data->startofsy + round_fl_to_int(dy);
@@ -1902,16 +1902,16 @@ static uiPanelMouseState ui_panel_mouse_state_get(const uiBlock *block,
const int mx,
const int my)
{
- if (!IN_RANGE((float)mx, block->rect.xmin, block->rect.xmax)) {
+ if (!IN_RANGE(float(mx), block->rect.xmin, block->rect.xmax)) {
return PANEL_MOUSE_OUTSIDE;
}
- if (IN_RANGE((float)my, block->rect.ymax, block->rect.ymax + PNL_HEADER)) {
+ if (IN_RANGE(float(my), block->rect.ymax, block->rect.ymax + PNL_HEADER)) {
return PANEL_MOUSE_INSIDE_HEADER;
}
if (!UI_panel_is_closed(panel)) {
- if (IN_RANGE((float)my, block->rect.ymin, block->rect.ymax + PNL_HEADER)) {
+ if (IN_RANGE(float(my), block->rect.ymin, block->rect.ymax + PNL_HEADER)) {
return PANEL_MOUSE_INSIDE_CONTENT;
}
}
@@ -1937,8 +1937,8 @@ static void ui_panel_drag_collapse(const bContext *C,
ARegion *region = CTX_wm_region(C);
LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
- float xy_a_block[2] = {(float)dragcol_data->xy_init[0], (float)dragcol_data->xy_init[1]};
- float xy_b_block[2] = {(float)xy_dst[0], (float)xy_dst[1]};
+ float xy_a_block[2] = {float(dragcol_data->xy_init[0]), float(dragcol_data->xy_init[1])};
+ float xy_b_block[2] = {float(xy_dst[0]), float(xy_dst[1])};
Panel *panel = block->panel;
if (panel == nullptr || (panel->type && (panel->type->flag & PANEL_TYPE_NO_HEADER))) {
diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc
index f084f3e06cb..63dc3017da0 100644
--- a/source/blender/editors/interface/interface_query.cc
+++ b/source/blender/editors/interface/interface_query.cc
@@ -182,7 +182,7 @@ void ui_but_pie_dir(RadialDirection dir, float vec[2])
BLI_assert(dir != UI_RADIAL_NONE);
- angle = DEG2RADF((float)ui_radial_dir_to_angle[dir]);
+ angle = DEG2RADF(float(ui_radial_dir_to_angle[dir]));
vec[0] = cosf(angle);
vec[1] = sinf(angle);
}
diff --git a/source/blender/editors/interface/interface_region_color_picker.cc b/source/blender/editors/interface/interface_region_color_picker.cc
index 72912b8c7f7..b49888005fa 100644
--- a/source/blender/editors/interface/interface_region_color_picker.cc
+++ b/source/blender/editors/interface/interface_region_color_picker.cc
@@ -542,7 +542,7 @@ static void ui_block_colorpicker(uiBlock *block,
UI_UNIT_Y,
&colormode,
0.0,
- (float)PICKER_TYPE_RGB,
+ float(PICKER_TYPE_RGB),
0,
0,
"");
diff --git a/source/blender/editors/interface/interface_region_popover.cc b/source/blender/editors/interface/interface_region_popover.cc
index 17c8d890755..e3bb4056608 100644
--- a/source/blender/editors/interface/interface_region_popover.cc
+++ b/source/blender/editors/interface/interface_region_popover.cc
@@ -146,8 +146,8 @@ static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, v
ui_block_to_window_fl(handle->ctx_region, pup->but->block, &center[0], &center[1]);
/* These variables aren't used for popovers,
* we could add new variables if there is a conflict. */
- block->bounds_offset[0] = (int)center[0];
- block->bounds_offset[1] = (int)center[1];
+ block->bounds_offset[0] = int(center[0]);
+ block->bounds_offset[1] = int(center[1]);
copy_v2_v2_int(handle->prev_bounds_offset, block->bounds_offset);
}
else {
@@ -245,7 +245,7 @@ uiPopupBlockHandle *ui_popover_panel_create(
/* Scale width by changes to Text Style point size. */
const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points);
pup->ui_size_x = ui_units_x * U.widget_unit *
- (text_points_max / (float)UI_DEFAULT_TEXT_POINTS);
+ (text_points_max / float(UI_DEFAULT_TEXT_POINTS));
}
pup->menu_func = menu_func;
diff --git a/source/blender/editors/interface/interface_region_search.cc b/source/blender/editors/interface/interface_region_search.cc
index fb7810792e9..fdef2c15d82 100644
--- a/source/blender/editors/interface/interface_region_search.cc
+++ b/source/blender/editors/interface/interface_region_search.cc
@@ -44,7 +44,7 @@
#include "interface_intern.h"
#include "interface_regions_intern.hh"
-#define MENU_BORDER (int)(0.3f * U.widget_unit)
+#define MENU_BORDER int(0.3f * U.widget_unit)
/* -------------------------------------------------------------------- */
/** \name Search Box Creation
diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc
index b1621f1a040..74985c50cc1 100644
--- a/source/blender/editors/interface/interface_region_tooltip.cc
+++ b/source/blender/editors/interface/interface_region_tooltip.cc
@@ -56,7 +56,7 @@
#include "interface_regions_intern.hh"
#define UI_TIP_PAD_FAC 1.3f
-#define UI_TIP_PADDING (int)(UI_TIP_PAD_FAC * UI_UNIT_Y)
+#define UI_TIP_PADDING int(UI_TIP_PAD_FAC * UI_UNIT_Y)
#define UI_TIP_MAXWIDTH 600
#define UI_TIP_STR_MAX 1024
diff --git a/source/blender/editors/interface/interface_style.cc b/source/blender/editors/interface/interface_style.cc
index 3895a687033..9493f40548d 100644
--- a/source/blender/editors/interface/interface_style.cc
+++ b/source/blender/editors/interface/interface_style.cc
@@ -319,20 +319,20 @@ const uiStyle *UI_style_get_dpi(void)
_style = *style;
- _style.paneltitle.shadx = (short)(UI_DPI_FAC * _style.paneltitle.shadx);
- _style.paneltitle.shady = (short)(UI_DPI_FAC * _style.paneltitle.shady);
- _style.grouplabel.shadx = (short)(UI_DPI_FAC * _style.grouplabel.shadx);
- _style.grouplabel.shady = (short)(UI_DPI_FAC * _style.grouplabel.shady);
- _style.widgetlabel.shadx = (short)(UI_DPI_FAC * _style.widgetlabel.shadx);
- _style.widgetlabel.shady = (short)(UI_DPI_FAC * _style.widgetlabel.shady);
-
- _style.columnspace = (short)(UI_DPI_FAC * _style.columnspace);
- _style.templatespace = (short)(UI_DPI_FAC * _style.templatespace);
- _style.boxspace = (short)(UI_DPI_FAC * _style.boxspace);
- _style.buttonspacex = (short)(UI_DPI_FAC * _style.buttonspacex);
- _style.buttonspacey = (short)(UI_DPI_FAC * _style.buttonspacey);
- _style.panelspace = (short)(UI_DPI_FAC * _style.panelspace);
- _style.panelouter = (short)(UI_DPI_FAC * _style.panelouter);
+ _style.paneltitle.shadx = short(UI_DPI_FAC * _style.paneltitle.shadx);
+ _style.paneltitle.shady = short(UI_DPI_FAC * _style.paneltitle.shady);
+ _style.grouplabel.shadx = short(UI_DPI_FAC * _style.grouplabel.shadx);
+ _style.grouplabel.shady = short(UI_DPI_FAC * _style.grouplabel.shady);
+ _style.widgetlabel.shadx = short(UI_DPI_FAC * _style.widgetlabel.shadx);
+ _style.widgetlabel.shady = short(UI_DPI_FAC * _style.widgetlabel.shady);
+
+ _style.columnspace = short(UI_DPI_FAC * _style.columnspace);
+ _style.templatespace = short(UI_DPI_FAC * _style.templatespace);
+ _style.boxspace = short(UI_DPI_FAC * _style.boxspace);
+ _style.buttonspacex = short(UI_DPI_FAC * _style.buttonspacex);
+ _style.buttonspacey = short(UI_DPI_FAC * _style.buttonspacey);
+ _style.panelspace = short(UI_DPI_FAC * _style.panelspace);
+ _style.panelouter = short(UI_DPI_FAC * _style.panelouter);
return &_style;
}
@@ -340,7 +340,7 @@ const uiStyle *UI_style_get_dpi(void)
int UI_fontstyle_string_width(const uiFontStyle *fs, const char *str)
{
UI_fontstyle_set(fs);
- return (int)BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX);
+ return int(BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX));
}
int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs,
@@ -359,7 +359,7 @@ int UI_fontstyle_string_width_with_block_aspect(const uiFontStyle *fs,
if (aspect != 1.0f) {
/* While in most cases rounding up isn't important, it can make a difference
* with small fonts (3px or less), zooming out in the node-editor for e.g. */
- width = (int)ceilf(width * aspect);
+ width = int(ceilf(width * aspect));
}
return width;
}
diff --git a/source/blender/editors/interface/interface_template_list.cc b/source/blender/editors/interface/interface_template_list.cc
index d8a9591a021..f09eb5f3eb0 100644
--- a/source/blender/editors/interface/interface_template_list.cc
+++ b/source/blender/editors/interface/interface_template_list.cc
@@ -519,8 +519,8 @@ static void uilist_prepare(uiList *ui_list,
int activei_row;
if (columns > 1) {
- dyn_data->height = (int)ceil((double)items->tot_items / (double)columns);
- activei_row = (int)floor((double)items->active_item_idx / (double)columns);
+ dyn_data->height = int(ceil(double(items->tot_items) / double(columns)));
+ activei_row = int(floor(double(items->active_item_idx) / double(columns)));
}
else {
dyn_data->height = items->tot_items;
@@ -567,8 +567,8 @@ static void uilist_resize_update_cb(bContext *C, void *arg1, void *UNUSED(arg2))
uiListDyn *dyn_data = ui_list->dyn_data;
/* This way we get diff in number of additional items to show (positive) or hide (negative). */
- const int diff = round_fl_to_int((float)(dyn_data->resize - dyn_data->resize_prev) /
- (float)UI_UNIT_Y);
+ const int diff = round_fl_to_int(float(dyn_data->resize - dyn_data->resize_prev) /
+ float(UI_UNIT_Y));
if (diff != 0) {
ui_list->list_grip += diff;
diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc
index c777b7834f2..f61baf65b58 100644
--- a/source/blender/editors/interface/interface_template_search_menu.cc
+++ b/source/blender/editors/interface/interface_template_search_menu.cc
@@ -191,7 +191,7 @@ static bool menu_items_from_ui_create_item_from_button(MenuSearch_Data *data,
if (drawstr_is_empty) {
if (prop_type == PROP_ENUM) {
- const int value_enum = (int)but->hardmax;
+ const int value_enum = int(but->hardmax);
EnumPropertyItem enum_item;
if (RNA_property_enum_item_from_value_gettexted((bContext *)but->block->evil_C,
&but->rnapoin,
@@ -227,7 +227,7 @@ static bool menu_items_from_ui_create_item_from_button(MenuSearch_Data *data,
item->rna.index = but->rnaindex;
if (prop_type == PROP_ENUM) {
- item->rna.enum_value = (int)but->hardmax;
+ item->rna.enum_value = int(but->hardmax);
}
}
}
@@ -544,8 +544,8 @@ static MenuSearch_Data *menu_items_from_ui_create(
if (wm_contexts[space_type_ui_index].space_type_ui_index != -1) {
ScrArea *area_best = wm_contexts[space_type_ui_index].area;
- const uint value_best = (uint)area_best->winx * (uint)area_best->winy;
- const uint value_test = (uint)area->winx * (uint)area->winy;
+ const uint value_best = uint(area_best->winx) * uint(area_best->winy);
+ const uint value_test = uint(area->winx) * uint(area->winy);
if (value_best > value_test) {
continue;
}
diff --git a/source/blender/editors/interface/interface_utils.cc b/source/blender/editors/interface/interface_utils.cc
index 4b94834ce97..139d3c9353f 100644
--- a/source/blender/editors/interface/interface_utils.cc
+++ b/source/blender/editors/interface/interface_utils.cc
@@ -495,7 +495,7 @@ static bool add_collection_search_item(CollItemSearch *cis,
cis->name,
cis->data,
cis->iconid,
- cis->has_sep_char ? (int)UI_BUT_HAS_SEP_CHAR : 0,
+ cis->has_sep_char ? int(UI_BUT_HAS_SEP_CHAR) : 0,
name_prefix_offset);
}
@@ -787,7 +787,7 @@ int UI_calc_float_precision(int prec, double value)
*/
value = fabs(value);
if ((value < pow10_neg[prec]) && (value > (1.0 / max_pow))) {
- int value_i = (int)lround(value * max_pow);
+ int value_i = int(lround(value * max_pow));
if (value_i != 0) {
const int prec_span = 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
int test_prec;
diff --git a/source/blender/editors/interface/view2d.cc b/source/blender/editors/interface/view2d.cc
index 95e5c0ad7d8..bb660d6bf7d 100644
--- a/source/blender/editors/interface/view2d.cc
+++ b/source/blender/editors/interface/view2d.cc
@@ -53,16 +53,16 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize);
BLI_INLINE int clamp_float_to_int(const float f)
{
- const float min = (float)INT_MIN;
- const float max = (float)INT_MAX;
+ const float min = float(INT_MIN);
+ const float max = float(INT_MAX);
if (UNLIKELY(f < min)) {
return min;
}
if (UNLIKELY(f > max)) {
- return (int)max;
+ return int(max);
}
- return (int)f;
+ return int(f);
}
/**
@@ -244,8 +244,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->keeptot = V2D_KEEPTOT_BOUNDS;
if (do_init) {
v2d->tot.xmin = v2d->tot.ymin = 0.0f;
- v2d->tot.xmax = (float)(winx - 1);
- v2d->tot.ymax = (float)(winy - 1);
+ v2d->tot.xmax = float(winx - 1);
+ v2d->tot.ymax = float(winy - 1);
v2d->cur = v2d->tot;
}
@@ -297,8 +297,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
v2d->tot.ymax = winy;
v2d->cur = v2d->tot;
- v2d->min[0] = v2d->max[0] = (float)(winx - 1);
- v2d->min[1] = v2d->max[1] = (float)(winy - 1);
+ v2d->min[0] = v2d->max[0] = float(winx - 1);
+ v2d->min[1] = v2d->max[1] = float(winy - 1);
}
/* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
@@ -388,8 +388,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
/* use mask as size of region that View2D resides in, as it takes into account
* scroll-bars already - keep in sync with zoomx/zoomy in #view_zoomstep_apply_ex! */
- winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
- winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
+ winx = float(BLI_rcti_size_x(&v2d->mask) + 1);
+ winy = float(BLI_rcti_size_y(&v2d->mask) + 1);
/* get pointers to rcts for less typing */
cur = &v2d->cur;
@@ -584,8 +584,8 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize)
}
/* store region size for next time */
- v2d->oldwinx = (short)winx;
- v2d->oldwiny = (short)winy;
+ v2d->oldwinx = short(winx);
+ v2d->oldwiny = short(winy);
}
/* Step 2: apply new sizes to cur rect,
@@ -916,8 +916,8 @@ void UI_view2d_curRect_reset(View2D *v2d)
float width, height;
/* assume width and height of 'cur' rect by default, should be same size as mask */
- width = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
- height = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
+ width = float(BLI_rcti_size_x(&v2d->mask) + 1);
+ height = float(BLI_rcti_size_y(&v2d->mask) + 1);
/* handle width - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
@@ -980,17 +980,17 @@ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resiz
/* handle width - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
/* width is in negative-x half */
- v2d->tot.xmin = (float)-width;
+ v2d->tot.xmin = float(-width);
v2d->tot.xmax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
/* width is in positive-x half */
v2d->tot.xmin = 0.0f;
- v2d->tot.xmax = (float)width;
+ v2d->tot.xmax = float(width);
}
else {
/* width is centered around (x == 0) */
- const float dx = (float)width / 2.0f;
+ const float dx = float(width) / 2.0f;
v2d->tot.xmin = -dx;
v2d->tot.xmax = dx;
@@ -999,17 +999,17 @@ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resiz
/* handle height - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
/* height is in negative-y half */
- v2d->tot.ymin = (float)-height;
+ v2d->tot.ymin = float(-height);
v2d->tot.ymax = 0.0f;
}
else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
/* height is in positive-y half */
v2d->tot.ymin = 0.0f;
- v2d->tot.ymax = (float)height;
+ v2d->tot.ymax = float(height);
}
else {
/* height is centered around (y == 0) */
- const float dy = (float)height / 2.0f;
+ const float dy = float(height) / 2.0f;
v2d->tot.ymin = -dy;
v2d->tot.ymax = dy;
@@ -1062,17 +1062,17 @@ static void view2d_map_cur_using_mask(const View2D *v2d, rctf *r_curmasked)
const float dy = BLI_rctf_size_y(&v2d->cur) / (sizey + 1);
if (v2d->mask.xmin != 0) {
- r_curmasked->xmin -= dx * (float)v2d->mask.xmin;
+ r_curmasked->xmin -= dx * float(v2d->mask.xmin);
}
if (v2d->mask.xmax + 1 != v2d->winx) {
- r_curmasked->xmax += dx * (float)(v2d->winx - v2d->mask.xmax - 1);
+ r_curmasked->xmax += dx * float(v2d->winx - v2d->mask.xmax - 1);
}
if (v2d->mask.ymin != 0) {
- r_curmasked->ymin -= dy * (float)v2d->mask.ymin;
+ r_curmasked->ymin -= dy * float(v2d->mask.ymin);
}
if (v2d->mask.ymax + 1 != v2d->winy) {
- r_curmasked->ymax += dy * (float)(v2d->winy - v2d->mask.ymax - 1);
+ r_curmasked->ymax += dy * float(v2d->winy - v2d->mask.ymax - 1);
}
}
}
@@ -1151,7 +1151,7 @@ void UI_view2d_view_restore(const bContext *C)
const int width = BLI_rcti_size_x(&region->winrct) + 1;
const int height = BLI_rcti_size_y(&region->winrct) + 1;
- wmOrtho2(0.0f, (float)width, 0.0f, (float)height);
+ wmOrtho2(0.0f, float(width), 0.0f, float(height));
GPU_matrix_identity_set();
// ED_region_pixelspace(CTX_wm_region(C));
@@ -1177,8 +1177,8 @@ void UI_view2d_multi_grid_draw(
/* Make an estimate of at least how many vertices will be needed */
uint vertex_count = 4;
- vertex_count += 2 * ((int)((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1);
- vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1);
+ vertex_count += 2 * (int((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1);
+ vertex_count += 2 * (int((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1);
GPUVertFormat *format = immVertexFormat();
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -1195,7 +1195,7 @@ void UI_view2d_multi_grid_draw(
* or high contrast grid lines. This only has an effect if colorid != TH_GRID. */
UI_GetThemeColorBlendShade3ubv(colorid, TH_GRID, 0.25f, offset, grid_line_color);
- int i = (int)(v2d->cur.xmin / lstep);
+ int i = int(v2d->cur.xmin / lstep);
if (v2d->cur.xmin > 0.0f) {
i++;
}
@@ -1212,7 +1212,7 @@ void UI_view2d_multi_grid_draw(
immVertex2f(pos, start, v2d->cur.ymax);
}
- i = (int)(v2d->cur.ymin / lstep);
+ i = int(v2d->cur.ymin / lstep);
if (v2d->cur.ymin > 0.0f) {
i++;
}
@@ -1256,10 +1256,10 @@ static void grid_axis_start_and_count(
{
*r_start = min;
if (*r_start < 0.0f) {
- *r_start += -(float)fmod(min, step);
+ *r_start += -float(fmod(min, step));
}
else {
- *r_start += step - (float)fabs(fmod(min, step));
+ *r_start += step - float(fabs(fmod(min, step)));
}
if (*r_start > max) {
@@ -1280,7 +1280,7 @@ void UI_view2d_dot_grid_draw(const View2D *v2d,
return;
}
- const float zoom_x = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
+ const float zoom_x = float(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
GPUVertFormat *format = immVertexFormat();
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -1296,7 +1296,7 @@ void UI_view2d_dot_grid_draw(const View2D *v2d,
const int subdivision_scale = 5;
const float view_level = logf(min_step / zoom_x) / logf(subdivision_scale);
- const int largest_visible_level = (int)view_level;
+ const int largest_visible_level = int(view_level);
for (int level_offset = 0; level_offset <= grid_subdivisions; level_offset++) {
const int level = largest_visible_level - level_offset;
@@ -1408,7 +1408,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
vert.ymax -= UI_HEADER_OFFSET;
/* width of sliders */
- smaller = (int)(0.1f * U.widget_unit);
+ smaller = int(0.1f * U.widget_unit);
if (scroll & V2D_SCROLL_BOTTOM) {
hor.ymin += smaller;
}
@@ -1439,7 +1439,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
if (scroll & V2D_SCROLL_HORIZONTAL) {
/* scroller 'button' extents */
totsize = BLI_rctf_size_x(&v2d->tot);
- scrollsize = (float)BLI_rcti_size_x(&hor);
+ scrollsize = float(BLI_rcti_size_x(&hor));
if (totsize == 0.0f) {
totsize = 1.0f; /* avoid divide by zero */
}
@@ -1449,7 +1449,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
r_scrollers->hor_min = hor.xmin;
}
else {
- r_scrollers->hor_min = (int)(hor.xmin + (fac1 * scrollsize));
+ r_scrollers->hor_min = int(hor.xmin + (fac1 * scrollsize));
}
fac2 = (v2d->cur.xmax - v2d->tot.xmin) / totsize;
@@ -1457,7 +1457,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
r_scrollers->hor_max = hor.xmax;
}
else {
- r_scrollers->hor_max = (int)(hor.xmin + (fac2 * scrollsize));
+ r_scrollers->hor_max = int(hor.xmin + (fac2 * scrollsize));
}
/* prevent inverted sliders */
@@ -1477,7 +1477,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
if (scroll & V2D_SCROLL_VERTICAL) {
/* scroller 'button' extents */
totsize = BLI_rctf_size_y(&v2d->tot);
- scrollsize = (float)BLI_rcti_size_y(&vert);
+ scrollsize = float(BLI_rcti_size_y(&vert));
if (totsize == 0.0f) {
totsize = 1.0f; /* avoid divide by zero */
}
@@ -1487,7 +1487,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
r_scrollers->vert_min = vert.ymin;
}
else {
- r_scrollers->vert_min = (int)(vert.ymin + (fac1 * scrollsize));
+ r_scrollers->vert_min = int(vert.ymin + (fac1 * scrollsize));
}
fac2 = (v2d->cur.ymax - v2d->tot.ymin) / totsize;
@@ -1495,7 +1495,7 @@ void UI_view2d_scrollers_calc(View2D *v2d,
r_scrollers->vert_max = vert.ymax;
}
else {
- r_scrollers->vert_max = (int)(vert.ymin + (fac2 * scrollsize));
+ r_scrollers->vert_max = int(vert.ymin + (fac2 * scrollsize));
}
/* prevent inverted sliders */
@@ -1673,8 +1673,8 @@ void UI_view2d_region_to_view(
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
- const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
- (float)BLI_rcti_size_y(&v2d->mask)};
+ const float mask_size[2] = {float(BLI_rcti_size_x(&v2d->mask)),
+ float(BLI_rcti_size_y(&v2d->mask))};
rect_dst->xmin = (v2d->cur.xmin +
(cur_size[0] * (rect_src->xmin - v2d->mask.xmin) / mask_size[0]));
@@ -1706,8 +1706,8 @@ bool UI_view2d_view_to_region_clip(
/* check if values are within bounds */
if ((x >= 0.0f) && (x <= 1.0f) && (y >= 0.0f) && (y <= 1.0f)) {
- *r_region_x = (int)(v2d->mask.xmin + (x * BLI_rcti_size_x(&v2d->mask)));
- *r_region_y = (int)(v2d->mask.ymin + (y * BLI_rcti_size_y(&v2d->mask)));
+ *r_region_x = int(v2d->mask.xmin + (x * BLI_rcti_size_x(&v2d->mask)));
+ *r_region_y = int(v2d->mask.ymin + (y * BLI_rcti_size_y(&v2d->mask)));
return true;
}
@@ -1770,10 +1770,10 @@ bool UI_view2d_view_to_region_segment_clip(const View2D *v2d,
r_region_a[0] = r_region_b[0] = r_region_a[1] = r_region_b[1] = V2D_IS_CLIPPED;
if (BLI_rctf_isect_segment(&rect_unit, s_a, s_b)) {
- r_region_a[0] = (int)(v2d->mask.xmin + (s_a[0] * BLI_rcti_size_x(&v2d->mask)));
- r_region_a[1] = (int)(v2d->mask.ymin + (s_a[1] * BLI_rcti_size_y(&v2d->mask)));
- r_region_b[0] = (int)(v2d->mask.xmin + (s_b[0] * BLI_rcti_size_x(&v2d->mask)));
- r_region_b[1] = (int)(v2d->mask.ymin + (s_b[1] * BLI_rcti_size_y(&v2d->mask)));
+ r_region_a[0] = int(v2d->mask.xmin + (s_a[0] * BLI_rcti_size_x(&v2d->mask)));
+ r_region_a[1] = int(v2d->mask.ymin + (s_a[1] * BLI_rcti_size_y(&v2d->mask)));
+ r_region_b[0] = int(v2d->mask.xmin + (s_b[0] * BLI_rcti_size_x(&v2d->mask)));
+ r_region_b[1] = int(v2d->mask.ymin + (s_b[1] * BLI_rcti_size_y(&v2d->mask)));
return true;
}
@@ -1784,8 +1784,8 @@ bool UI_view2d_view_to_region_segment_clip(const View2D *v2d,
void UI_view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
- const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
- (float)BLI_rcti_size_y(&v2d->mask)};
+ const float mask_size[2] = {float(BLI_rcti_size_x(&v2d->mask)),
+ float(BLI_rcti_size_y(&v2d->mask))};
rctf rect_tmp;
/* Step 1: express given coordinates as proportional values. */
@@ -1814,8 +1814,8 @@ void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4])
bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, rcti *rect_dst)
{
const float cur_size[2] = {BLI_rctf_size_x(&v2d->cur), BLI_rctf_size_y(&v2d->cur)};
- const float mask_size[2] = {(float)BLI_rcti_size_x(&v2d->mask),
- (float)BLI_rcti_size_y(&v2d->mask)};
+ const float mask_size[2] = {float(BLI_rcti_size_x(&v2d->mask)),
+ float(BLI_rcti_size_y(&v2d->mask))};
rctf rect_tmp;
BLI_assert(rect_src->xmin <= rect_src->xmax && rect_src->ymin <= rect_src->ymax);
@@ -2153,8 +2153,8 @@ void UI_view2d_text_cache_draw(ARegion *region)
/* Don't use clipping if `v2s->rect` is not set. */
if (BLI_rcti_size_x(&v2s->rect) == 0 && BLI_rcti_size_y(&v2s->rect) == 0) {
- BLF_draw_default((float)(v2s->mval[0] + xofs),
- (float)(v2s->mval[1] + yofs),
+ BLF_draw_default(float(v2s->mval[0] + xofs),
+ float(v2s->mval[1] + yofs),
0.0,
v2s->str,
BLF_DRAW_STR_DUMMY_MAX);
diff --git a/source/blender/editors/interface/view2d_draw.cc b/source/blender/editors/interface/view2d_draw.cc
index ea4cf399a57..ca96c2abb9d 100644
--- a/source/blender/editors/interface/view2d_draw.cc
+++ b/source/blender/editors/interface/view2d_draw.cc
@@ -319,11 +319,11 @@ static void draw_horizontal_scale_indicators(const ARegion *region,
const float right_text_width = BLF_width(font_id, text, strlen(text));
const float max_text_width = max_ff(left_text_width, right_text_width);
const float max_label_count = BLI_rcti_size_x(&v2d->mask) / (max_text_width + 10.0f);
- draw_frequency = ceil((float)steps / max_label_count);
+ draw_frequency = ceil(float(steps) / max_label_count);
}
if (draw_frequency != 0) {
- const int start_index = abs((int)(start / distance)) % draw_frequency;
+ const int start_index = abs(int(start / distance)) % draw_frequency;
for (uint i = start_index; i < steps; i += draw_frequency) {
const float xpos_view = start + i * distance;
const float xpos_region = UI_view2d_view_to_region_x(v2d, xpos_view);
@@ -410,7 +410,7 @@ static void draw_vertical_scale_indicators(const ARegion *region,
static void view_to_string__frame_number(
void *UNUSED(user_data), float v2d_pos, float UNUSED(v2d_step), uint max_len, char *r_str)
{
- BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
+ BLI_snprintf(r_str, max_len, "%d", int(v2d_pos));
}
static void view_to_string__time(
@@ -424,14 +424,14 @@ static void view_to_string__time(
}
BLI_timecode_string_from_time(
- r_str, max_len, brevity_level, v2d_pos / (float)FPS, FPS, U.timecode_style);
+ r_str, max_len, brevity_level, v2d_pos / float(FPS), FPS, U.timecode_style);
}
static void view_to_string__value(
void *UNUSED(user_data), float v2d_pos, float v2d_step, uint max_len, char *r_str)
{
if (v2d_step >= 1.0f) {
- BLI_snprintf(r_str, max_len, "%d", (int)v2d_pos);
+ BLI_snprintf(r_str, max_len, "%d", int(v2d_pos));
}
else if (v2d_step >= 0.1f) {
BLI_snprintf(r_str, max_len, "%.1f", v2d_pos);
diff --git a/source/blender/editors/interface/view2d_edge_pan.cc b/source/blender/editors/interface/view2d_edge_pan.cc
index 82959d96043..2d8c6970332 100644
--- a/source/blender/editors/interface/view2d_edge_pan.cc
+++ b/source/blender/editors/interface/view2d_edge_pan.cc
@@ -80,8 +80,8 @@ void UI_view2d_edge_pan_init(bContext *C,
vpd->enabled = false;
/* Calculate translation factor, based on size of view. */
- const float winx = (float)(BLI_rcti_size_x(&vpd->region->winrct) + 1);
- const float winy = (float)(BLI_rcti_size_y(&vpd->region->winrct) + 1);
+ const float winx = float(BLI_rcti_size_x(&vpd->region->winrct) + 1);
+ const float winy = float(BLI_rcti_size_y(&vpd->region->winrct) + 1);
vpd->facx = (BLI_rctf_size_x(&vpd->v2d->cur)) / winx;
vpd->facy = (BLI_rctf_size_y(&vpd->v2d->cur)) / winy;
@@ -165,16 +165,16 @@ static float edge_pan_speed(View2DEdgePanData *vpd,
/* Apply a fade in to the speed based on a start time delay. */
const double start_time = x_dir ? vpd->edge_pan_start_time_x : vpd->edge_pan_start_time_y;
const float delay_factor = vpd->delay > 0.01f ?
- smootherstep(vpd->delay, (float)(current_time - start_time)) :
+ smootherstep(vpd->delay, float(current_time - start_time)) :
1.0f;
/* Zoom factor increases speed when zooming in and decreases speed when zooming out. */
- const float zoomx = (float)(BLI_rcti_size_x(&region->winrct) + 1) /
+ const float zoomx = float(BLI_rcti_size_x(&region->winrct) + 1) /
BLI_rctf_size_x(&region->v2d.cur);
const float zoom_factor = 1.0f + CLAMPIS(vpd->zoom_influence, 0.0f, 1.0f) * (zoomx - 1.0f);
return distance_factor * delay_factor * zoom_factor * vpd->max_speed * U.widget_unit *
- (float)U.dpi_fac;
+ float(U.dpi_fac);
}
static void edge_pan_apply_delta(bContext *C, View2DEdgePanData *vpd, float dx, float dy)
@@ -252,15 +252,15 @@ void UI_view2d_edge_pan_apply(bContext *C, View2DEdgePanData *vpd, const int xy[
edge_pan_manage_delay_timers(vpd, pan_dir_x, pan_dir_y, current_time);
/* Calculate the delta since the last time the operator was called. */
- const float dtime = (float)(current_time - vpd->edge_pan_last_time);
+ const float dtime = float(current_time - vpd->edge_pan_last_time);
float dx = 0.0f, dy = 0.0f;
if (pan_dir_x != 0) {
const float speed = edge_pan_speed(vpd, xy[0], true, current_time);
- dx = dtime * speed * (float)pan_dir_x;
+ dx = dtime * speed * float(pan_dir_x);
}
if (pan_dir_y != 0) {
const float speed = edge_pan_speed(vpd, xy[1], false, current_time);
- dy = dtime * speed * (float)pan_dir_y;
+ dy = dtime * speed * float(pan_dir_y);
}
vpd->edge_pan_last_time = current_time;
diff --git a/source/blender/editors/interface/view2d_ops.cc b/source/blender/editors/interface/view2d_ops.cc
index 5f7d82e7b9a..1df2acd5ef7 100644
--- a/source/blender/editors/interface/view2d_ops.cc
+++ b/source/blender/editors/interface/view2d_ops.cc
@@ -127,8 +127,8 @@ static void view_pan_init(bContext *C, wmOperator *op)
vpd->v2d = &vpd->region->v2d;
/* calculate translation factor - based on size of view */
- const float winx = (float)(BLI_rcti_size_x(&vpd->region->winrct) + 1);
- const float winy = (float)(BLI_rcti_size_y(&vpd->region->winrct) + 1);
+ const float winx = float(BLI_rcti_size_x(&vpd->region->winrct) + 1);
+ const float winy = float(BLI_rcti_size_y(&vpd->region->winrct) + 1);
vpd->facx = (BLI_rctf_size_x(&vpd->v2d->cur)) / winx;
vpd->facy = (BLI_rctf_size_y(&vpd->v2d->cur)) / winy;
@@ -712,7 +712,7 @@ static void view_zoomstep_apply_ex(bContext *C,
if (vzd->zoom_to_mouse_pos) {
/* get zoom fac the same way as in
* ui_view2d_curRect_validate_resize - better keep in sync! */
- const float zoomx = (float)(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
+ const float zoomx = float(BLI_rcti_size_x(&v2d->mask) + 1) / BLI_rctf_size_x(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
if (((v2d->keepzoom & V2D_LIMITZOOM) == 0) ||
@@ -747,7 +747,7 @@ static void view_zoomstep_apply_ex(bContext *C,
if (vzd->zoom_to_mouse_pos) {
/* get zoom fac the same way as in
* ui_view2d_curRect_validate_resize - better keep in sync! */
- const float zoomy = (float)(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
+ const float zoomy = float(BLI_rcti_size_y(&v2d->mask) + 1) / BLI_rctf_size_y(&v2d->cur);
/* only move view to mouse if zoom fac is inside minzoom/maxzoom */
if (((v2d->keepzoom & V2D_LIMITZOOM) == 0) ||
@@ -958,7 +958,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
* never uses the "Continuous" zoom method, and the 'timer' is not initialized. */
if ((U.viewzoom == USER_ZOOM_CONTINUE) && vzd->timer) { /* XXX store this setting as RNA prop? */
const double time = PIL_check_seconds_timer();
- const float time_step = (float)(time - vzd->timer_lastdraw);
+ const float time_step = float(time - vzd->timer_lastdraw);
dx *= time_step * 5.0f;
dy *= time_step * 5.0f;
diff --git a/source/blender/editors/interface/views/grid_view.cc b/source/blender/editors/interface/views/grid_view.cc
index 52ff1460cbd..ee2fa87b1dc 100644
--- a/source/blender/editors/interface/views/grid_view.cc
+++ b/source/blender/editors/interface/views/grid_view.cc
@@ -237,7 +237,7 @@ IndexRange BuildOnlyVisibleButtonsHelper::get_visible_range() const
const float scroll_ofs_y = abs(v2d_.cur.ymax - v2d_.tot.ymax);
if (!IS_EQF(scroll_ofs_y, 0)) {
- const int scrolled_away_rows = (int)scroll_ofs_y / style_.tile_height;
+ const int scrolled_away_rows = int(scroll_ofs_y) / style_.tile_height;
first_idx_in_view = scrolled_away_rows * cols_per_row_;
}
@@ -263,7 +263,7 @@ void BuildOnlyVisibleButtonsHelper::fill_layout_before_visible(uiBlock &block) c
return;
}
- const int scrolled_away_rows = (int)scroll_ofs_y / style_.tile_height;
+ const int scrolled_away_rows = int(scroll_ofs_y) / style_.tile_height;
add_spacer_button(block, scrolled_away_rows);
}
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc
index ac8dd87bed6..888a8340d51 100644
--- a/source/blender/editors/mesh/editface.cc
+++ b/source/blender/editors/mesh/editface.cc
@@ -230,7 +230,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
".select_poly", ATTR_DOMAIN_FACE);
- if (index != (uint)-1) {
+ if (index != uint(-1)) {
/* only put face under cursor in array */
const MPoly &poly = polys[index];
BKE_mesh_poly_edgebitmap_insert(edge_tag, &poly, &loops[poly.loopstart]);
@@ -295,7 +295,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const bool select)
{
- uint index = (uint)-1;
+ uint index = uint(-1);
Mesh *me = BKE_mesh_from_object(ob);
if (me == nullptr || me->totpoly == 0) {
@@ -451,7 +451,7 @@ bool paintface_mouse_select(bContext *C,
}
if (found) {
- me->act_face = (int)index;
+ me->act_face = int(index);
switch (params->sel_op) {
case SEL_OP_SET:
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index dc3389844b8..ea03117a525 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -161,9 +161,9 @@ static void mesh_uv_reset_array(float **fuv, const int len)
/* Make sure we ignore 2-sided faces. */
}
else if (len > 2) {
- float fac = 0.0f, dfac = 1.0f / (float)len;
+ float fac = 0.0f, dfac = 1.0f / float(len);
- dfac *= (float)M_PI * 2.0f;
+ dfac *= float(M_PI) * 2.0f;
for (int i = 0; i < len; i++) {
fuv[i][0] = 0.5f * sinf(fac) + 0.5f;
diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc
index 93754e2ef87..917e019c05a 100644
--- a/source/blender/editors/mesh/meshtools.cc
+++ b/source/blender/editors/mesh/meshtools.cc
@@ -1210,7 +1210,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], uint dist_px,
*r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.region, vc.v3d, mval);
}
- if ((*r_index) == 0 || (*r_index) > (uint)me->totpoly) {
+ if ((*r_index) == 0 || (*r_index) > uint(me->totpoly)) {
return false;
}
@@ -1267,7 +1267,7 @@ bool ED_mesh_pick_face_vert(
int v_idx_best = ORIGINDEX_NONE;
/* find the vert closest to 'mval' */
- const float mval_f[2] = {(float)mval[0], (float)mval[1]};
+ const float mval_f[2] = {float(mval[0]), float(mval[1])};
float len_best = FLT_MAX;
const Span<MVert> verts = me_eval->verts();
@@ -1379,7 +1379,7 @@ bool ED_mesh_pick_vert(
*r_index = DRW_select_buffer_sample_point(vc.depsgraph, vc.region, vc.v3d, mval);
}
- if ((*r_index) == 0 || (*r_index) > (uint)me->totvert) {
+ if ((*r_index) == 0 || (*r_index) > uint(me->totvert)) {
return false;
}
@@ -1395,7 +1395,7 @@ bool ED_mesh_pick_vert(
RegionView3D *rv3d = static_cast<RegionView3D *>(region->regiondata);
/* find the vert closest to 'mval' */
- const float mval_f[2] = {(float)mval[0], (float)mval[1]};
+ const float mval_f[2] = {float(mval[0]), float(mval[1])};
VertPickData data = {nullptr};
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc
index 9d06a6d5f40..a24b6ed4830 100644
--- a/source/blender/editors/object/object_add.cc
+++ b/source/blender/editors/object/object_add.cc
@@ -287,7 +287,7 @@ void ED_object_rotation_from_quat(float rot[3], const float viewquat[4], const c
}
case 'Y': {
quat_to_eul(rot, viewquat);
- rot[0] -= (float)M_PI_2;
+ rot[0] -= float(M_PI_2);
break;
}
case 'Z': {
diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc
index 3d995c84639..424bf3c73e2 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -2814,7 +2814,7 @@ static int correctivesmooth_bind_exec(bContext *C, wmOperator *op)
/* Signal to modifier to recalculate. */
CorrectiveSmoothModifierData *csmd_eval = (CorrectiveSmoothModifierData *)
BKE_modifier_get_evaluated(depsgraph, ob, &csmd->modifier);
- csmd_eval->bind_coords_num = (uint)-1;
+ csmd_eval->bind_coords_num = uint(-1);
/* Force modifier to run, it will call binding routine
* (this has to happen outside of depsgraph evaluation). */
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc
index 4fe4b087042..9f59549d3db 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -246,7 +246,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d,
const float spacing)
{
const float total_len = len_v3v3(initial_co, end_co);
- const int tot_lines = (int)(total_len / spacing);
+ const int tot_lines = int(total_len / spacing);
const int tot_lines_half = (tot_lines / 2) + 1;
float spacing_dir[3], lines_start[3];
float line_dir[3];
@@ -261,7 +261,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d,
mid_v3_v3v3(lines_start, initial_co, end_co);
- immBegin(GPU_PRIM_LINES, (uint)tot_lines_half * 2);
+ immBegin(GPU_PRIM_LINES, uint(tot_lines_half) * 2);
for (int i = 0; i < tot_lines_half; i++) {
float line_start[3];
float line_end[3];
@@ -274,7 +274,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d,
mul_v3_fl(spacing_dir, -1.0f);
- immBegin(GPU_PRIM_LINES, (uint)(tot_lines_half - 1) * 2);
+ immBegin(GPU_PRIM_LINES, uint(tot_lines_half - 1) * 2);
for (int i = 1; i < tot_lines_half; i++) {
float line_start[3];
float line_end[3];
@@ -320,7 +320,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion *UNUSED(ar), void *a
GPU_line_width(1.0f);
const float total_len = len_v3v3(cd->preview_plane[0], cd->preview_plane[1]);
- const int tot_lines = (int)(total_len / cd->voxel_size);
+ const int tot_lines = int(total_len / cd->voxel_size);
/* Smooth-step to reduce the alpha of the grid as the line number increases. */
const float a = VOXEL_SIZE_EDIT_MAX_GRIDS_LINES * 0.1f;
@@ -346,7 +346,7 @@ static void voxel_size_edit_draw(const bContext *C, ARegion *UNUSED(ar), void *a
UnitSettings *unit = &scene->unit;
BKE_unit_value_as_string(str,
VOXEL_SIZE_EDIT_MAX_STR_LEN,
- (double)(cd->voxel_size * unit->scale_length),
+ double(cd->voxel_size * unit->scale_length),
-3,
B_UNIT_LENGTH,
unit,
diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc
index 0a86ae28b3e..0735e93437d 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -1288,7 +1288,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
else { /* #V3D_AROUND_CENTER_MEDIAN. */
if (em->bm->totvert) {
- const float total_div = 1.0f / (float)em->bm->totvert;
+ const float total_div = 1.0f / float(em->bm->totvert);
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
madd_v3_v3fl(cent, eve->co, total_div);
}
@@ -2079,7 +2079,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const
if (event->type == MOUSEMOVE || is_translate_init) {
const ViewDepths *depths = xfd->depths;
- if (depths && ((uint)event->mval[0] < depths->w) && ((uint)event->mval[1] < depths->h)) {
+ if (depths && (uint(event->mval[0]) < depths->w) && (uint(event->mval[1]) < depths->h)) {
float depth_fl = 1.0f;
ED_view3d_depth_read_cached(depths, event->mval, 0, &depth_fl);
float location_world[3];
diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc
index 10de7063bbc..2e844aa5185 100644
--- a/source/blender/editors/render/render_preview.cc
+++ b/source/blender/editors/render/render_preview.cc
@@ -1088,10 +1088,10 @@ static void shader_preview_texture(ShaderPreview *sp, Tex *tex, Scene *sce, Rend
for (int y = 0; y < height; y++) {
/* Tex coords between -1.0f and 1.0f. */
- tex_coord[1] = ((float)y / (float)height) * 2.0f - 1.0f;
+ tex_coord[1] = (float(y) / float(height)) * 2.0f - 1.0f;
for (int x = 0; x < width; x++) {
- tex_coord[0] = ((float)x / (float)height) * 2.0f - 1.0f;
+ tex_coord[0] = (float(x) / float(height)) * 2.0f - 1.0f;
/* Evaluate texture at tex_coord. */
TexResult texres = {0};
@@ -1186,7 +1186,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* lens adjust */
oldlens = ((Camera *)sce->camera->data)->lens;
if (sizex > sp->sizey) {
- ((Camera *)sce->camera->data)->lens *= (float)sp->sizey / (float)sizex;
+ ((Camera *)sce->camera->data)->lens *= float(sp->sizey) / float(sizex);
}
/* entire cycle for render engine */
@@ -1364,17 +1364,17 @@ static void icon_copy_rect(ImBuf *ibuf, uint w, uint h, uint *rect)
}
if (ima->x > ima->y) {
- scaledx = (float)w;
- scaledy = ((float)ima->y / (float)ima->x) * (float)w;
+ scaledx = float(w);
+ scaledy = (float(ima->y) / float(ima->x)) * float(w);
}
else {
- scaledx = ((float)ima->x / (float)ima->y) * (float)h;
- scaledy = (float)h;
+ scaledx = (float(ima->x) / float(ima->y)) * float(h);
+ scaledy = float(h);
}
/* Scaling down must never assign zero width/height, see: T89868. */
- ex = MAX2(1, (short)scaledx);
- ey = MAX2(1, (short)scaledy);
+ ex = MAX2(1, short(scaledx));
+ ey = MAX2(1, short(scaledy));
dx = (w - ex) / 2;
dy = (h - ey) / 2;
diff --git a/source/blender/editors/render/render_shading.cc b/source/blender/editors/render/render_shading.cc
index f784346ec8f..ba74541be73 100644
--- a/source/blender/editors/render/render_shading.cc
+++ b/source/blender/editors/render/render_shading.cc
@@ -534,7 +534,7 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
Material ***matar_object = &ob->mat;
Material **matar = static_cast<Material **>(
- MEM_callocN(sizeof(*matar) * (size_t)ob->totcol, __func__));
+ MEM_callocN(sizeof(*matar) * size_t(ob->totcol), __func__));
for (int i = ob->totcol; i--;) {
matar[i] = ob->matbits[i] ? (*matar_object)[i] : (*matar_obdata)[i];
}
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 02bf7aacd93..abfcee81e8a 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -59,7 +59,7 @@ static std::optional<float3> find_curves_brush_position(const CurvesGeometry &cu
const Span<float3> positions)
{
/* This value might have to be adjusted based on user feedback. */
- const float brush_inner_radius_re = std::min<float>(brush_radius_re, (float)UI_UNIT_X / 3.0f);
+ const float brush_inner_radius_re = std::min<float>(brush_radius_re, float(UI_UNIT_X) / 3.0f);
const float brush_inner_radius_sq_re = pow2f(brush_inner_radius_re);
float4x4 projection;
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
index 1e598e6bc5b..2cd4528503e 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
@@ -642,7 +642,7 @@ struct DensitySubtractOperationExecutor {
* strength. */
Array<bool> allow_remove_curve(curves_->curves_num(), false);
threading::parallel_for(curves_->curves_range(), 512, [&](const IndexRange range) {
- RandomNumberGenerator rng((int)(PIL_check_seconds_timer() * 1000000.0));
+ RandomNumberGenerator rng(int(PIL_check_seconds_timer() * 1000000.0));
for (const int curve_i : range) {
if (curves_to_delete[curve_i]) {
@@ -731,7 +731,7 @@ struct DensitySubtractOperationExecutor {
* strength. */
Array<bool> allow_remove_curve(curves_->curves_num(), false);
threading::parallel_for(curves_->curves_range(), 512, [&](const IndexRange range) {
- RandomNumberGenerator rng((int)(PIL_check_seconds_timer() * 1000000.0));
+ RandomNumberGenerator rng(int(PIL_check_seconds_timer() * 1000000.0));
for (const int curve_i : range) {
if (curves_to_delete[curve_i]) {
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
index ee12afeb506..3068ce9417b 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_ops.cc
@@ -1093,7 +1093,7 @@ static void min_distance_edit_draw(bContext *C, int UNUSED(x), int UNUSED(y), vo
GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
/* Draw the brush circle. */
- GPU_matrix_translate_2f((float)op_data.initial_mouse.x, (float)op_data.initial_mouse.y);
+ GPU_matrix_translate_2f(float(op_data.initial_mouse.x), float(op_data.initial_mouse.y));
GPUVertFormat *format = immVertexFormat();
uint pos2d = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc
index d3c61508726..6c7029cccd1 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc
+++ b/source/blender/editors/sculpt_paint/paint_image_2d_curve_mask.cc
@@ -52,20 +52,20 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache,
const float cursor_position[2])
{
BLI_assert(curve_mask_cache->curve_mask != nullptr);
- int offset = (int)floorf(diameter / 2.0f);
+ int offset = int(floorf(diameter / 2.0f));
int clamped_radius = max_ff(radius, 1.0);
ushort *m = curve_mask_cache->curve_mask;
const int aa_samples = aa_samples_per_texel_axis(brush, radius);
- const float aa_offset = 1.0f / (2.0f * (float)aa_samples);
- const float aa_step = 1.0f / (float)aa_samples;
+ const float aa_offset = 1.0f / (2.0f * float(aa_samples));
+ const float aa_step = 1.0f / float(aa_samples);
float bpos[2];
bpos[0] = cursor_position[0] - floorf(cursor_position[0]) + offset;
bpos[1] = cursor_position[1] - floorf(cursor_position[1]) + offset;
- float weight_factor = 65535.0f / (float)(aa_samples * aa_samples);
+ float weight_factor = 65535.0f / float(aa_samples * aa_samples);
for (int y = 0; y < diameter; y++) {
for (int x = 0; x < diameter; x++, m++) {
@@ -87,7 +87,7 @@ static void update_curve_mask(CurveMaskCache *curve_mask_cache,
}
pixel_xy[0] += aa_step;
}
- *m = (ushort)(total_weight * weight_factor);
+ *m = ushort(total_weight * weight_factor);
}
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc
index c6eefb0b50e..03925b5ebc3 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex.cc
@@ -171,8 +171,8 @@ static void view_angle_limits_init(NormalAnglePrecalc *a, float angle, bool do_m
a->angle_inner = a->angle = angle;
}
- a->angle_inner *= (float)(M_PI_2 / 90);
- a->angle *= (float)(M_PI_2 / 90);
+ a->angle_inner *= float(M_PI_2 / 90);
+ a->angle *= float(M_PI_2 / 90);
a->angle_range = a->angle - a->angle_inner;
if (a->angle_range <= 0.0f) {
@@ -894,7 +894,7 @@ static void do_weight_paint_vertex_single(
else {
/* dv and dv_mirr are the same */
int totweight_prev = dv_mirr->totweight;
- int dw_offset = (int)(dw - dv_mirr->dw);
+ int dw_offset = int(dw - dv_mirr->dw);
dw_mirr = BKE_defvert_ensure_index(dv_mirr, vgroup_mirr);
/* if we added another, get our old one back */
@@ -2128,7 +2128,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata,
}
do_weight_paint_vertex(
- data->vp, data->ob, data->wpi, v_index, final_alpha, (float)weight_final);
+ data->vp, data->ob, data->wpi, v_index, final_alpha, float(weight_final));
}
}
}
@@ -2282,7 +2282,7 @@ static void calculate_average_weight(SculptThreadedTaskData *data,
}
if (accum_len != 0) {
accum_weight /= accum_len;
- data->strength = (float)accum_weight;
+ data->strength = float(accum_weight);
}
MEM_SAFE_FREE(data->custom_data); /* 'accum' */
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
index f4da70faad7..e8d934f146c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
@@ -311,7 +311,7 @@ static void SCULPT_boundary_automasking_init(Object *ob,
if (edge_distance[i] == EDGE_DISTANCE_INF) {
continue;
}
- const float p = 1.0f - ((float)edge_distance[i] / (float)propagation_steps);
+ const float p = 1.0f - (float(edge_distance[i]) / float(propagation_steps));
const float edge_boundary_automask = pow2f(p);
*(float *)SCULPT_vertex_attr_get(
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
index 473caa18050..3f65248bc78 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc
@@ -947,7 +947,7 @@ static int sculpt_face_sets_change_visibility_invoke(bContext *C,
/* Update the active vertex and Face Set using the cursor position to avoid relying on the paint
* cursor updates. */
SculptCursorGeometryInfo sgi;
- const float mval_fl[2] = {(float)event->mval[0], (float)event->mval[1]};
+ const float mval_fl[2] = {float(event->mval[0]), float(event->mval[1])};
SCULPT_vertex_random_access_ensure(ss);
SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false);
@@ -1416,7 +1416,7 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven
/* Update the current active Face Set and Vertex as the operator can be used directly from the
* tool without brush cursor. */
SculptCursorGeometryInfo sgi;
- const float mval_fl[2] = {(float)event->mval[0], (float)event->mval[1]};
+ const float mval_fl[2] = {float(event->mval[0]), float(event->mval[1])};
if (!SCULPT_cursor_geometry_info_update(C, &sgi, mval_fl, false)) {
/* The cursor is not over the mesh. Cancel to avoid editing the last updated Face Set ID. */
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc
index 2f3eaf87836..06224b3a28c 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -457,8 +457,8 @@ static int compare_date(void *user_data, const void *a1, const void *a2)
return ret;
}
- time1 = (int64_t)entry1->st.st_mtime;
- time2 = (int64_t)entry2->st.st_mtime;
+ time1 = int64_t(entry1->st.st_mtime);
+ time2 = int64_t(entry2->st.st_mtime);
if (time1 < time2) {
return compare_apply_inverted(1, sort_data);
}
@@ -919,7 +919,7 @@ void filelist_filter(FileList *filelist)
}
filtered_tmp = static_cast<FileListInternEntry **>(
- MEM_mallocN(sizeof(*filtered_tmp) * (size_t)num_files, __func__));
+ MEM_mallocN(sizeof(*filtered_tmp) * size_t(num_files), __func__));
/* Filter remap & count how many files are left after filter in a single loop. */
LISTBASE_FOREACH (FileListInternEntry *, file, &filelist->filelist_intern.entries) {
@@ -932,10 +932,10 @@ void filelist_filter(FileList *filelist)
MEM_freeN(filelist->filelist_intern.filtered);
}
filelist->filelist_intern.filtered = static_cast<FileListInternEntry **>(
- MEM_mallocN(sizeof(*filelist->filelist_intern.filtered) * (size_t)num_filtered, __func__));
+ MEM_mallocN(sizeof(*filelist->filelist_intern.filtered) * size_t(num_filtered), __func__));
memcpy(filelist->filelist_intern.filtered,
filtered_tmp,
- sizeof(*filelist->filelist_intern.filtered) * (size_t)num_filtered);
+ sizeof(*filelist->filelist_intern.filtered) * size_t(num_filtered));
filelist->filelist.entries_filtered_num = num_filtered;
// printf("Filetered: %d over %d entries\n", num_filtered, filelist->filelist.entries_num);
@@ -2436,7 +2436,7 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
do {
int offs_idx = index + offs;
if (start_index <= offs_idx && offs_idx < end_index) {
- int offs_block_idx = (block_index + offs) % (int)cache_size;
+ int offs_block_idx = (block_index + offs) % int(cache_size);
filelist_cache_previews_push(filelist, cache->block_entries[offs_block_idx], offs_idx);
}
} while ((offs = -offs) < 0); /* Switch between negative and positive offset. */
@@ -3543,7 +3543,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
filelist_readjob_append_entries(job_params, &entries, entries_num, do_update);
dirs_done_count++;
- *progress = (float)dirs_done_count / (float)dirs_todo_count;
+ *progress = float(dirs_done_count) / float(dirs_todo_count);
MEM_freeN(subdir);
}
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index b2510df9105..a4c054155dd 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -1764,7 +1764,7 @@ static void nodelink_batch_init()
/* curve strip */
for (int i = 0; i < LINK_RESOL; i++) {
- uv[0] = 255 * (i / (float)(LINK_RESOL - 1));
+ uv[0] = 255 * (i / float(LINK_RESOL - 1));
uv[1] = 0;
set_nodelink_vertex(vbo, uv_id, pos_id, expand_id, v++, uv, pos, exp);
uv[1] = 255;
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 98f10bfdfe5..8f72d292740 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -432,7 +432,7 @@ static void node_update_basis(const bContext &C,
float aspect = 1.0f;
if (node.preview_xsize && node.preview_ysize) {
- aspect = (float)node.preview_ysize / (float)node.preview_xsize;
+ aspect = float(node.preview_ysize) / float(node.preview_xsize);
}
dy -= NODE_DYS / 2;
@@ -597,7 +597,7 @@ static void node_update_hidden(bNode &node, uiBlock &block)
float hiddenrad = HIDDEN_RAD;
float tot = MAX2(totin, totout);
if (tot > 4) {
- hiddenrad += 5.0f * (float)(tot - 4);
+ hiddenrad += 5.0f * float(tot - 4);
}
node.totr.xmin = loc.x;
@@ -606,7 +606,7 @@ static void node_update_hidden(bNode &node, uiBlock &block)
node.totr.ymin = node.totr.ymax - 2 * hiddenrad;
/* Output sockets. */
- float rad = (float)M_PI / (1.0f + (float)totout);
+ float rad = float(M_PI) / (1.0f + float(totout));
float drad = rad;
LISTBASE_FOREACH (bNodeSocket *, socket, &node.outputs) {
@@ -619,7 +619,7 @@ static void node_update_hidden(bNode &node, uiBlock &block)
}
/* Input sockets. */
- rad = drad = -(float)M_PI / (1.0f + (float)totin);
+ rad = drad = -float(M_PI) / (1.0f + float(totin));
LISTBASE_FOREACH (bNodeSocket *, socket, &node.inputs) {
if (!nodeSocketIsHidden(socket)) {
@@ -1293,20 +1293,20 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
{
float xrect = BLI_rctf_size_x(prv);
float yrect = BLI_rctf_size_y(prv);
- float xscale = xrect / ((float)preview->xsize);
- float yscale = yrect / ((float)preview->ysize);
+ float xscale = xrect / float(preview->xsize);
+ float yscale = yrect / float(preview->ysize);
float scale;
/* Uniform scale and offset. */
rctf draw_rect = *prv;
if (xscale < yscale) {
- float offset = 0.5f * (yrect - ((float)preview->ysize) * xscale);
+ float offset = 0.5f * (yrect - float(preview->ysize) * xscale);
draw_rect.ymin += offset;
draw_rect.ymax -= offset;
scale = xscale;
}
else {
- float offset = 0.5f * (xrect - ((float)preview->xsize) * yscale);
+ float offset = 0.5f * (xrect - float(preview->xsize) * yscale);
draw_rect.xmin += offset;
draw_rect.xmax -= offset;
scale = yscale;
@@ -1930,8 +1930,8 @@ static void node_draw_extra_info_row(const bNode &node,
UI_BTYPE_BUT,
0,
extra_info_row.icon,
- (int)but_icon_left,
- (int)(rect.ymin + row * (20.0f * U.dpi_fac)),
+ int(but_icon_left),
+ int(rect.ymin + row * (20.0f * U.dpi_fac)),
but_icon_width,
UI_UNIT_Y,
nullptr,
@@ -1956,10 +1956,10 @@ static void node_draw_extra_info_row(const bNode &node,
UI_BTYPE_LABEL,
0,
extra_info_row.text.c_str(),
- (int)but_text_left,
- (int)(rect.ymin + row * (20.0f * U.dpi_fac)),
- (short)but_text_width,
- (short)NODE_DY,
+ int(but_text_left),
+ int(rect.ymin + row * (20.0f * U.dpi_fac)),
+ short(but_text_width),
+ short(NODE_DY),
nullptr,
0,
0,
@@ -2195,10 +2195,10 @@ static void node_draw_basis(const bContext &C,
UI_BTYPE_LABEL,
0,
showname,
- (int)(rct.xmin + NODE_MARGIN_X + 0.4f),
- (int)(rct.ymax - NODE_DY),
- (short)(iconofs - rct.xmin - (18.0f * U.dpi_fac)),
- (short)NODE_DY,
+ int(rct.xmin + NODE_MARGIN_X + 0.4f),
+ int(rct.ymax - NODE_DY),
+ short(iconofs - rct.xmin - (18.0f * U.dpi_fac)),
+ short(NODE_DY),
nullptr,
0,
0,
@@ -2425,8 +2425,8 @@ static void node_draw_hidden(const bContext &C,
showname,
round_fl_to_int(rct.xmin + NODE_MARGIN_X),
round_fl_to_int(centy - NODE_DY * 0.5f),
- (short)(BLI_rctf_size_x(&rct) - ((18.0f + 12.0f) * U.dpi_fac)),
- (short)NODE_DY,
+ short(BLI_rctf_size_x(&rct) - ((18.0f + 12.0f) * U.dpi_fac)),
+ short(NODE_DY),
nullptr,
0,
0,
@@ -2722,7 +2722,7 @@ static void frame_node_draw_label(const bNodeTree &ntree,
UI_GetThemeColorBlendShade3ubv(TH_TEXT, color_id, 0.4f, 10, color);
BLF_color3ubv(fontid, color);
- const float margin = (float)(NODE_DY / 4);
+ const float margin = float(NODE_DY / 4);
const float width = BLF_width(fontid, label, sizeof(label));
const float ascender = BLF_ascender(fontid);
const int label_height = ((margin / aspect) + (ascender * aspect));
@@ -2866,7 +2866,7 @@ static void reroute_node_draw(
x,
y,
width,
- (short)NODE_DY,
+ short(NODE_DY),
nullptr,
0,
0,
@@ -3013,7 +3013,7 @@ static void snode_setup_v2d(SpaceNode &snode, ARegion &region, const float2 &cen
UI_view2d_view_ortho(&v2d);
/* Aspect + font, set each time. */
- snode.runtime->aspect = BLI_rctf_size_x(&v2d.cur) / (float)region.winx;
+ snode.runtime->aspect = BLI_rctf_size_x(&v2d.cur) / float(region.winx);
// XXX snode->curfont = uiSetCurFont_ext(snode->aspect);
}
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index 31d99eafbc1..e446d5421e7 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -2859,8 +2859,8 @@ static void viewer_border_corner_to_backdrop(SpaceNode *snode,
float bufx = backdrop_width * snode->zoom;
float bufy = backdrop_height * snode->zoom;
- *fx = (bufx > 0.0f ? ((float)x - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
- *fy = (bufy > 0.0f ? ((float)y - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ *fx = (bufx > 0.0f ? (float(x) - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ *fy = (bufy > 0.0f ? (float(y) - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
}
static int viewer_border_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_node/node_gizmo.cc b/source/blender/editors/space_node/node_gizmo.cc
index f9126556b71..a6c9538d782 100644
--- a/source/blender/editors/space_node/node_gizmo.cc
+++ b/source/blender/editors/space_node/node_gizmo.cc
@@ -252,7 +252,7 @@ static void gizmo_node_crop_prop_matrix_get(const wmGizmo *gz,
const float *dims = crop_group->state.dims;
const bNode *node = (const bNode *)gz_prop->custom_func.user_data;
const NodeTwoXYs *nxy = (const NodeTwoXYs *)node->storage;
- bool is_relative = (bool)node->custom2;
+ bool is_relative = bool(node->custom2);
rctf rct;
two_xy_to_rect(nxy, &rct, dims, is_relative);
matrix[0][0] = fabsf(BLI_rctf_size_x(&rct));
@@ -271,7 +271,7 @@ static void gizmo_node_crop_prop_matrix_set(const wmGizmo *gz,
const float *dims = crop_group->state.dims;
bNode *node = (bNode *)gz_prop->custom_func.user_data;
NodeTwoXYs *nxy = (NodeTwoXYs *)node->storage;
- bool is_relative = (bool)node->custom2;
+ bool is_relative = bool(node->custom2);
rctf rct;
two_xy_to_rect(nxy, &rct, dims, is_relative);
const bool nx = rct.xmin > rct.xmax;
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index e12ab3191cb..f597bf20b55 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -2323,7 +2323,7 @@ static int node_insert_offset_modal(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_PASS_THROUGH;
}
- const float duration = (float)iofsd->anim_timer->duration;
+ const float duration = float(iofsd->anim_timer->duration);
/* handle animation - do this before possibly aborting due to duration, since
* main thread might be so busy that node hasn't reached final position yet */
diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc
index d93b205b1b7..1b47316ebd0 100644
--- a/source/blender/editors/space_node/node_select.cc
+++ b/source/blender/editors/space_node/node_select.cc
@@ -843,8 +843,7 @@ static int node_circleselect_exec(bContext *C, wmOperator *op)
int x, y, radius;
float2 offset;
- float zoom = (float)(BLI_rcti_size_x(&region->winrct)) /
- (float)(BLI_rctf_size_x(&region->v2d.cur));
+ float zoom = float(BLI_rcti_size_x(&region->winrct)) / float(BLI_rctf_size_x(&region->v2d.cur));
const eSelectOp sel_op = ED_select_op_modal(
(eSelectOp)RNA_enum_get(op->ptr, "mode"),
@@ -867,7 +866,7 @@ static int node_circleselect_exec(bContext *C, wmOperator *op)
/* Frame nodes are selectable by their borders (including their whole rect - as for other
* nodes - would prevent selection of _only_ other nodes inside that frame. */
rctf frame_inside = node_frame_rect_inside(*node);
- const float radius_adjusted = (float)radius / zoom;
+ const float radius_adjusted = float(radius) / zoom;
BLI_rctf_pad(&frame_inside, -2.0f * radius_adjusted, -2.0f * radius_adjusted);
if (BLI_rctf_isect_circle(&node->totr, offset, radius_adjusted) &&
!BLI_rctf_isect_circle(&frame_inside, offset, radius_adjusted)) {
diff --git a/source/blender/editors/space_node/node_view.cc b/source/blender/editors/space_node/node_view.cc
index 33a75385022..2c02e3c6ecc 100644
--- a/source/blender/editors/space_node/node_view.cc
+++ b/source/blender/editors/space_node/node_view.cc
@@ -464,9 +464,9 @@ bool ED_space_node_get_position(
/* map the mouse coords to the backdrop image space */
float bufx = ibuf->x * snode->zoom;
float bufy = ibuf->y * snode->zoom;
- fpos[0] = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
+ fpos[0] = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
0.0f);
- fpos[1] = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
+ fpos[1] = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
0.0f);
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -498,13 +498,13 @@ bool ED_space_node_color_sample(
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? (float(mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? (float(mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f : 0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
uchar *cp;
- int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
+ int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
CLAMP(x, 0, ibuf->x - 1);
CLAMP(y, 0, ibuf->y - 1);
@@ -555,15 +555,15 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
+ fx = (bufx > 0.0f ? (float(event->mval[0]) - 0.5f * region->winx - snode->xof) / bufx + 0.5f :
0.0f);
- fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
+ fy = (bufy > 0.0f ? (float(event->mval[1]) - 0.5f * region->winy - snode->yof) / bufy + 0.5f :
0.0f);
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
const float *fp;
uchar *cp;
- int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
+ int x = int(fx * ibuf->x), y = int(fy * ibuf->y);
CLAMP(x, 0, ibuf->x - 1);
CLAMP(y, 0, ibuf->y - 1);
@@ -584,10 +584,10 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event)
info->col[2] = cp[2];
info->col[3] = cp[3];
- info->colf[0] = (float)cp[0] / 255.0f;
- info->colf[1] = (float)cp[1] / 255.0f;
- info->colf[2] = (float)cp[2] / 255.0f;
- info->colf[3] = (float)cp[3] / 255.0f;
+ info->colf[0] = float(cp[0]) / 255.0f;
+ info->colf[1] = float(cp[1]) / 255.0f;
+ info->colf[2] = float(cp[2]) / 255.0f;
+ info->colf[3] = float(cp[3]) / 255.0f;
copy_v4_v4(info->linearcol, info->colf);
IMB_colormanagement_colorspace_to_scene_linear_v4(
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index fae3eb1a143..b02f22f378f 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -672,14 +672,14 @@ static void node_group_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *d
{
ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
}
static void node_id_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
{
ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
}
static void node_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
@@ -687,7 +687,7 @@ static void node_id_path_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox
ID *id = WM_drag_get_local_ID_or_import_from_asset(drag, 0);
if (id) {
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
RNA_struct_property_unset(drop->ptr, "filepath");
}
else if (drag->path[0]) {
diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc
index 3c52f79a80e..76f93e5f518 100644
--- a/source/blender/editors/space_outliner/outliner_draw.cc
+++ b/source/blender/editors/space_outliner/outliner_draw.cc
@@ -1123,7 +1123,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
VIEW_LAYER_RENDER,
0,
ICON_RESTRICT_RENDER_OFF,
- (int)(region->v2d.cur.xmax - restrict_offsets.render),
+ int(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1158,7 +1158,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.hide),
+ int(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1185,7 +1185,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.select),
+ int(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1210,7 +1210,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
+ int(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1235,7 +1235,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.render),
+ int(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1266,7 +1266,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.hide),
+ int(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1295,7 +1295,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
+ int(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1318,7 +1318,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.render),
+ int(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1350,7 +1350,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
+ int(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1374,7 +1374,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_UNSELECTABLE,
0,
ICON_RESTRICT_SELECT_OFF,
- (int)(region->v2d.cur.xmax - restrict_offsets.select),
+ int(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1400,7 +1400,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_HIDDEN_A,
0,
ICON_RESTRICT_VIEW_OFF,
- (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
+ int(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1422,7 +1422,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
BONE_UNSELECTABLE,
0,
ICON_RESTRICT_SELECT_OFF,
- (int)(region->v2d.cur.xmax - restrict_offsets.select),
+ int(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1448,7 +1448,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
GP_LAYER_HIDE,
0,
ICON_HIDE_OFF,
- (int)(region->v2d.cur.xmax - restrict_offsets.hide),
+ int(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1469,7 +1469,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
GP_LAYER_LOCKED,
0,
ICON_UNLOCKED,
- (int)(region->v2d.cur.xmax - restrict_offsets.select),
+ int(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1501,7 +1501,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax) - restrict_offsets.enable,
+ int(region->v2d.cur.xmax) - restrict_offsets.enable,
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1521,7 +1521,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.hide),
+ int(region->v2d.cur.xmax - restrict_offsets.hide),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1550,7 +1550,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.holdout),
+ int(region->v2d.cur.xmax - restrict_offsets.holdout),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1580,7 +1580,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.indirect_only),
+ int(region->v2d.cur.xmax - restrict_offsets.indirect_only),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1612,7 +1612,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.viewport),
+ int(region->v2d.cur.xmax - restrict_offsets.viewport),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1649,7 +1649,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.render),
+ int(region->v2d.cur.xmax - restrict_offsets.render),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1684,7 +1684,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_BTYPE_ICON_TOGGLE,
0,
0,
- (int)(region->v2d.cur.xmax - restrict_offsets.select),
+ int(region->v2d.cur.xmax - restrict_offsets.select),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1759,7 +1759,7 @@ static void outliner_draw_userbuts(uiBlock *block,
UI_BTYPE_BUT,
1,
buf,
- (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_USERS),
+ int(region->v2d.cur.xmax - OL_TOG_USER_BUTS_USERS),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -1782,7 +1782,7 @@ static void outliner_draw_userbuts(uiBlock *block,
LIB_FAKEUSER,
1,
ICON_FAKE_USER_OFF,
- (int)(region->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS),
+ int(region->v2d.cur.xmax - OL_TOG_USER_BUTS_STATUS),
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
@@ -2093,7 +2093,7 @@ static void outliner_buttons(const bContext *C,
UI_UNIT_Y - 1,
(void *)te->name,
1.0,
- (float)len,
+ float(len),
0,
0,
"");
@@ -2367,7 +2367,7 @@ static BIFIconID tree_element_get_icon_from_id(const ID *id)
/* TODO(sergey): Casting to short here just to handle ID_NLA which is
* NOT inside of IDType enum.
*/
- switch ((short)GS(id->name)) {
+ switch (short(GS(id->name))) {
case ID_SCE:
return ICON_SCENE_DATA;
case ID_ME:
@@ -2952,16 +2952,16 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle,
{
const float color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float ufac = 0.25f * UI_UNIT_X;
- float offset_x = (float)offsx + UI_UNIT_X * 0.35f;
+ float offset_x = float(offsx) + UI_UNIT_X * 0.35f;
rctf rect{};
BLI_rctf_init(&rect,
offset_x + ufac,
offset_x + UI_UNIT_X - ufac,
- (float)ys - UI_UNIT_Y * 0.2f + ufac,
- (float)ys - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac);
+ float(ys) - UI_UNIT_Y * 0.2f + ufac,
+ float(ys) - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac);
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(&rect, true, (float)UI_UNIT_Y / 2.0f - ufac, color);
+ UI_draw_roundbox_aa(&rect, true, float(UI_UNIT_Y) / 2.0f - ufac, color);
/* Now the numbers. */
uchar text_col[4];
@@ -2981,7 +2981,7 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle,
}
UI_fontstyle_draw_simple(&fstyle_small,
(offset_x + ufac + UI_UNIT_X * (2 - num_digits) * 0.12f),
- (float)ys - UI_UNIT_Y * 0.095f + ufac,
+ float(ys) - UI_UNIT_Y * 0.095f + ufac,
number_text,
text_col);
UI_fontstyle_set(fstyle);
@@ -3038,10 +3038,10 @@ static void outliner_draw_iconrow_doit(uiBlock *block,
icon_border[3] = 0.3f;
}
- outliner_draw_active_indicator((float)*offsx,
- (float)ys,
- (float)*offsx + UI_UNIT_X,
- (float)ys + UI_UNIT_Y,
+ outliner_draw_active_indicator(float(*offsx),
+ float(ys),
+ float(*offsx) + UI_UNIT_X,
+ float(ys) + UI_UNIT_Y,
icon_color,
icon_border);
}
@@ -3049,10 +3049,10 @@ static void outliner_draw_iconrow_doit(uiBlock *block,
if (tselem->flag & TSE_HIGHLIGHTED_ICON) {
alpha_fac += 0.5;
}
- tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, alpha_fac, false);
+ tselem_draw_icon(block, xmax, float(*offsx), float(ys), tselem, te, alpha_fac, false);
te->xs = *offsx;
te->ys = ys;
- te->xend = (short)*offsx + UI_UNIT_X;
+ te->xend = short(*offsx) + UI_UNIT_X;
if (num_elements > 1) {
outliner_draw_iconrow_number(fstyle, *offsx, ys, num_elements);
@@ -3327,10 +3327,10 @@ static void outliner_draw_tree_element(bContext *C,
/* Active circle. */
if (active != OL_DRAWSEL_NONE) {
- outliner_draw_active_indicator((float)startx + offsx + UI_UNIT_X,
- (float)*starty,
- (float)startx + offsx + 2.0f * UI_UNIT_X,
- (float)*starty + UI_UNIT_Y,
+ outliner_draw_active_indicator(float(startx) + offsx + UI_UNIT_X,
+ float(*starty),
+ float(startx) + offsx + 2.0f * UI_UNIT_X,
+ float(*starty) + UI_UNIT_Y,
icon_bgcolor,
icon_border);
@@ -3347,14 +3347,14 @@ static void outliner_draw_tree_element(bContext *C,
/* Icons a bit higher. */
if (TSELEM_OPEN(tselem, space_outliner)) {
- UI_icon_draw_alpha((float)icon_x + 2 * ufac,
- (float)*starty + 1 * ufac,
+ UI_icon_draw_alpha(float(icon_x) + 2 * ufac,
+ float(*starty) + 1 * ufac,
ICON_DISCLOSURE_TRI_DOWN,
alpha_fac);
}
else {
- UI_icon_draw_alpha((float)icon_x + 2 * ufac,
- (float)*starty + 1 * ufac,
+ UI_icon_draw_alpha(float(icon_x) + 2 * ufac,
+ float(*starty) + 1 * ufac,
ICON_DISCLOSURE_TRI_RIGHT,
alpha_fac);
}
@@ -3365,8 +3365,8 @@ static void outliner_draw_tree_element(bContext *C,
if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE)) &&
tselem_draw_icon(block,
xmax,
- (float)startx + offsx,
- (float)*starty,
+ float(startx) + offsx,
+ float(*starty),
tselem,
te,
(tselem->flag & TSE_HIGHLIGHTED_ICON) ? alpha_fac + 0.5f : alpha_fac,
@@ -3383,7 +3383,7 @@ static void outliner_draw_tree_element(bContext *C,
const BIFIconID lib_icon = (BIFIconID)UI_icon_from_library(tselem->id);
if (lib_icon != ICON_NONE) {
UI_icon_draw_alpha(
- (float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, lib_icon, alpha_fac);
+ float(startx) + offsx + 2 * ufac, float(*starty) + 2 * ufac, lib_icon, alpha_fac);
offsx += UI_UNIT_X + 4 * ufac;
}
}
@@ -3399,7 +3399,7 @@ static void outliner_draw_tree_element(bContext *C,
UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_color);
}
- offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
+ offsx += int(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
/* Closed item, we draw the icons, not when it's a scene, or master-server list though. */
if (!TSELEM_OPEN(tselem, space_outliner)) {
@@ -3590,7 +3590,7 @@ static void outliner_draw_struct_marks(ARegion *region,
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immThemeColorShadeAlpha(TH_BACK, -15, -200);
- immRecti(pos, 0, *starty + 1, (int)region->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
+ immRecti(pos, 0, *starty + 1, int(region->v2d.cur.xmax), *starty + UI_UNIT_Y - 1);
immUnbindProgram();
}
}
@@ -3636,16 +3636,16 @@ static void outliner_draw_highlights(uint pos,
/* Selection status. */
if ((tselem->flag & TSE_ACTIVE) && (tselem->flag & TSE_SELECTED)) {
immUniformColor4fv(col_active);
- immRecti(pos, 0, start_y, (int)region->v2d.cur.xmax, start_y + UI_UNIT_Y);
+ immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
}
else if (tselem->flag & TSE_SELECTED) {
immUniformColor4fv(col_selection);
- immRecti(pos, 0, start_y, (int)region->v2d.cur.xmax, start_y + UI_UNIT_Y);
+ immRecti(pos, 0, start_y, int(region->v2d.cur.xmax), start_y + UI_UNIT_Y);
}
/* Highlights. */
if (tselem->flag & (TSE_DRAG_ANY | TSE_HIGHLIGHTED | TSE_SEARCHMATCH)) {
- const int end_x = (int)region->v2d.cur.xmax;
+ const int end_x = int(region->v2d.cur.xmax);
if (tselem->flag & TSE_DRAG_ANY) {
/* Drag and drop highlight. */
@@ -3749,19 +3749,19 @@ static void outliner_draw_tree(bContext *C,
if (space_outliner->outlinevis == SO_DATA_API) {
/* struct marks */
- starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ starty = int(region->v2d.tot.ymax) - UI_UNIT_Y - OL_Y_OFFSET;
outliner_draw_struct_marks(region, space_outliner, &space_outliner->tree, &starty);
}
/* Draw highlights before hierarchy. */
- starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ starty = int(region->v2d.tot.ymax) - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
outliner_draw_highlights(region, space_outliner, startx, &starty);
/* Set scissor so tree elements or lines can't overlap restriction icons. */
int scissor[4] = {0};
if (right_column_width > 0.0f) {
- int mask_x = BLI_rcti_size_x(&region->v2d.mask) - (int)right_column_width + 1;
+ int mask_x = BLI_rcti_size_x(&region->v2d.mask) - int(right_column_width) + 1;
CLAMP_MIN(mask_x, 0);
GPU_scissor_get(scissor);
@@ -3769,12 +3769,12 @@ static void outliner_draw_tree(bContext *C,
}
/* Draw hierarchy lines for collections and object children. */
- starty = (int)region->v2d.tot.ymax - OL_Y_OFFSET;
+ starty = int(region->v2d.tot.ymax) - OL_Y_OFFSET;
startx = columns_offset + UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, startx, &starty);
/* Items themselves. */
- starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
+ starty = int(region->v2d.tot.ymax) - UI_UNIT_Y - OL_Y_OFFSET;
startx = columns_offset;
LISTBASE_FOREACH (TreeElement *, te, &space_outliner->tree) {
outliner_draw_tree_element(C,
@@ -3801,7 +3801,7 @@ static void outliner_back(ARegion *region)
{
int ystart;
- ystart = (int)region->v2d.tot.ymax;
+ ystart = int(region->v2d.tot.ymax);
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
GPUVertFormat *format = immVertexFormat();
@@ -3815,7 +3815,7 @@ static void outliner_back(ARegion *region)
const float x1 = 0.0f, x2 = region->v2d.cur.xmax;
float y1 = ystart, y2;
- int tot = (int)floor(ystart - region->v2d.cur.ymin + 2 * UI_UNIT_Y) / (2 * UI_UNIT_Y);
+ int tot = int(floor(ystart - region->v2d.cur.ymin + 2 * UI_UNIT_Y)) / (2 * UI_UNIT_Y);
if (tot > 0) {
immBegin(GPU_PRIM_TRIS, 6 * tot);
diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc
index be3c1547579..7a66644b5a8 100644
--- a/source/blender/editors/space_outliner/outliner_edit.cc
+++ b/source/blender/editors/space_outliner/outliner_edit.cc
@@ -596,7 +596,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
- const short id_type = (short)RNA_enum_get(op->ptr, "id_type");
+ const short id_type = short(RNA_enum_get(op->ptr, "id_type"));
ID *old_id = static_cast<ID *>(
BLI_findlink(which_libbase(CTX_data_main(C), id_type), RNA_enum_get(op->ptr, "old_id")));
ID *new_id = static_cast<ID *>(
@@ -692,7 +692,7 @@ static const EnumPropertyItem *outliner_id_itemf(bContext *C,
int totitem = 0;
int i = 0;
- short id_type = (short)RNA_enum_get(ptr, "id_type");
+ short id_type = short(RNA_enum_get(ptr, "id_type"));
ID *id = static_cast<ID *>(which_libbase(CTX_data_main(C), id_type)->first);
for (; id; id = static_cast<ID *>(id->next)) {
@@ -1233,12 +1233,12 @@ void OUTLINER_OT_select_all(wmOperatorType *ot)
void outliner_set_coordinates(const ARegion *region, const SpaceOutliner *space_outliner)
{
- int starty = (int)(region->v2d.tot.ymax) - UI_UNIT_Y;
+ int starty = int(region->v2d.tot.ymax) - UI_UNIT_Y;
tree_iterator::all_open(*space_outliner, [&](TreeElement *te) {
/* store coord and continue, we need coordinates for elements outside view too */
te->xs = 0;
- te->ys = (float)starty;
+ te->ys = float(starty);
starty -= UI_UNIT_Y;
});
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index 1628945c4cd..69ab9a2950e 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -118,7 +118,7 @@ static void get_element_operation_type(
*datalevel = tselem->type;
}
else {
- const int idcode = (int)GS(tselem->id->name);
+ const int idcode = int(GS(tselem->id->name));
bool is_standard_id = false;
switch ((ID_Type)idcode) {
case ID_SCE:
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
index 3fe4c7c8ee0..7e6b0ab18c3 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
@@ -283,7 +283,7 @@ class SpreadsheetLayoutDrawer : public SpreadsheetDrawer {
void draw_float_vector(const CellDrawParams &params, const Span<float> values) const
{
BLI_assert(!values.is_empty());
- const float segment_width = (float)params.width / values.size();
+ const float segment_width = float(params.width) / values.size();
for (const int i : values.index_range()) {
std::stringstream ss;
const float value = values[i];
@@ -314,7 +314,7 @@ class SpreadsheetLayoutDrawer : public SpreadsheetDrawer {
{
const ColorGeometry4f float_color = color.decode();
Span<float> values(&float_color.r, 4);
- const float segment_width = (float)params.width / values.size();
+ const float segment_width = float(params.width) / values.size();
for (const int i : values.index_range()) {
std::stringstream ss;
const float value = values[i];
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
index 03cf0116dce..96827692a25 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter.cc
@@ -242,14 +242,14 @@ static void apply_row_filter(const SpreadsheetRowFilter &row_filter,
switch (row_filter.operation) {
case SPREADSHEET_ROW_FILTER_EQUAL: {
const float4 value_floats = {
- (float)value.r, (float)value.g, (float)value.b, (float)value.a};
+ float(value.r), float(value.g), float(value.b), float(value.a)};
const float threshold_sq = pow2f(row_filter.threshold);
apply_filter_operation(
column_data.typed<ColorGeometry4b>(),
[&](const ColorGeometry4b cell_bytes) {
const ColorGeometry4f cell = cell_bytes.decode();
const float4 cell_floats = {
- (float)cell.r, (float)cell.g, (float)cell.b, (float)cell.a};
+ float(cell.r), float(cell.g), float(cell.b), float(cell.a)};
return len_squared_v4v4(value_floats, cell_floats) <= threshold_sq;
},
prev_mask,
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc
index 548e6cf29e4..a1f6de56bb2 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc
@@ -309,7 +309,7 @@ static short get_filter_expand_flag(const bContext *UNUSED(C), Panel *panel)
PointerRNA *filter_ptr = UI_panel_custom_data_get(panel);
SpreadsheetRowFilter *filter = (SpreadsheetRowFilter *)filter_ptr->data;
- return (short)filter->flag & SPREADSHEET_ROW_FILTER_UI_EXPAND;
+ return short(filter->flag) & SPREADSHEET_ROW_FILTER_UI_EXPAND;
}
static void set_filter_expand_flag(const bContext *UNUSED(C), Panel *panel, short expand_flag)
diff --git a/source/blender/editors/space_view3d/space_view3d.cc b/source/blender/editors/space_view3d/space_view3d.cc
index 418330d1e70..1bbe6ccc529 100644
--- a/source/blender/editors/space_view3d/space_view3d.cc
+++ b/source/blender/editors/space_view3d/space_view3d.cc
@@ -778,7 +778,7 @@ static void view3d_collection_drop_copy_local_id(bContext *UNUSED(C),
wmDropBox *drop)
{
ID *id = WM_drag_get_local_ID(drag, ID_GR);
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
}
/* Mostly the same logic as #view3d_ob_drop_copy_external_asset(), just different enough to make
@@ -803,7 +803,7 @@ static void view3d_collection_drop_copy_external_asset(bContext *UNUSED(C),
DEG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
- RNA_int_set(drop->ptr, "session_uuid", (int)id->session_uuid);
+ RNA_int_set(drop->ptr, "session_uuid", int(id->session_uuid));
/* Make an object active, just use the first one in the collection. */
CollectionObject *cobject = static_cast<CollectionObject *>(collection->gobject.first);
diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc
index 9a2512adc31..f38b22fce4d 100644
--- a/source/blender/editors/space_view3d/view3d_select.cc
+++ b/source/blender/editors/space_view3d/view3d_select.cc
@@ -2246,7 +2246,7 @@ static Base *mouse_select_object_center(ViewContext *vc, Base *startbase, const
BKE_view_layer_synced_ensure(scene, view_layer);
Base *oldbasact = BKE_view_layer_active_base_get(view_layer);
- const float mval_fl[2] = {(float)mval[0], (float)mval[1]};
+ const float mval_fl[2] = {float(mval[0]), float(mval[1])};
float dist = ED_view3d_select_dist_px() * 1.3333f;
Base *basact = nullptr;
@@ -4068,7 +4068,7 @@ static bool mesh_circle_select(ViewContext *vc,
if (use_zbuf) {
if (esel->select_bitmap == nullptr) {
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), nullptr);
+ vc->depsgraph, vc->region, vc->v3d, mval, int(rad + 1.0f), nullptr);
}
}
@@ -4144,7 +4144,7 @@ static bool paint_facesel_circle_select(ViewContext *vc,
{
EditSelectBuf_Cache *esel = static_cast<EditSelectBuf_Cache *>(wm_userdata->data);
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), nullptr);
+ vc->depsgraph, vc->region, vc->v3d, mval, int(rad + 1.0f), nullptr);
if (esel->select_bitmap != nullptr) {
changed |= edbm_backbuf_check_and_select_faces_obmode(me, esel, sel_op);
MEM_freeN(esel->select_bitmap);
@@ -4206,7 +4206,7 @@ static bool paint_vertsel_circle_select(ViewContext *vc,
if (use_zbuf) {
EditSelectBuf_Cache *esel = static_cast<EditSelectBuf_Cache *>(wm_userdata->data);
esel->select_bitmap = DRW_select_buffer_bitmap_from_circle(
- vc->depsgraph, vc->region, vc->v3d, mval, (int)(rad + 1.0f), nullptr);
+ vc->depsgraph, vc->region, vc->v3d, mval, int(rad + 1.0f), nullptr);
if (esel->select_bitmap != nullptr) {
changed |= edbm_backbuf_check_and_select_verts_obmode(me, esel, sel_op);
MEM_freeN(esel->select_bitmap);
@@ -4770,16 +4770,16 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
obedit = vc.obedit;
if (obedit) {
- obedit_circle_select(C, &vc, wm_userdata, sel_op, mval, (float)radius);
+ obedit_circle_select(C, &vc, wm_userdata, sel_op, mval, float(radius));
}
else if (BKE_paint_select_face_test(obact)) {
- paint_facesel_circle_select(&vc, wm_userdata, sel_op, mval, (float)radius);
+ paint_facesel_circle_select(&vc, wm_userdata, sel_op, mval, float(radius));
}
else if (BKE_paint_select_vert_test(obact)) {
- paint_vertsel_circle_select(&vc, wm_userdata, sel_op, mval, (float)radius);
+ paint_vertsel_circle_select(&vc, wm_userdata, sel_op, mval, float(radius));
}
else if (obact->mode & OB_MODE_POSE) {
- pose_circle_select(&vc, sel_op, mval, (float)radius);
+ pose_circle_select(&vc, sel_op, mval, float(radius));
ED_outliner_select_sync_from_pose_bone_tag(C);
}
else {
@@ -4789,7 +4789,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
FOREACH_OBJECT_IN_MODE_END;
}
else if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) {
- if (PE_circle_select(C, wm_userdata, sel_op, mval, (float)radius)) {
+ if (PE_circle_select(C, wm_userdata, sel_op, mval, float(radius))) {
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
@@ -4798,7 +4798,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
else {
- if (object_circle_select(&vc, sel_op, mval, (float)radius)) {
+ if (object_circle_select(&vc, sel_op, mval, float(radius))) {
DEG_id_tag_update(&vc.scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene);
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index 6d643ae7180..422ab85279b 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -1293,7 +1293,7 @@ static bool nearest_world_tree(SnapObjectContext *UNUSED(sctx),
*r_dist_sq = dist_sq;
/* scale to make `snap_face_nearest_steps` steps */
- float step_scale_factor = 1.0f / max_ff(1.0f, (float)params->face_nearest_steps);
+ float step_scale_factor = 1.0f / max_ff(1.0f, float(params->face_nearest_steps));
mul_v3_fl(delta_local, step_scale_factor);
float co_local[3];
diff --git a/source/blender/editors/uvedit/uvedit_islands.cc b/source/blender/editors/uvedit/uvedit_islands.cc
index 42415be656a..793b72b67de 100644
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@ -539,7 +539,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene,
/* Logic matches behavior from #param_pack,
* use area so multiply the margin by the area to give
* predictable results not dependent on UV scale. */
- margin = (margin * (float)area) * 0.1f;
+ margin = (margin * float(area)) * 0.1f;
for (int i = 0; i < island_list_len; i++) {
struct FaceIsland *island = island_array[i];
BoxPack *box = &boxarray[i];