Cleanup: use nullptr and function style casts for numbers

This commit is contained in:
Campbell Barton 2023-05-31 17:33:20 +10:00
parent 623a40b9d0
commit c8ed927eac
6 changed files with 184 additions and 183 deletions

@ -253,7 +253,7 @@ static void image_panel_uv(const bContext *C, Panel *panel)
uiBlock *block;
block = uiLayoutAbsoluteBlock(panel->layout);
UI_block_func_handle_set(block, do_uvedit_vertex, NULL);
UI_block_func_handle_set(block, do_uvedit_vertex, nullptr);
uvedit_vertex_buttons(C, block);
}

@ -87,7 +87,7 @@ static int UNUSED_FUNCTION(ED_operator_uvmap_mesh)(bContext *C)
if (ob && ob->type == OB_MESH) {
Mesh *me = static_cast<Mesh *>(ob->data);
if (CustomData_get_layer(&me->ldata, CD_PROP_FLOAT2) != NULL) {
if (CustomData_get_layer(&me->ldata, CD_PROP_FLOAT2) != nullptr) {
return 1;
}
}
@ -115,8 +115,8 @@ bool ED_object_get_active_image(Object *ob,
{
Material *ma = DEG_is_evaluated_object(ob) ? BKE_object_material_get_eval(ob, mat_nr) :
BKE_object_material_get(ob, mat_nr);
bNodeTree *ntree = (ma && ma->use_nodes) ? ma->nodetree : NULL;
bNode *node = (ntree) ? nodeGetActiveTexture(ntree) : NULL;
bNodeTree *ntree = (ma && ma->use_nodes) ? ma->nodetree : nullptr;
bNode *node = (ntree) ? nodeGetActiveTexture(ntree) : nullptr;
if (node && is_image_texture_node(node)) {
if (r_ima) {
@ -130,7 +130,7 @@ bool ED_object_get_active_image(Object *ob,
*r_iuser = &((NodeTexEnvironment *)node->storage)->iuser;
}
else {
*r_iuser = NULL;
*r_iuser = nullptr;
}
}
if (r_node) {
@ -143,10 +143,10 @@ bool ED_object_get_active_image(Object *ob,
}
if (r_ima) {
*r_ima = NULL;
*r_ima = nullptr;
}
if (r_iuser) {
*r_iuser = NULL;
*r_iuser = nullptr;
}
if (r_node) {
*r_node = node;
@ -161,11 +161,11 @@ bool ED_object_get_active_image(Object *ob,
void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *ima)
{
Material *ma = BKE_object_material_get(ob, mat_nr);
bNode *node = (ma && ma->use_nodes) ? nodeGetActiveTexture(ma->nodetree) : NULL;
bNode *node = (ma && ma->use_nodes) ? nodeGetActiveTexture(ma->nodetree) : nullptr;
if (node && is_image_texture_node(node)) {
node->id = &ima->id;
ED_node_tree_propagate_change(NULL, bmain, ma->nodetree);
ED_node_tree_propagate_change(nullptr, bmain, ma->nodetree);
}
}
@ -278,7 +278,7 @@ static bool ED_uvedit_median_multi(const Scene *scene,
}
}
mul_v2_fl(co, 1.0f / (float)sel);
mul_v2_fl(co, 1.0f / float(sel));
return (sel != 0);
}
@ -316,10 +316,10 @@ bool ED_uvedit_center_from_pivot_ex(SpaceImage *sima,
case V3D_AROUND_CURSOR: {
copy_v2_v2(r_center, sima->cursor);
changed = true;
if (r_has_select != NULL) {
if (r_has_select != nullptr) {
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
*r_has_select = uvedit_select_is_any_selected_multi(scene, objects, objects_len);
MEM_freeN(objects);
}
@ -328,10 +328,10 @@ bool ED_uvedit_center_from_pivot_ex(SpaceImage *sima,
default: {
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
changed = ED_uvedit_center_multi(scene, objects, objects_len, r_center, mode);
MEM_freeN(objects);
if (r_has_select != NULL) {
if (r_has_select != nullptr) {
*r_has_select = changed;
}
break;
@ -343,7 +343,7 @@ bool ED_uvedit_center_from_pivot_ex(SpaceImage *sima,
bool ED_uvedit_center_from_pivot(
SpaceImage *sima, Scene *scene, ViewLayer *view_layer, float r_center[2], char mode)
{
return ED_uvedit_center_from_pivot_ex(sima, scene, view_layer, r_center, mode, NULL);
return ED_uvedit_center_from_pivot_ex(sima, scene, view_layer, r_center, mode, nullptr);
}
/** \} */
@ -538,7 +538,7 @@ static bool uvedit_uv_straighten(Scene *scene, BMesh *bm, eUVWeldAlign tool)
}
UvElementMap *element_map = BM_uv_element_map_create(bm, scene, true, false, true, true);
if (element_map == NULL) {
if (element_map == nullptr) {
return false;
}
@ -567,7 +567,7 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
if (tool == UV_ALIGN_AUTO) {
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@ -661,7 +661,7 @@ static void UV_OT_align(wmOperatorType *ot)
"Automatically choose the axis on which there is most alignment already"},
{UV_ALIGN_X, "ALIGN_X", 0, "Align X", "Align UVs on X axis"},
{UV_ALIGN_Y, "ALIGN_Y", 0, "Align Y", "Align UVs on Y axis"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* identifiers */
@ -697,7 +697,7 @@ static int uv_remove_doubles_to_selected(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
bool *changed = static_cast<bool *>(MEM_callocN(sizeof(bool) * objects_len, __func__));
@ -785,7 +785,7 @@ static int uv_remove_doubles_to_selected(bContext *C, wmOperator *op)
continue;
}
mul_v2_fl(mloopuv_arr[i], 1.0f / (float)uv_duplicate_count[i]);
mul_v2_fl(mloopuv_arr[i], 1.0f / float(uv_duplicate_count[i]));
}
MEM_freeN(uv_duplicate_count);
@ -837,7 +837,7 @@ static int uv_remove_doubles_to_unselected(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
/* Calculate max possible number of kdtree nodes. */
int uv_maxlen = 0;
@ -1043,7 +1043,7 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
changed = uv_snap_cursor_to_selection(scene, objects, objects_len, sima);
MEM_freeN(objects);
break;
@ -1069,7 +1069,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
{0, "PIXELS", 0, "Pixels", ""},
{1, "SELECTED", 0, "Selected", ""},
{2, "ORIGIN", 0, "Origin", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* identifiers */
@ -1193,7 +1193,7 @@ static bool uv_snap_uvs_to_adjacent_unselected(Scene *scene, Object *obedit)
if (uv_tot) {
luv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
mul_v2_v2fl(luv, uv, 1.0f / (float)uv_tot);
mul_v2_v2fl(luv, uv, 1.0f / float(uv_tot));
changed = true;
}
}
@ -1218,8 +1218,8 @@ static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit
const BMUVOffsets offsets = BM_uv_map_get_offsets(em->bm);
ED_space_image_get_size(sima, &width, &height);
w = (float)width;
h = (float)height;
w = float(width);
h = float(height);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!uvedit_face_visible_test(scene, efa)) {
@ -1251,7 +1251,7 @@ static int uv_snap_selection_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
if (target == 2) {
float center[2];
@ -1306,7 +1306,7 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
{1, "CURSOR", 0, "Cursor", ""},
{2, "CURSOR_OFFSET", 0, "Cursor (Offset)", ""},
{3, "ADJACENT_UNSELECTED", 0, "Adjacent Unselected", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* identifiers */
@ -1343,7 +1343,7 @@ static int uv_pin_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
@ -1438,7 +1438,7 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
@ -1608,7 +1608,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
@ -1761,7 +1761,7 @@ static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op)
WM_msg_publish_rna_prop(mbus, &screen->id, sima, SpaceImageEditor, cursor_location);
}
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, nullptr);
/* Use pass-through to allow click-drag to transform the cursor. */
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
@ -1802,7 +1802,7 @@ static void UV_OT_cursor_set(wmOperatorType *ot)
RNA_def_float_vector(ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
@ -1827,7 +1827,7 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *ob = objects[ob_index];
@ -1932,7 +1932,7 @@ static int uv_mark_seam_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
bool changed = false;

@ -180,7 +180,7 @@ static int mouse_mesh_uv_shortest_path_vert(Scene *scene,
params.aspect_y = aspect_y;
params.cd_loop_uv_offset = offsets.uv;
LinkNode *path = NULL;
LinkNode *path = nullptr;
bool is_path_ordered = false;
if (l_src != l_dst) {
@ -224,7 +224,7 @@ static int mouse_mesh_uv_shortest_path_vert(Scene *scene,
}
} while ((void)depth++, (node = node->next));
BLI_linklist_free(path, NULL);
BLI_linklist_free(path, nullptr);
flush = all_set ? -1 : 1;
}
else {
@ -299,7 +299,7 @@ static int mouse_mesh_uv_shortest_path_edge(Scene *scene,
params.aspect_y = aspect_y;
params.cd_loop_uv_offset = offsets.uv;
LinkNode *path = NULL;
LinkNode *path = nullptr;
bool is_path_ordered = false;
if (l_src != l_dst) {
@ -343,7 +343,7 @@ static int mouse_mesh_uv_shortest_path_edge(Scene *scene,
}
} while ((void)depth++, (node = node->next));
BLI_linklist_free(path, NULL);
BLI_linklist_free(path, nullptr);
flush = all_set ? -1 : 1;
}
else {
@ -414,7 +414,7 @@ static int mouse_mesh_uv_shortest_path_face(Scene *scene,
params.aspect_y = aspect_y;
params.cd_loop_uv_offset = offsets.uv;
LinkNode *path = NULL;
LinkNode *path = nullptr;
bool is_path_ordered = false;
if (f_src != f_dst) {
@ -458,7 +458,7 @@ static int mouse_mesh_uv_shortest_path_face(Scene *scene,
}
} while ((void)depth++, (node = node->next));
BLI_linklist_free(path, NULL);
BLI_linklist_free(path, nullptr);
flush = all_set ? -1 : 1;
}
else {
@ -495,7 +495,7 @@ static bool uv_shortest_path_pick_ex(Scene *scene,
bool ok = false;
int flush = 0;
if (ELEM(NULL, ele_src, ele_dst) || (ele_src->head.htype != ele_dst->head.htype)) {
if (ELEM(nullptr, ele_src, ele_dst) || (ele_src->head.htype != ele_dst->head.htype)) {
/* pass */
}
else if (ele_src->head.htype == BM_FACE) {
@ -563,7 +563,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, NULL, &objects_len);
scene, view_layer, nullptr, &objects_len);
float co[2];
@ -571,7 +571,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
BMElem *ele_src = NULL, *ele_dst = NULL;
BMElem *ele_src = nullptr, *ele_dst = nullptr;
/* Detect the hit. */
UvNearestHit hit = uv_nearest_hit_init_max(&region->v2d);
@ -610,20 +610,20 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
}
else if (uv_selectmode & UV_SELECT_EDGE) {
/* Edge selection. */
BMLoop *l_src = NULL;
BMLoop *l_src = nullptr;
if (ts->uv_flag & UV_SYNC_SELECTION) {
BMEdge *e_src = BM_mesh_active_edge_get(bm);
if (e_src != NULL) {
if (e_src != nullptr) {
l_src = uv_find_nearest_loop_from_edge(scene, obedit, e_src, co);
}
}
else {
l_src = ED_uvedit_active_edge_loop_get(bm);
if (l_src != NULL) {
if (l_src != nullptr) {
if (!uvedit_uv_select_test(scene, l_src, offsets) &&
!uvedit_uv_select_test(scene, l_src->next, offsets))
{
l_src = NULL;
l_src = nullptr;
}
ele_src = (BMElem *)l_src;
}
@ -633,18 +633,18 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
}
else {
/* Vertex selection. */
BMLoop *l_src = NULL;
BMLoop *l_src = nullptr;
if (ts->uv_flag & UV_SYNC_SELECTION) {
BMVert *v_src = BM_mesh_active_vert_get(bm);
if (v_src != NULL) {
if (v_src != nullptr) {
l_src = uv_find_nearest_loop_from_vert(scene, obedit, v_src, co);
}
}
else {
l_src = ED_uvedit_active_vert_loop_get(bm);
if (l_src != NULL) {
if (l_src != nullptr) {
if (!uvedit_uv_select_test(scene, l_src, offsets)) {
l_src = NULL;
l_src = nullptr;
}
}
}
@ -700,7 +700,7 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
}
Object *obedit = ED_object_in_mode_from_index(scene, view_layer, OB_MODE_EDIT, object_index);
if (obedit == NULL) {
if (obedit == nullptr) {
return OPERATOR_CANCELLED;
}
@ -804,7 +804,7 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, NULL, &objects_len);
scene, view_layer, nullptr, &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
BMEditMesh *em = BKE_editmesh_from_object(obedit);
@ -812,11 +812,11 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
const BMUVOffsets offsets = BM_uv_map_get_offsets(bm);
BMElem *ele_src = NULL, *ele_dst = NULL;
BMElem *ele_src = nullptr, *ele_dst = nullptr;
/* Find 2x elements. */
{
BMElem **ele_array = NULL;
BMElem **ele_array = nullptr;
int ele_array_len = 0;
if (uv_selectmode & UV_SELECT_FACE) {
ele_array = (BMElem **)ED_uvedit_selected_faces(scene, bm, 3, &ele_array_len);

@ -100,7 +100,7 @@ BLI_INLINE ULData *UL(BMLoop *l)
static BMLoop *bm_loop_find_other_radial_loop_with_visible_face(BMLoop *l_src,
const int cd_loop_uv_offset)
{
BMLoop *l_other = NULL;
BMLoop *l_other = nullptr;
BMLoop *l_iter = l_src->radial_next;
if (l_iter != l_src) {
do {
@ -108,12 +108,12 @@ static BMLoop *bm_loop_find_other_radial_loop_with_visible_face(BMLoop *l_src,
BM_loop_uv_share_edge_check(l_src, l_iter, cd_loop_uv_offset))
{
/* Check UVs are contiguous. */
if (l_other == NULL) {
if (l_other == nullptr) {
l_other = l_iter;
}
else {
/* Only use when there is a single alternative. */
l_other = NULL;
l_other = nullptr;
break;
}
}
@ -127,7 +127,7 @@ static BMLoop *bm_loop_find_other_fan_loop_with_visible_face(BMLoop *l_src,
const int cd_loop_uv_offset)
{
BLI_assert(BM_vert_in_edge(l_src->e, v_src));
BMLoop *l_other = NULL;
BMLoop *l_other = nullptr;
BMLoop *l_iter = l_src->radial_next;
if (l_iter != l_src) {
do {
@ -135,18 +135,18 @@ static BMLoop *bm_loop_find_other_fan_loop_with_visible_face(BMLoop *l_src,
BM_loop_uv_share_edge_check(l_src, l_iter, cd_loop_uv_offset))
{
/* Check UVs are contiguous. */
if (l_other == NULL) {
if (l_other == nullptr) {
l_other = l_iter;
}
else {
/* Only use when there is a single alternative. */
l_other = NULL;
l_other = nullptr;
break;
}
}
} while ((l_iter = l_iter->radial_next) != l_src);
}
if (l_other != NULL) {
if (l_other != nullptr) {
if (l_other->v == v_src) {
/* do nothing. */
}
@ -178,7 +178,7 @@ static BMLoop *bm_vert_step_fan_loop_uv(BMLoop *l, BMEdge **e_step, const int cd
}
else {
BLI_assert_unreachable();
return NULL;
return nullptr;
}
*e_step = l_next->e;
@ -309,8 +309,8 @@ static UVRipSingle *uv_rip_single_from_loop(BMLoop *l_init_orig,
/* Track the closest loop, start walking from this so in the event we have multiple
* disconnected fans, we can rip away loops connected to this one. */
BMLoop *l_init = NULL;
BMLoop *l_init_edge = NULL;
BMLoop *l_init = nullptr;
BMLoop *l_init_edge = nullptr;
float corner_angle_best = FLT_MAX;
float edge_angle_best = FLT_MAX;
int edge_index_best = 0; /* -1 or +1 (never center). */
@ -373,7 +373,7 @@ static UVRipSingle *uv_rip_single_from_loop(BMLoop *l_init_orig,
BMEdge *e_prev = i ? l_init->e : l_init->prev->e;
BMLoop *l_iter = l_init;
while (((l_iter = bm_vert_step_fan_loop_uv(l_iter, &e_prev, cd_loop_uv_offset)) != l_init) &&
(l_iter != NULL) && (UL(l_iter)->side == 0))
(l_iter != nullptr) && (UL(l_iter)->side == 0))
{
uv_fan_count_contiguous += 1;
/* Keep. */
@ -421,7 +421,7 @@ static UVRipSingle *uv_rip_single_from_loop(BMLoop *l_init_orig,
static void uv_rip_single_free(UVRipSingle *rip)
{
BLI_gset_free(rip->loops, NULL);
BLI_gset_free(rip->loops, nullptr);
MEM_freeN(rip);
}
@ -451,7 +451,7 @@ static void uv_rip_pairs_remove(UVRipPairs *rip, BMLoop *l)
BLI_assert(BLI_gset_haskey(rip->loops, l));
BLI_assert(ul->in_rip_pairs == true);
ul->in_rip_pairs = false;
BLI_gset_remove(rip->loops, l, NULL);
BLI_gset_remove(rip->loops, l, nullptr);
}
/**
@ -599,7 +599,7 @@ static UVRipPairs *uv_rip_pairs_from_loop(BMLoop *l_init,
if (UL(l_step)->is_select_edge) {
BMLoop *l_other = bm_loop_find_other_radial_loop_with_visible_face(l_step,
cd_loop_uv_offset);
if (l_other != NULL) {
if (l_other != nullptr) {
if (!UL(l_other)->in_rip_pairs && !UL(l_other)->in_stack) {
BLI_SMALLSTACK_PUSH(stack, l_other);
UL(l_other)->in_stack = true;
@ -675,7 +675,7 @@ static UVRipPairs *uv_rip_pairs_from_loop(BMLoop *l_init,
static void uv_rip_pairs_free(UVRipPairs *rip)
{
BLI_gset_free(rip->loops, NULL);
BLI_gset_free(rip->loops, nullptr);
MEM_freeN(rip);
}
@ -914,7 +914,7 @@ static int uv_rip_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
@ -967,7 +967,7 @@ void UV_OT_rip(wmOperatorType *ot)
ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",

@ -120,7 +120,7 @@ BMLoop *ED_uvedit_active_vert_loop_get(BMesh *bm)
return BM_face_vert_share_loop((BMFace *)ese_prev->ele, (BMVert *)ese->ele);
}
}
return NULL;
return nullptr;
}
void ED_uvedit_active_edge_loop_set(BMesh *bm, BMLoop *l)
@ -142,7 +142,7 @@ BMLoop *ED_uvedit_active_edge_loop_get(BMesh *bm)
return BM_face_edge_share_loop((BMFace *)ese_prev->ele, (BMEdge *)ese->ele);
}
}
return NULL;
return nullptr;
}
/** \} */
@ -738,7 +738,7 @@ static BMLoop *uvedit_loop_find_other_radial_loop_with_visible_face(const Scene
const BMUVOffsets offsets)
{
BLI_assert(offsets.uv >= 0);
BMLoop *l_other = NULL;
BMLoop *l_other = nullptr;
BMLoop *l_iter = l_src->radial_next;
if (l_iter != l_src) {
do {
@ -746,12 +746,12 @@ static BMLoop *uvedit_loop_find_other_radial_loop_with_visible_face(const Scene
BM_loop_uv_share_edge_check(l_src, l_iter, offsets.uv))
{
/* Check UVs are contiguous. */
if (l_other == NULL) {
if (l_other == nullptr) {
l_other = l_iter;
}
else {
/* Only use when there is a single alternative. */
l_other = NULL;
l_other = nullptr;
break;
}
}
@ -769,7 +769,7 @@ static BMLoop *uvedit_loop_find_other_boundary_loop_with_visible_face(const Scen
BMLoop *l_step = l_edge;
l_step = (l_step->v == v_pivot) ? l_step->prev : l_step->next;
BMLoop *l_step_last = NULL;
BMLoop *l_step_last = nullptr;
do {
BLI_assert(BM_vert_in_edge(l_step->e, v_pivot));
l_step_last = l_step;
@ -777,9 +777,9 @@ static BMLoop *uvedit_loop_find_other_boundary_loop_with_visible_face(const Scen
if (l_step) {
l_step = (l_step->v == v_pivot) ? l_step->prev : l_step->next;
}
} while (l_step != NULL);
} while (l_step != nullptr);
if (l_step_last != NULL) {
if (l_step_last != nullptr) {
BLI_assert(uvedit_loop_find_other_radial_loop_with_visible_face(scene, l_step_last, offsets) ==
NULL);
}
@ -1048,7 +1048,7 @@ static bool uvedit_nearest_uv(const Scene *scene,
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMIter iter;
BMFace *efa;
const float *uv_best = NULL;
const float *uv_best = nullptr;
float dist_best = *dist_sq;
const BMUVOffsets offsets = BM_uv_map_get_offsets(em->bm);
BLI_assert(offsets.uv >= 0);
@ -1074,7 +1074,7 @@ static bool uvedit_nearest_uv(const Scene *scene,
} while ((l_iter = l_iter->next) != l_first);
}
if (uv_best != NULL) {
if (uv_best != nullptr) {
copy_v2_v2(r_uv, uv_best);
*dist_sq = dist_best;
return true;
@ -1128,7 +1128,7 @@ BMLoop *uv_find_nearest_loop_from_vert(Scene *scene, Object *obedit, BMVert *v,
BMIter liter;
BMLoop *l;
BMLoop *l_found = NULL;
BMLoop *l_found = nullptr;
float dist_best_sq = FLT_MAX;
BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
@ -1153,7 +1153,7 @@ BMLoop *uv_find_nearest_loop_from_edge(Scene *scene, Object *obedit, BMEdge *e,
BMIter eiter;
BMLoop *l;
BMLoop *l_found = NULL;
BMLoop *l_found = nullptr;
float dist_best_sq = FLT_MAX;
BM_ITER_ELEM (l, &eiter, e, BM_LOOPS_OF_EDGE) {
@ -1384,7 +1384,7 @@ static BMLoop *bm_select_edgeloop_double_side_next(const Scene *scene,
return (l_step_over->v == v_from_next) ? l_step_over->prev : l_step_over->next;
}
}
return NULL;
return nullptr;
}
static BMLoop *bm_select_edgeloop_single_side_next(const Scene *scene,
@ -1427,7 +1427,7 @@ static void uv_select_edgeloop_double_side_tag(const Scene *scene,
/* Disable since we start from the same edge. */
BM_elem_flag_disable(l_step_pair[0], BM_ELEM_TAG);
BM_elem_flag_disable(l_step_pair[1], BM_ELEM_TAG);
while ((l_step_pair[0] != NULL) && (l_step_pair[1] != NULL)) {
while ((l_step_pair[0] != nullptr) && (l_step_pair[1] != nullptr)) {
if (!uvedit_face_visible_test(scene, l_step_pair[0]->f) ||
!uvedit_face_visible_test(scene, l_step_pair[1]->f) ||
/* Check loops have not diverged. */
@ -1483,16 +1483,17 @@ static void uv_select_edgeloop_single_side_tag(const Scene *scene,
BMVert *v_from = side ? l_step->e->v1 : l_step->e->v2;
/* Disable since we start from the same edge. */
BM_elem_flag_disable(l_step, BM_ELEM_TAG);
while (l_step != NULL) {
while (l_step != nullptr) {
if (!uvedit_face_visible_test(scene, l_step->f) ||
/* Check the boundary is still a boundary. */
(uvedit_loop_find_other_radial_loop_with_visible_face(scene, l_step, offsets) != NULL))
(uvedit_loop_find_other_radial_loop_with_visible_face(scene, l_step, offsets) !=
nullptr))
{
break;
}
if (r_count_by_select != NULL) {
if (r_count_by_select != nullptr) {
r_count_by_select[uvedit_edge_select_test(scene, l_step, offsets)] += 1;
/* Early exit when mixed could be optional if needed. */
if (r_count_by_select[0] && r_count_by_select[1]) {
@ -1550,7 +1551,7 @@ static int uv_select_edgeloop(Scene *scene, Object *obedit, UvNearestHit *hit, c
/* Tag all loops that are part of the edge loop (select after).
* This is done so we can */
if (l_init_pair[1] == NULL) {
if (l_init_pair[1] == nullptr) {
int count_by_select[2];
/* If the loops selected toggle the boundaries. */
uv_select_edgeloop_single_side_tag(
@ -1567,8 +1568,8 @@ static int uv_select_edgeloop(Scene *scene, Object *obedit, UvNearestHit *hit, c
}
}
if (l_init_pair[1] == NULL) {
uv_select_edgeloop_single_side_tag(scene, em, l_init_pair[0], offsets, boundary_mode, NULL);
if (l_init_pair[1] == nullptr) {
uv_select_edgeloop_single_side_tag(scene, em, l_init_pair[0], offsets, boundary_mode, nullptr);
}
else {
uv_select_edgeloop_double_side_tag(scene, em, l_init_pair, offsets);
@ -1653,7 +1654,7 @@ static int uv_select_faceloop(Scene *scene, Object *obedit, UvNearestHit *hit, c
scene, l_step_opposite, offsets);
}
else {
l_step = NULL;
l_step = nullptr;
}
/* Break iteration when `l_step`:
@ -1738,13 +1739,13 @@ static int uv_select_edgering(Scene *scene, Object *obedit, UvNearestHit *hit, c
BMLoop *l_step_opposite = l_step->next->next;
l_step = uvedit_loop_find_other_radial_loop_with_visible_face(
scene, l_step_opposite, offsets);
if (l_step == NULL) {
if (l_step == nullptr) {
/* Ensure we touch the opposite edge if we can't walk over it. */
l_step = l_step_opposite;
}
}
else {
l_step = NULL;
l_step = nullptr;
}
/* Break iteration when `l_step`:
@ -1815,14 +1816,14 @@ static void uv_select_linked_multi(Scene *scene,
* Better solve this by having a delimit option for select-linked operator,
* keeping island-select working as is. */
UvVertMap *vmap = BM_uv_vert_map_create(em->bm, !uv_sync_select);
if (vmap == NULL) {
if (vmap == nullptr) {
continue;
}
stack = static_cast<int *>(MEM_mallocN(sizeof(*stack) * (em->bm->totface + 1), "UvLinkStack"));
flag = static_cast<char *>(MEM_callocN(sizeof(*flag) * em->bm->totface, "UvLinkFlag"));
if (hit == NULL) {
if (hit == nullptr) {
/* Use existing selection */
BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
if (uvedit_face_visible_test(scene, efa)) {
@ -2016,7 +2017,7 @@ const float *uvedit_first_selected_uv_from_vertex(Scene *scene,
}
}
return NULL;
return nullptr;
}
/** \} */
@ -2037,7 +2038,7 @@ static int uv_select_more_less(bContext *C, const bool select)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
const bool is_uv_face_selectmode = (ts->uv_selectmode == UV_SELECT_FACE);
@ -2382,7 +2383,7 @@ static void uv_select_all_perform_multi(const Scene *scene,
const uint objects_len,
int action)
{
uv_select_all_perform_multi_ex(scene, objects, objects_len, action, NULL);
uv_select_all_perform_multi_ex(scene, objects, objects_len, action, nullptr);
}
static int uv_select_all_exec(bContext *C, wmOperator *op)
@ -2396,7 +2397,7 @@ static int uv_select_all_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
uv_select_all_perform_multi(scene, objects, objects_len, action);
@ -2539,7 +2540,7 @@ static bool uv_mouse_select_multi(bContext *C,
else {
/* Vertex or island. For island (if we were using #uv_find_nearest_face_multi_ex, see above),
* `hit.l` is NULL, use `hit.efa` instead. */
if (hit.l != NULL) {
if (hit.l != nullptr) {
is_selected = uvedit_uv_select_test(scene, hit.l, offsets);
}
else {
@ -2666,7 +2667,7 @@ static bool uv_mouse_select(bContext *C, const float co[2], const SelectPick_Par
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
bool changed = uv_mouse_select_multi(C, objects, objects_len, co, params);
MEM_freeN(objects);
return changed;
@ -2725,7 +2726,7 @@ void UV_OT_select(wmOperatorType *ot)
ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
@ -2819,7 +2820,7 @@ static int uv_mouse_select_loop_generic(bContext *C,
ViewLayer *view_layer = CTX_data_view_layer(C);
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
int ret = uv_mouse_select_loop_generic_multi(C, objects, objects_len, co, extend, loop_type);
MEM_freeN(objects);
return ret;
@ -2879,7 +2880,7 @@ void UV_OT_select_loop(wmOperatorType *ot)
ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
@ -2941,7 +2942,7 @@ void UV_OT_select_edge_ring(wmOperatorType *ot)
ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
@ -2976,7 +2977,7 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
if (pick) {
float co[2];
@ -3002,7 +3003,7 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent
}
uv_select_linked_multi(
scene, objects, objects_len, pick ? &hit : NULL, extend, deselect, false, select_faces);
scene, objects, objects_len, pick ? &hit : nullptr, extend, deselect, false, select_faces);
/* weak!, but works */
Object **objects_free = objects;
@ -3024,7 +3025,7 @@ static int uv_select_linked_internal(bContext *C, wmOperator *op, const wmEvent
static int uv_select_linked_exec(bContext *C, wmOperator *op)
{
return uv_select_linked_internal(C, op, NULL, false);
return uv_select_linked_internal(C, op, nullptr, false);
}
void UV_OT_select_linked(wmOperatorType *ot)
@ -3055,7 +3056,7 @@ static int uv_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEve
static int uv_select_linked_pick_exec(bContext *C, wmOperator *op)
{
return uv_select_linked_internal(C, op, NULL, true);
return uv_select_linked_internal(C, op, nullptr, true);
}
void UV_OT_select_linked_pick(wmOperatorType *ot)
@ -3091,7 +3092,7 @@ void UV_OT_select_linked_pick(wmOperatorType *ot)
ot->srna,
"location",
2,
NULL,
nullptr,
-FLT_MAX,
FLT_MAX,
"Location",
@ -3133,7 +3134,7 @@ static int uv_select_split_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
@ -3184,7 +3185,7 @@ static int uv_select_split_exec(bContext *C, wmOperator *op)
if (changed) {
changed_multi = true;
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, nullptr);
uv_select_tag_update_for_object(depsgraph, ts, obedit);
}
}
@ -3242,7 +3243,7 @@ static void uv_select_flush_from_tag_sticky_loc_internal(const Scene *scene,
const bool select,
const BMUVOffsets offsets)
{
UvMapVert *start_vlist = NULL, *vlist_iter;
UvMapVert *start_vlist = nullptr, *vlist_iter;
BMFace *efa_vlist;
uvedit_uv_select_set(scene, em->bm, l, select, false, offsets);
@ -3316,7 +3317,7 @@ static void uv_select_flush_from_tag_face(const Scene *scene, Object *obedit, co
BM_mesh_elem_table_ensure(em->bm, BM_FACE);
UvVertMap *vmap = BM_uv_vert_map_create(em->bm, false);
if (vmap == NULL) {
if (vmap == nullptr) {
return;
}
@ -3405,7 +3406,7 @@ static void uv_select_flush_from_tag_loop(const Scene *scene, Object *obedit, co
BM_mesh_elem_table_ensure(em->bm, BM_FACE);
UvVertMap *vmap = BM_uv_vert_map_create(em->bm, false);
if (vmap == NULL) {
if (vmap == nullptr) {
return;
}
@ -3461,7 +3462,7 @@ static void uv_select_flush_from_loop_edge_flag(const Scene *scene, BMEditMesh *
BM_mesh_elem_table_ensure(em->bm, BM_FACE);
UvVertMap *vmap = BM_uv_vert_map_create(em->bm, false);
if (vmap == NULL) {
if (vmap == nullptr) {
return;
}
BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, efa_index) {
@ -3540,7 +3541,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
if (use_pre_deselect) {
uv_select_all_perform_multi(scene, objects, objects_len, SEL_DESELECT);
@ -3789,7 +3790,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
const eSelectOp sel_op = ED_select_op_modal(
eSelectOp(RNA_enum_get(op->ptr, "mode")),
@ -3998,7 +3999,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
if (use_pre_deselect) {
uv_select_all_perform_multi(scene, objects, objects_len, SEL_DESELECT);
@ -4196,7 +4197,7 @@ static int uv_select_pinned_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
@ -4335,7 +4336,7 @@ static int uv_select_overlap(bContext *C, const bool extend)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
/* Calculate maximum number of tree nodes and prepare initial selection. */
uint uv_tri_len = 0;
@ -4441,22 +4442,22 @@ static int uv_select_overlap(bContext *C, const bool extend)
}
BLI_memarena_clear(arena);
BLI_heap_clear(heap, NULL);
BLI_heap_clear(heap, nullptr);
}
}
BLI_assert(data_index == uv_tri_len);
BLI_memarena_free(arena);
BLI_heap_free(heap, NULL);
BLI_heap_free(heap, nullptr);
MEM_freeN(uv_verts);
MEM_freeN(indices);
BLI_bvhtree_balance(uv_tree);
uint tree_overlap_len;
BVHTreeOverlap *overlap = BLI_bvhtree_overlap_self(uv_tree, &tree_overlap_len, NULL, NULL);
BVHTreeOverlap *overlap = BLI_bvhtree_overlap_self(uv_tree, &tree_overlap_len, nullptr, nullptr);
if (overlap != NULL) {
if (overlap != nullptr) {
GSet *overlap_set = BLI_gset_new_ex(overlap_hash, overlap_cmp, __func__, tree_overlap_len);
for (int i = 0; i < tree_overlap_len; i++) {
@ -4502,7 +4503,7 @@ static int uv_select_overlap(bContext *C, const bool extend)
}
}
BLI_gset_free(overlap_set, NULL);
BLI_gset_free(overlap_set, nullptr);
MEM_freeN(overlap);
}
@ -4724,7 +4725,7 @@ static int uv_select_similar_vert_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
int max_verts_selected_all = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@ -4774,7 +4775,7 @@ static int uv_select_similar_vert_exec(bContext *C, wmOperator *op)
}
}
if (tree_1d != NULL) {
if (tree_1d != nullptr) {
BLI_kdtree_1d_deduplicate(tree_1d);
BLI_kdtree_1d_balance(tree_1d);
}
@ -4836,7 +4837,7 @@ static int uv_select_similar_edge_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
int max_edges_selected_all = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@ -4889,7 +4890,7 @@ static int uv_select_similar_edge_exec(bContext *C, wmOperator *op)
}
}
if (tree_1d != NULL) {
if (tree_1d != nullptr) {
BLI_kdtree_1d_deduplicate(tree_1d);
BLI_kdtree_1d_balance(tree_1d);
}
@ -4951,7 +4952,7 @@ static int uv_select_similar_face_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
int max_faces_selected_all = 0;
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
@ -4992,7 +4993,7 @@ static int uv_select_similar_face_exec(bContext *C, wmOperator *op)
}
}
if (tree_1d != NULL) {
if (tree_1d != nullptr) {
BLI_kdtree_1d_deduplicate(tree_1d);
BLI_kdtree_1d_balance(tree_1d);
}
@ -5056,7 +5057,7 @@ static int uv_select_similar_island_exec(bContext *C, wmOperator *op)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
ListBase *island_list_ptr = static_cast<ListBase *>(
MEM_callocN(sizeof(*island_list_ptr) * objects_len, __func__));
@ -5107,7 +5108,7 @@ static int uv_select_similar_island_exec(bContext *C, wmOperator *op)
}
}
if (tree_1d != NULL) {
if (tree_1d != nullptr) {
BLI_kdtree_1d_deduplicate(tree_1d);
BLI_kdtree_1d_balance(tree_1d);
}
@ -5434,7 +5435,7 @@ static void uv_isolate_selected_islands(const Scene *scene,
BMFace *efa;
BMIter iter, liter;
UvElementMap *elementmap = BM_uv_element_map_create(em->bm, scene, false, false, true, true);
if (elementmap == NULL) {
if (elementmap == nullptr) {
return;
}
BLI_assert(offsets.select_vert >= 0);
@ -5560,7 +5561,7 @@ void ED_uvedit_selectmode_clean_multi(bContext *C)
uint objects_len = 0;
Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
scene, view_layer, ((View3D *)NULL), &objects_len);
scene, view_layer, ((View3D *)nullptr), &objects_len);
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
@ -5589,7 +5590,7 @@ static int uv_select_mode_exec(bContext *C, wmOperator *op)
ED_uvedit_selectmode_clean_multi(C);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE | ID_RECALC_SELECT);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, nullptr);
return OPERATOR_FINISHED;
}

@ -233,17 +233,17 @@ static StitchPreviewer *stitch_preview_init(void)
stitch_preview = static_cast<StitchPreviewer *>(
MEM_mallocN(sizeof(StitchPreviewer), "stitch_previewer"));
stitch_preview->preview_polys = NULL;
stitch_preview->preview_stitchable = NULL;
stitch_preview->preview_unstitchable = NULL;
stitch_preview->uvs_per_polygon = NULL;
stitch_preview->preview_polys = nullptr;
stitch_preview->preview_stitchable = nullptr;
stitch_preview->preview_unstitchable = nullptr;
stitch_preview->uvs_per_polygon = nullptr;
stitch_preview->preview_uvs = 0;
stitch_preview->num_polys = 0;
stitch_preview->num_stitchable = 0;
stitch_preview->num_unstitchable = 0;
stitch_preview->static_tris = NULL;
stitch_preview->static_tris = nullptr;
stitch_preview->num_static_tris = 0;
@ -433,7 +433,7 @@ static void stitch_calculate_island_snapping(const int cd_loop_uv_offset,
}
island_stitch_data[i].medianPoint[1] /= state->aspect;
if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < (float)M_PI_2) ||
if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < float(M_PI_2)) ||
island_stitch_data[i].num_rot_elements == 0 ||
island_stitch_data[i].num_rot_elements_neg == 0)
{
@ -444,7 +444,7 @@ static void stitch_calculate_island_snapping(const int cd_loop_uv_offset,
}
else {
rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements +
(2.0f * (float)M_PI - island_stitch_data[i].rotation_neg) *
(2.0f * float(M_PI) - island_stitch_data[i].rotation_neg) *
island_stitch_data[i].num_rot_elements_neg) /
totelem;
}
@ -629,9 +629,9 @@ static void state_delete(StitchState *state)
MEM_freeN(state->edges);
}
stitch_preview_delete(state->stitch_preview);
state->stitch_preview = NULL;
state->stitch_preview = nullptr;
if (state->edge_hash) {
BLI_ghash_free(state->edge_hash, NULL, NULL);
BLI_ghash_free(state->edge_hash, nullptr, nullptr);
}
MEM_freeN(state);
}
@ -674,7 +674,7 @@ static void stitch_uv_edge_generate_linked_edges(GHash *edge_hash, StitchState *
edge->first = edge;
for (; iter1; iter1 = iter1->next) {
UvElement *iter2 = NULL;
UvElement *iter2 = nullptr;
/* check to see if other vertex of edge belongs to same vertex as */
if (BM_elem_index_get(iter1->l->next->v) == elemindex2) {
@ -945,26 +945,26 @@ static int stitch_process_data(StitchStateContainer *ssc,
{
int i;
StitchPreviewer *preview;
IslandStitchData *island_stitch_data = NULL;
IslandStitchData *island_stitch_data = nullptr;
int previous_island = ssc->static_island;
BMesh *bm = state->em->bm;
BMFace *efa;
BMIter iter;
UVVertAverage *final_position = NULL;
UVVertAverage *final_position = nullptr;
bool is_active_state = (state == ssc->states[ssc->active_object_index]);
const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_PROP_FLOAT2);
char stitch_midpoints = ssc->midpoints;
/* Used to map UV indices to UV-average indices for selection. */
uint *uvfinal_map = NULL;
uint *uvfinal_map = nullptr;
/* per face preview position in preview buffer */
PreviewPosition *preview_position = NULL;
PreviewPosition *preview_position = nullptr;
/* cleanup previous preview */
stitch_preview_delete(state->stitch_preview);
preview = state->stitch_preview = stitch_preview_init();
if (preview == NULL) {
if (preview == nullptr) {
return 0;
}
@ -1411,7 +1411,7 @@ static int stitch_process_data(StitchStateContainer *ssc,
if (edge->flag & STITCH_STITCHABLE) {
stitch_island_calculate_edge_rotation(
cd_loop_uv_offset, edge, ssc, state, final_position, NULL, island_stitch_data);
cd_loop_uv_offset, edge, ssc, state, final_position, nullptr, island_stitch_data);
island_stitch_data[state->uvs[edge->uv1]->island].use_edge_rotation = true;
}
}
@ -1658,7 +1658,7 @@ static void stitch_calculate_edge_normal(const int cd_loop_uv_offset,
*/
static void stitch_draw_vbo(GPUVertBuf *vbo, GPUPrimType prim_type, const float col[4])
{
GPUBatch *batch = GPU_batch_create_ex(prim_type, vbo, NULL, GPU_BATCH_OWNS_VBO);
GPUBatch *batch = GPU_batch_create_ex(prim_type, vbo, nullptr, GPU_BATCH_OWNS_VBO);
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_UNIFORM_COLOR);
GPU_batch_uniform_4fv(batch, "color", col);
GPU_batch_draw(batch);
@ -1800,7 +1800,7 @@ static UvEdge *uv_edge_get(BMLoop *l, StitchState *state)
UvElement *element2 = BM_uv_element_get(state->element_map, l->next);
if (!element1 || !element2) {
return NULL;
return nullptr;
}
int uv1 = state->map[element1 - state->element_map->storage];
@ -1858,7 +1858,7 @@ static StitchState *stitch_init(bContext *C,
if (!state->element_map) {
state_delete(state);
return NULL;
return nullptr;
}
state->aspect = ED_uvedit_get_aspect_y(obedit);
@ -1884,7 +1884,7 @@ static StitchState *stitch_init(bContext *C,
BLI_assert(!state->stitch_preview); /* Paranoia. */
if (!state->uvs || !map || !edge_hash || !all_edges) {
state_delete(state);
return NULL;
return nullptr;
}
/* Index for the UvElements. */
@ -1922,8 +1922,8 @@ static StitchState *stitch_init(bContext *C,
int offset1 = map[itmp1];
int offset2 = map[itmp2];
all_edges[counter].next = NULL;
all_edges[counter].first = NULL;
all_edges[counter].next = nullptr;
all_edges[counter].first = nullptr;
all_edges[counter].flag = 0;
all_edges[counter].element = element;
/* Using an order policy, sort UVs according to address space.
@ -1956,7 +1956,7 @@ static StitchState *stitch_init(bContext *C,
/* I assume any system will be able to at least allocate an iterator :p */
if (!edges) {
state_delete(state);
return NULL;
return nullptr;
}
state->total_separate_edges = total_edges;
@ -1970,7 +1970,7 @@ static StitchState *stitch_init(bContext *C,
/* cleanup temporary stuff */
MEM_freeN(all_edges);
BLI_ghash_free(edge_hash, NULL, NULL);
BLI_ghash_free(edge_hash, nullptr, nullptr);
/* Refill an edge hash to create edge connectivity data. */
state->edge_hash = edge_hash = BLI_ghash_new(uv_edge_hash, uv_edge_compare, "stitch_edge_hash");
@ -2005,7 +2005,7 @@ static StitchState *stitch_init(bContext *C,
state->selection_size = 0;
/* Load old selection if redoing operator with different settings */
if (state_init != NULL) {
if (state_init != nullptr) {
int faceIndex, elementIndex;
UvElement *element;
enum StitchModes stored_mode = StitchModes(RNA_enum_get(op->ptr, "stored_mode"));
@ -2025,7 +2025,7 @@ static StitchState *stitch_init(bContext *C,
efa = BM_face_at_index(em->bm, faceIndex);
element = BM_uv_element_get(
state->element_map,
static_cast<BMLoop *>(BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, elementIndex)));
static_cast<BMLoop *>(BM_iter_at_index(nullptr, BM_LOOPS_OF_FACE, efa, elementIndex)));
stitch_select_uv(element, state, 1);
}
}
@ -2042,13 +2042,13 @@ static StitchState *stitch_init(bContext *C,
efa = BM_face_at_index(em->bm, faceIndex);
element = BM_uv_element_get(
state->element_map,
static_cast<BMLoop *>(BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, elementIndex)));
static_cast<BMLoop *>(BM_iter_at_index(nullptr, BM_LOOPS_OF_FACE, efa, elementIndex)));
uv1 = map[element - state->element_map->storage];
element = BM_uv_element_get(
state->element_map,
static_cast<BMLoop *>(
BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, (elementIndex + 1) % efa->len)));
BM_iter_at_index(nullptr, BM_LOOPS_OF_FACE, efa, (elementIndex + 1) % efa->len)));
uv2 = map[element - state->element_map->storage];
if (uv1 < uv2) {
@ -2132,12 +2132,12 @@ static StitchState *stitch_init(bContext *C,
MEM_callocN(sizeof(bool) * state->element_map->total_islands, "stitch I stops"));
if (!state->island_is_stitchable) {
state_delete(state);
return NULL;
return nullptr;
}
if (!stitch_process_data(ssc, state, scene, false)) {
state_delete(state);
return NULL;
return nullptr;
}
return state;
@ -2242,9 +2242,9 @@ static int stitch_init_all(bContext *C, wmOperator *op)
MEM_callocN(sizeof(StitchState *) * objects_len, "StitchState"));
ssc->objects_len = 0;
int *objs_selection_count = NULL;
UvElementID *selected_uvs_arr = NULL;
StitchStateInit *state_init = NULL;
int *objs_selection_count = nullptr;
UvElementID *selected_uvs_arr = nullptr;
StitchStateInit *state_init = nullptr;
if (RNA_struct_property_is_set(op->ptr, "selection") &&
RNA_struct_property_is_set(op->ptr, "objects_selection_count"))
@ -2282,13 +2282,13 @@ static int stitch_init_all(bContext *C, wmOperator *op)
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
if (state_init != NULL) {
if (state_init != nullptr) {
state_init->uv_selected_count = objs_selection_count[ob_index];
}
StitchState *stitch_state_ob = stitch_init(C, op, ssc, obedit, state_init);
if (state_init != NULL) {
if (state_init != nullptr) {
/* Move pointer to beginning of next object's data. */
state_init->to_select += state_init->uv_selected_count;
}
@ -2386,7 +2386,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
RNA_int_set(op->ptr, "static_island", ssc->static_island);
int *objs_selection_count = NULL;
int *objs_selection_count = nullptr;
objs_selection_count = static_cast<int *>(
MEM_mallocN(sizeof(int *) * ssc->objects_len, "objects_selection_count"));
@ -2425,7 +2425,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
}
if (area) {
ED_workspace_status_text(C, NULL);
ED_workspace_status_text(C, nullptr);
}
ED_region_draw_cb_exit(CTX_wm_region(C)->type, ssc->draw_handle);
@ -2448,7 +2448,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
state_delete_all(ssc);
op->customdata = NULL;
op->customdata = nullptr;
}
static void stitch_cancel(bContext *C, wmOperator *op)
@ -2490,7 +2490,7 @@ static StitchState *stitch_select(bContext *C,
* the opposite stitchable vertex and the initial still gets deselected */
/* find StitchState from hit->ob */
StitchState *state = NULL;
StitchState *state = nullptr;
for (uint ob_index = 0; ob_index < ssc->objects_len; ob_index++) {
if (hit.ob == ssc->objects[ob_index]) {
state = ssc->states[ob_index];
@ -2509,7 +2509,7 @@ static StitchState *stitch_select(bContext *C,
}
else if (uv_find_nearest_edge_multi(scene, ssc->objects, ssc->objects_len, co, 0.0f, &hit)) {
/* find StitchState from hit->ob */
StitchState *state = NULL;
StitchState *state = nullptr;
for (uint ob_index = 0; ob_index < ssc->objects_len; ob_index++) {
if (hit.ob == ssc->objects[ob_index]) {
state = ssc->states[ob_index];
@ -2523,7 +2523,7 @@ static StitchState *stitch_select(bContext *C,
return state;
}
return NULL;
return nullptr;
}
static int stitch_modal(bContext *C, wmOperator *op, const wmEvent *event)
@ -2694,7 +2694,7 @@ void UV_OT_stitch(wmOperatorType *ot)
static const EnumPropertyItem stitch_modes[] = {
{STITCH_VERT, "VERTEX", 0, "Vertex", ""},
{STITCH_EDGE, "EDGE", 0, "Edge", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
/* identifiers */
@ -2774,7 +2774,7 @@ void UV_OT_stitch(wmOperatorType *ot)
prop = RNA_def_int_array(ot->srna,
"objects_selection_count",
1,
NULL,
nullptr,
0,
INT_MAX,
"Objects Selection Count",