me-main #1

Merged
Nate Rupsis merged 123 commits from me-main into main 2023-02-13 18:39:11 +01:00
33 changed files with 65 additions and 65 deletions
Showing only changes of commit ce44953933 - Show all commits

View File

@ -341,7 +341,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id)
hid_map_button_mask_ = int(~(UINT_MAX << hid_map_button_num_)); hid_map_button_mask_ = int(~(UINT_MAX << hid_map_button_num_));
} }
CLOG_INFO(LOG, 2, "%d buttons -> hex:%X", hid_map_button_num_, (uint)hid_map_button_mask_); CLOG_INFO(LOG, 2, "%d buttons -> hex:%X", hid_map_button_num_, uint(hid_map_button_mask_));
return device_type_ != NDOF_UnknownDevice; return device_type_ != NDOF_UnknownDevice;
} }
@ -445,14 +445,14 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
2, 2,
"button=%d, press=%d (out of range %d, ignoring!)", "button=%d, press=%d (out of range %d, ignoring!)",
button_number, button_number,
(int)press, int(press),
hid_map_button_num_); hid_map_button_num_);
return; return;
} }
const NDOF_ButtonT button = hid_map_[button_number]; const NDOF_ButtonT button = hid_map_[button_number];
if (button == NDOF_BUTTON_NONE) { if (button == NDOF_BUTTON_NONE) {
CLOG_INFO( CLOG_INFO(
LOG, 2, "button=%d, press=%d (mapped to none, ignoring!)", button_number, (int)press); LOG, 2, "button=%d, press=%d (mapped to none, ignoring!)", button_number, int(press));
return; return;
} }
@ -460,7 +460,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
2, 2,
"button=%d, press=%d, name=%s", "button=%d, press=%d, name=%s",
button_number, button_number,
(int)press, int(press),
ndof_button_names[button]); ndof_button_names[button]);
GHOST_IWindow *window = system_.getWindowManager()->getActiveWindow(); GHOST_IWindow *window = system_.getWindowManager()->getActiveWindow();

View File

@ -350,7 +350,7 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
BKE_mesh_calc_normals_split(subdiv_mesh); BKE_mesh_calc_normals_split(subdiv_mesh);
} }
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) { if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv); BKE_subdiv_free(subdiv);
} }

View File

@ -222,9 +222,9 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float
j1 = j1 % oc->_N; j1 = j1 % oc->_N;
# define BILERP(m) \ # define BILERP(m) \
(interpf(interpf(m[i1 * oc->_N + j1], m[i0 * oc->_N + j1], frac_x), \ interpf(interpf(m[i1 * oc->_N + j1], m[i0 * oc->_N + j1], frac_x), \
interpf(m[i1 * oc->_N + j0], m[i0 * oc->_N + j0], frac_x), \ interpf(m[i1 * oc->_N + j0], m[i0 * oc->_N + j0], frac_x), \
frac_z)) frac_z)
{ {
if (oc->_do_disp_y) { if (oc->_do_disp_y) {

View File

@ -738,7 +738,7 @@ struct EdgeQueueContext {
/* Only tagged edges are in the queue. */ /* Only tagged edges are in the queue. */
#ifdef USE_EDGEQUEUE_TAG #ifdef USE_EDGEQUEUE_TAG
# define EDGE_QUEUE_TEST(e) (BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)) # define EDGE_QUEUE_TEST(e) BM_elem_flag_test((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
# define EDGE_QUEUE_ENABLE(e) \ # define EDGE_QUEUE_ENABLE(e) \
BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG) BM_elem_flag_enable((CHECK_TYPE_INLINE(e, BMEdge *), e), BM_ELEM_TAG)
# define EDGE_QUEUE_DISABLE(e) \ # define EDGE_QUEUE_DISABLE(e) \

View File

@ -49,7 +49,7 @@ static int primitive_get_other_uv_vertex(const MeshData &mesh_data,
mesh_loops[looptri.tri[2]].v)); mesh_loops[looptri.tri[2]].v));
for (const int loop : looptri.tri) { for (const int loop : looptri.tri) {
const int vert = mesh_loops[loop].v; const int vert = mesh_loops[loop].v;
if (vert != v1 && vert != v2) { if (!ELEM(vert, v1, v2)) {
return vert; return vert;
} }
} }

View File

@ -3133,10 +3133,10 @@ static void ptcache_dt_to_str(char *str, double dtime)
if (dtime > 60.0) { if (dtime > 60.0) {
if (dtime > 3600.0) { if (dtime > 3600.0) {
BLI_sprintf( BLI_sprintf(
str, "%ih %im %is", (int)(dtime / 3600), ((int)(dtime / 60)) % 60, ((int)dtime) % 60); str, "%ih %im %is", (int)(dtime / 3600), (int)(dtime / 60) % 60, ((int)dtime) % 60);
} }
else { else {
BLI_sprintf(str, "%im %is", ((int)(dtime / 60)) % 60, ((int)dtime) % 60); BLI_sprintf(str, "%im %is", (int)(dtime / 60) % 60, ((int)dtime) % 60);
} }
} }
else { else {

View File

@ -1363,7 +1363,7 @@ static void ccgdm_create_grids(DerivedMesh *dm)
gridFlagMats = static_cast<DMFlagMat *>( gridFlagMats = static_cast<DMFlagMat *>(
MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats")); MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats"));
ccgdm->gridHidden = static_cast<unsigned int **>( ccgdm->gridHidden = static_cast<uint **>(
MEM_callocN(sizeof(*ccgdm->gridHidden) * numGrids, "ccgdm.gridHidden")); MEM_callocN(sizeof(*ccgdm->gridHidden) * numGrids, "ccgdm.gridHidden"));
for (gIndex = 0, index = 0; index < numFaces; index++) { for (gIndex = 0, index = 0; index < numFaces; index++) {

View File

@ -527,7 +527,7 @@ static const AVCodec *get_av1_encoder(
if (context->ffmpeg_crf >= 0) { if (context->ffmpeg_crf >= 0) {
/* librav1e does not use `-crf`, but uses `-qp` in the range of 0-255. /* librav1e does not use `-crf`, but uses `-qp` in the range of 0-255.
* Calculates the roughly equivalent float, and truncates it to an integer. */ * Calculates the roughly equivalent float, and truncates it to an integer. */
unsigned int qp_value = ((float)context->ffmpeg_crf) * 255.0F / 51.0F; uint qp_value = ((float)context->ffmpeg_crf) * 255.0f / 51.0f;
if (qp_value > 255) { if (qp_value > 255) {
qp_value = 255; qp_value = 255;
} }

View File

@ -82,7 +82,7 @@ typedef struct BLI_memiter {
BLI_INLINE uint data_offset_from_size(uint size) BLI_INLINE uint data_offset_from_size(uint size)
{ {
return (PADUP(size, (uint)sizeof(data_t))) / (uint)sizeof(data_t); return PADUP(size, (uint)sizeof(data_t)) / (uint)sizeof(data_t);
} }
static void memiter_set_rewind_offset(BLI_memiter *mi) static void memiter_set_rewind_offset(BLI_memiter *mi)

View File

@ -257,7 +257,7 @@ void shuffle_m4(float R[4][4], const int index[4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]) void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
{ {
if (R == A || R == B) { if (ELEM(R, A, B)) {
float T[4][4]; float T[4][4];
mul_m4_m4m4(T, A, B); mul_m4_m4m4(T, A, B);
copy_m4_m4(R, T); copy_m4_m4(R, T);
@ -359,7 +359,7 @@ void mul_m3_m3_post(float R[3][3], const float B[3][3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]) void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
{ {
if (R == A || R == B) { if (ELEM(R, A, B)) {
float T[3][3]; float T[3][3];
mul_m3_m3m3(T, A, B); mul_m3_m3m3(T, A, B);
copy_m3_m3(R, T); copy_m3_m3(R, T);

View File

@ -1235,7 +1235,7 @@ void BM_face_splits_check_legal(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int l
} }
#define EDGE_SHARE_VERT(e1, e2) \ #define EDGE_SHARE_VERT(e1, e2) \
((ELEM((e1)[0], (e2)[0], (e2)[1])) || (ELEM((e1)[1], (e2)[0], (e2)[1]))) (ELEM((e1)[0], (e2)[0], (e2)[1]) || ELEM((e1)[1], (e2)[0], (e2)[1]))
/* do line crossing tests */ /* do line crossing tests */
for (i = 0, i_prev = f->len - 1; i < f->len; i_prev = i++) { for (i = 0, i_prev = f->len - 1; i < f->len; i_prev = i++) {

View File

@ -1062,7 +1062,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
matched = 1; matched = 1;
for (j = 0; j < pat->len; j++) { for (j = 0; j < pat->len; j++) {
a = (j + i) % pat->len; a = (j + i) % pat->len;
if ((!!BMO_edge_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) { if (!!BMO_edge_flag_test(bm, edges[a], SUBD_SPLIT) != (!!pat->seledges[j])) {
matched = 0; matched = 0;
break; break;
} }
@ -1095,7 +1095,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
matched = 1; matched = 1;
for (b = 0; b < pat->len; b++) { for (b = 0; b < pat->len; b++) {
j = (b + a) % pat->len; j = (b + a) % pat->len;
if ((!!BMO_edge_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) { if (!!BMO_edge_flag_test(bm, edges[j], SUBD_SPLIT) != (!!pat->seledges[b])) {
matched = 0; matched = 0;
break; break;
} }

View File

@ -2265,7 +2265,7 @@ static void snap_to_superellipsoid(float co[3], const float super_r, bool midlin
co[2] = z; co[2] = z;
} }
#define BEV_EXTEND_EDGE_DATA_CHECK(eh, flag) (BM_elem_flag_test(eh->e, flag)) #define BEV_EXTEND_EDGE_DATA_CHECK(eh, flag) BM_elem_flag_test(eh->e, flag)
static void check_edge_data_seam_sharp_edges(BevVert *bv, int flag, bool neg) static void check_edge_data_seam_sharp_edges(BevVert *bv, int flag, bool neg)
{ {

View File

@ -1044,7 +1044,7 @@ void ShadowModule::debug_end_sync()
debug_draw_ps_.state_set(state); debug_draw_ps_.state_set(state);
debug_draw_ps_.shader_set(inst_.shaders.static_shader_get(SHADOW_DEBUG)); debug_draw_ps_.shader_set(inst_.shaders.static_shader_get(SHADOW_DEBUG));
debug_draw_ps_.push_constant("debug_mode", (int)inst_.debug_mode); debug_draw_ps_.push_constant("debug_mode", int(inst_.debug_mode));
debug_draw_ps_.push_constant("debug_tilemap_index", light.tilemap_index); debug_draw_ps_.push_constant("debug_tilemap_index", light.tilemap_index);
debug_draw_ps_.bind_ssbo("tilemaps_buf", &tilemap_pool.tilemaps_data); debug_draw_ps_.bind_ssbo("tilemaps_buf", &tilemap_pool.tilemaps_data);
debug_draw_ps_.bind_ssbo("tiles_buf", &tilemap_pool.tiles_data); debug_draw_ps_.bind_ssbo("tiles_buf", &tilemap_pool.tiles_data);

View File

@ -1184,7 +1184,7 @@ static void drw_engines_enable_from_engine(const RenderEngineType *engine_type,
case OB_WIRE: case OB_WIRE:
case OB_SOLID: case OB_SOLID:
if (U.experimental.enable_workbench_next && if (U.experimental.enable_workbench_next &&
strcmp(engine_type->idname, "BLENDER_WORKBENCH_NEXT") == 0) { STREQ(engine_type->idname, "BLENDER_WORKBENCH_NEXT")) {
use_drw_engine(DRW_engine_viewport_workbench_next_type.draw_engine); use_drw_engine(DRW_engine_viewport_workbench_next_type.draw_engine);
break; break;
} }

View File

@ -735,7 +735,7 @@ static void gpencil_create_extensions_radius(tGPDfill *tgpf)
float tan2[3]; float tan2[3];
float d1; float d1;
float d2; float d2;
float total_length = 0.f; float total_length = 0.0f;
for (int i = 1; i < gps->totpoints; i++) { for (int i = 1; i < gps->totpoints; i++) {
if (i > 1) { if (i > 1) {
copy_v3_v3(tan1, tan2); copy_v3_v3(tan1, tan2);
@ -751,7 +751,7 @@ static void gpencil_create_extensions_radius(tGPDfill *tgpf)
sub_v3_v3v3(curvature, tan2, tan1); sub_v3_v3v3(curvature, tan2, tan1);
float k = normalize_v3(curvature); float k = normalize_v3(curvature);
k /= min_ff(d1, d2); k /= min_ff(d1, d2);
float radius = 1.f / k; float radius = 1.0f / k;
/* /*
* The smaller the radius of curvature, the sharper the corner. * The smaller the radius of curvature, the sharper the corner.
* The thicker the line, the larger the radius of curvature it * The thicker the line, the larger the radius of curvature it

View File

@ -263,7 +263,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
/* pixel radius */ /* pixel radius */
{ {
const int old_size = (!is_gpencil) ? BKE_brush_size_get(scene, brush) : brush->size; const int old_size = (!is_gpencil) ? BKE_brush_size_get(scene, brush) : brush->size;
int size = (int)(scalar * old_size); int size = int(scalar * old_size);
if (abs(old_size - size) < U.pixelsize) { if (abs(old_size - size) < U.pixelsize) {
if (scalar > 1) { if (scalar > 1) {
@ -461,11 +461,11 @@ static int palette_extract_img_exec(bContext *C, wmOperator *op)
if (ibuf && ibuf->rect) { if (ibuf && ibuf->rect) {
/* Extract all colors. */ /* Extract all colors. */
const int range = (int)pow(10.0f, threshold); const int range = int(pow(10.0f, threshold));
for (int row = 0; row < ibuf->y; row++) { for (int row = 0; row < ibuf->y; row++) {
for (int col = 0; col < ibuf->x; col++) { for (int col = 0; col < ibuf->x; col++) {
float color[4]; float color[4];
IMB_sampleImageAtLocation(ibuf, (float)col, (float)row, false, color); IMB_sampleImageAtLocation(ibuf, float(col), float(row), false, color);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
color[i] = truncf(color[i] * range) / range; color[i] = truncf(color[i] * range) / range;
} }
@ -1129,10 +1129,10 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
angle = atan2f(mdiff[1], mdiff[0]); angle = atan2f(mdiff[1], mdiff[0]);
angle = scd->init_rot + angle - scd->init_angle; angle = scd->init_rot + angle - scd->init_angle;
if (angle < 0.0f) { if (angle < 0.0f) {
angle += (float)(2 * M_PI); angle += float(2 * M_PI);
} }
if (angle > (float)(2 * M_PI)) { if (angle > float(2 * M_PI)) {
angle -= (float)(2 * M_PI); angle -= float(2 * M_PI);
} }
*scd->rot_target = angle; *scd->rot_target = angle;
break; break;

View File

@ -175,7 +175,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniform1i("colors_len", 2); /* "advanced" mode */ immUniform1i("colors_len", 2); /* "advanced" mode */
const float alpha = (float)paint->paint_cursor_col[3] / 255.0f; const float alpha = float(paint->paint_cursor_col[3]) / 255.0f;
immUniform4f("color", 0.0f, 0.0f, 0.0f, alpha); immUniform4f("color", 0.0f, 0.0f, 0.0f, alpha);
immUniform4f("color2", 1.0f, 1.0f, 1.0f, alpha); immUniform4f("color2", 1.0f, 1.0f, 1.0f, alpha);
immUniform1f("dash_width", 6.0f); immUniform1f("dash_width", 6.0f);
@ -394,7 +394,7 @@ static bool paint_brush_update(bContext *C,
ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy); ups->anchored_size = ups->pixel_radius = sqrtf(dx * dx + dy * dy);
ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + (float)M_PI; ups->brush_rotation = ups->brush_rotation_sec = atan2f(dx, dy) + float(M_PI);
if (brush->flag & BRUSH_EDGE_TO_EDGE) { if (brush->flag & BRUSH_EDGE_TO_EDGE) {
halfway[0] = dx * 0.5f + stroke->initial_mouse[0]; halfway[0] = dx * 0.5f + stroke->initial_mouse[0];
@ -454,8 +454,8 @@ static bool paint_brush_update(bContext *C,
if ((do_random || do_random_mask) && stroke->rng == nullptr) { if ((do_random || do_random_mask) && stroke->rng == nullptr) {
/* Lazy initialization. */ /* Lazy initialization. */
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); uint rng_seed = uint(PIL_check_seconds_timer_i() & UINT_MAX);
rng_seed ^= (uint)POINTER_AS_INT(brush); rng_seed ^= uint(POINTER_AS_INT(brush));
stroke->rng = BLI_rng_new(rng_seed); stroke->rng = BLI_rng_new(rng_seed);
} }
@ -608,7 +608,7 @@ static void paint_brush_stroke_add_step(
bool add_step = true; bool add_step = true;
if (paint_stroke_use_dash(brush)) { if (paint_stroke_use_dash(brush)) {
int dash_samples = stroke->tot_samples % brush->dash_samples; int dash_samples = stroke->tot_samples % brush->dash_samples;
float dash = (float)dash_samples / (float)brush->dash_samples; float dash = float(dash_samples) / float(brush->dash_samples);
if (dash > brush->dash_ratio) { if (dash > brush->dash_ratio) {
add_step = false; add_step = false;
} }
@ -938,7 +938,7 @@ PaintStroke *paint_stroke_new(bContext *C,
* ups->average_stroke_counter to 1. * ups->average_stroke_counter to 1.
*/ */
if (ups->average_stroke_counter) { if (ups->average_stroke_counter) {
mul_v3_fl(ups->average_stroke_accum, 1.0f / (float)ups->average_stroke_counter); mul_v3_fl(ups->average_stroke_accum, 1.0f / float(ups->average_stroke_counter));
ups->average_stroke_counter = 1; ups->average_stroke_counter = 1;
} }
@ -1402,17 +1402,17 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2])
len = len_v2(line); len = len_v2(line);
/* divide angle by PI/4 */ /* divide angle by PI/4 */
angle = 4.0f * angle / (float)M_PI; angle = 4.0f * angle / float(M_PI);
/* now take residue */ /* now take residue */
res = angle - floorf(angle); res = angle - floorf(angle);
/* residue decides how close we are at a certain angle */ /* residue decides how close we are at a certain angle */
if (res <= 0.5f) { if (res <= 0.5f) {
angle = floorf(angle) * (float)M_PI_4; angle = floorf(angle) * float(M_PI_4);
} }
else { else {
angle = (floorf(angle) + 1.0f) * (float)M_PI_4; angle = (floorf(angle) + 1.0f) * float(M_PI_4);
} }
mouse[0] = stroke->constrained_pos[0] = len * cosf(angle) + stroke->last_mouse_position[0]; mouse[0] = stroke->constrained_pos[0] = len * cosf(angle) + stroke->last_mouse_position[0];

View File

@ -495,7 +495,7 @@ static void dyntopo_detail_size_parallel_lines_draw(uint pos3d,
rotate_v2_v2fl(line_disp, spacing_disp, DEG2RAD(angle)); rotate_v2_v2fl(line_disp, spacing_disp, DEG2RAD(angle));
mul_v3_fl(spacing_disp, total_len / tot_lines_fl); mul_v3_fl(spacing_disp, total_len / tot_lines_fl);
immBegin(GPU_PRIM_LINES, (uint)tot_lines * 2); immBegin(GPU_PRIM_LINES, uint(tot_lines) * 2);
for (int i = 0; i < tot_lines; i++) { for (int i = 0; i < tot_lines; i++) {
float line_length; float line_length;
if (flip) { if (flip) {

View File

@ -500,7 +500,7 @@ static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr),
void *UNUSED(user_data)) void *UNUSED(user_data))
{ {
const char *prop_id = RNA_property_identifier(prop); const char *prop_id = RNA_property_identifier(prop);
return !(STR_ELEM(prop_id, "filepath", "directory", "filename")); return !STR_ELEM(prop_id, "filepath", "directory", "filename");
} }
static void sound_mixdown_draw(bContext *C, wmOperator *op) static void sound_mixdown_draw(bContext *C, wmOperator *op)

View File

@ -40,7 +40,7 @@ GraphISO::GraphISO(int n)
* Better still is to use a different algorithm. See for example: * Better still is to use a different algorithm. See for example:
* https://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.190/Mitarbeiter/toran/beatcs09.pdf * https://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.190/Mitarbeiter/toran/beatcs09.pdf
*/ */
adjmat[i] = static_cast<unsigned char *>(MEM_callocN(n * sizeof *adjmat[i], __func__)); adjmat[i] = static_cast<uchar *>(MEM_callocN(n * sizeof *adjmat[i], __func__));
} }
degree = nullptr; degree = nullptr;
} }
@ -69,7 +69,7 @@ void GraphISO::calculate_degrees() const
if (degree) { if (degree) {
return; return;
} }
degree = static_cast<unsigned int *>(MEM_mallocN(n * sizeof *degree, __func__)); degree = static_cast<uint *>(MEM_mallocN(n * sizeof *degree, __func__));
for (int v = 0; v < n; v++) { for (int v = 0; v < n; v++) {
int row_count = 0; int row_count = 0;
for (int w = 0; w < n; w++) { for (int w = 0; w < n; w++) {

View File

@ -1343,8 +1343,8 @@ void uvedit_deselect_flush(const Scene *scene, BMEditMesh *em)
continue; continue;
} }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if ((!BM_ELEM_CD_GET_BOOL(l, offsets.select_vert)) || if (!BM_ELEM_CD_GET_BOOL(l, offsets.select_vert) ||
(!BM_ELEM_CD_GET_BOOL(l->next, offsets.select_vert))) { !BM_ELEM_CD_GET_BOOL(l->next, offsets.select_vert)) {
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false); BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false);
} }
} }
@ -2283,14 +2283,14 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em)
continue; continue;
} }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) { if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) {
/* Use UV edge selection to find vertices and edges that must be selected. */ /* Use UV edge selection to find vertices and edges that must be selected. */
bool es = BM_ELEM_CD_GET_BOOL(l, offsets.select_edge); bool es = BM_ELEM_CD_GET_BOOL(l, offsets.select_edge);
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, !es); BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, !es);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false); BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false);
} }
/* Use UV vertex selection to find vertices and edges that must be selected. */ /* Use UV vertex selection to find vertices and edges that must be selected. */
else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) { else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) {
bool vs = BM_ELEM_CD_GET_BOOL(l, offsets.select_vert); bool vs = BM_ELEM_CD_GET_BOOL(l, offsets.select_vert);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, !vs); BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, !vs);
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false); BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false);
@ -4564,7 +4564,7 @@ static float get_uv_vert_needle(const eUVSelectSimilar type,
} }
} break; } break;
case UV_SSIM_PIN: case UV_SSIM_PIN:
return (BM_ELEM_CD_GET_BOOL(loop, offsets.pin)) ? 1.0f : 0.0f; return BM_ELEM_CD_GET_BOOL(loop, offsets.pin) ? 1.0f : 0.0f;
default: default:
BLI_assert_unreachable(); BLI_assert_unreachable();
return false; return false;

View File

@ -2769,7 +2769,7 @@ static void uv_map_mirror(BMFace *efa,
pole_count++; pole_count++;
} }
} }
if (pole_count == 0 || pole_count == efa->len) { if (ELEM(pole_count, 0, efa->len)) {
return; return;
} }
for (int i = 0; i < efa->len; i++) { for (int i = 0; i < efa->len; i++) {

View File

@ -120,7 +120,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/,
// Now allocate the cell table and fill it with default (empty) cells // Now allocate the cell table and fill it with default (empty) cells
_cells.resize(_cellsX * _cellsY); _cells.resize(_cellsX * _cellsY);
for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) { for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
(*i) = NULL; (*i) = nullptr;
} }
// Identify cells that will be used, and set the dimensions for each // Identify cells that will be used, and set the dimensions for each
@ -182,7 +182,7 @@ void BoxGrid::reorganizeCells()
{ {
// Sort the occluders by shallowest point // Sort the occluders by shallowest point
for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) { for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
if (*i != NULL) { if (*i != nullptr) {
(*i)->indexPolygons(); (*i)->indexPolygons();
} }
} }

View File

@ -175,7 +175,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
// Either we have run out of FEdges, or we already have the one edge we need to determine // Either we have run out of FEdges, or we already have the one edge we need to determine
// visibility Cull all remaining edges. // visibility Cull all remaining edges.
while (!ELEM(fe, NULL, festart)) { while (!ELEM(fe, nullptr, festart)) {
fe->setIsInImage(false); fe->setIsInImage(false);
fe = fe->nextEdge(); fe = fe->nextEdge();
} }
@ -237,7 +237,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe
expandGridSpaceOccluderProscenium(fe); expandGridSpaceOccluderProscenium(fe);
} }
fe = fe->nextEdge(); fe = fe->nextEdge();
} while (!ELEM(fe, NULL, festart)); } while (!ELEM(fe, nullptr, festart));
} }
} }

View File

@ -117,7 +117,7 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/,
// Now allocate the cell table and fill it with default (empty) cells // Now allocate the cell table and fill it with default (empty) cells
_cells.resize(_cellsX * _cellsY); _cells.resize(_cellsX * _cellsY);
for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) { for (cellContainer::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
(*i) = NULL; (*i) = nullptr;
} }
// Identify cells that will be used, and set the dimensions for each // Identify cells that will be used, and set the dimensions for each
@ -178,7 +178,7 @@ void SphericalGrid::reorganizeCells()
{ {
// Sort the occluders by shallowest point // Sort the occluders by shallowest point
for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) { for (vector<Cell *>::iterator i = _cells.begin(), end = _cells.end(); i != end; ++i) {
if (*i != NULL) { if (*i != nullptr) {
(*i)->indexPolygons(); (*i)->indexPolygons();
} }
} }

View File

@ -822,7 +822,7 @@ void ViewEdge::UpdateFEdges()
do { do {
currentEdge->setViewEdge(this); currentEdge->setViewEdge(this);
currentEdge = currentEdge->nextEdge(); currentEdge = currentEdge->nextEdge();
} while (!ELEM(currentEdge, NULL, _FEdgeB)); } while (!ELEM(currentEdge, nullptr, _FEdgeB));
// last one // last one
_FEdgeB->setViewEdge(this); _FEdgeB->setViewEdge(this);
} }

View File

@ -983,7 +983,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
wFace = nullptr; wFace = nullptr;
} }
else { else {
qi = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, NULL); qi = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, nullptr);
} }
// Store test results // Store test results

View File

@ -388,7 +388,7 @@ static void custom_range_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetPropSep(layout, true); uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, uiLayoutSetActive(layout,
(!ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN)) && !ELEM(mode, GP_TIME_MODE_FIX, GP_TIME_MODE_CHAIN) &&
RNA_boolean_get(ptr, "use_custom_frame_range")); RNA_boolean_get(ptr, "use_custom_frame_range"));
col = uiLayoutColumn(layout, true); col = uiLayoutColumn(layout, true);

View File

@ -84,7 +84,7 @@ AviError AVI_set_compress_option(
case AVI_OPTION_QUALITY: case AVI_OPTION_QUALITY:
for (i = 0; i < movie->header->Streams; i++) { for (i = 0; i < movie->header->Streams; i++) {
if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) { if (avi_get_format_type(movie->streams[i].format) == FCC("vids")) {
movie->streams[i].sh.Quality = (*((int *)opt_data)) * 100; movie->streams[i].sh.Quality = *((int *)opt_data) * 100;
BLI_fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET); BLI_fseek(movie->fp, movie->offset_table[1 + i * 2 + 1], SEEK_SET);
awrite(movie, awrite(movie,
movie->streams[i].sf, movie->streams[i].sf,
@ -97,7 +97,7 @@ AviError AVI_set_compress_option(
break; break;
case AVI_OPTION_FRAMERATE: case AVI_OPTION_FRAMERATE:
useconds = (int)(1000000 / (*((double *)opt_data))); useconds = (int)(1000000 / *((double *)opt_data));
if (useconds) { if (useconds) {
movie->header->MicroSecPerFrame = useconds; movie->header->MicroSecPerFrame = useconds;
} }

View File

@ -286,7 +286,7 @@ void MeshFromGeometry::create_uv_verts(Mesh *mesh)
added_uv = true; added_uv = true;
} }
else { else {
uv_map.span[tot_loop_idx] = {0.f, 0.f}; uv_map.span[tot_loop_idx] = {0.0f, 0.0f};
} }
tot_loop_idx++; tot_loop_idx++;
} }

View File

@ -285,7 +285,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
CustomData_set_layer_flag(&result->ldata, CD_NORMAL, CD_FLAG_TEMPORARY); CustomData_set_layer_flag(&result->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
} }
// BKE_subdiv_stats_print(&subdiv->stats); // BKE_subdiv_stats_print(&subdiv->stats);
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) { if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv); BKE_subdiv_free(subdiv);
} }
return result; return result;
@ -317,7 +317,7 @@ static void deformMatrices(ModifierData *md,
return; return;
} }
BKE_subdiv_deform_coarse_vertices(subdiv, mesh, vertex_cos, verts_num); BKE_subdiv_deform_coarse_vertices(subdiv, mesh, vertex_cos, verts_num);
if (subdiv != runtime_data->subdiv_cpu && subdiv != runtime_data->subdiv_gpu) { if (!ELEM(subdiv, runtime_data->subdiv_cpu, runtime_data->subdiv_gpu)) {
BKE_subdiv_free(subdiv); BKE_subdiv_free(subdiv);
} }
} }

View File

@ -504,7 +504,7 @@ static const char *wm_context_member_from_ptr(const bContext *C,
} }
case ID_MA: { case ID_MA: {
# define ID_CAST_OBMATACT(id_pt) \ # define ID_CAST_OBMATACT(id_pt) \
(BKE_object_material_get(((Object *)id_pt), ((Object *)id_pt)->actcol)) BKE_object_material_get(((Object *)id_pt), ((Object *)id_pt)->actcol)
CTX_TEST_PTR_ID_CAST( CTX_TEST_PTR_ID_CAST(
C, "object", "object.active_material", ID_CAST_OBMATACT, ptr->owner_id); C, "object", "object.active_material", ID_CAST_OBMATACT, ptr->owner_id);
break; break;