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 <ideasman42@gmail.com>2019-04-22 02:19:45 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-22 12:48:16 +0300
commit620b960d3d8cfd90b9f0df6ba3671c33eccb8309 (patch)
tree64f69db4bf9d44f0a32d1c92b0714bf2dc98ff2d /source/blender/editors/uvedit/uvedit_ops.c
parentbba60bb564cf5a16cfcac744d4ba82cf8eba3da9 (diff)
Cleanup: style, use braces for editors
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_ops.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c261
1 files changed, 174 insertions, 87 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index ca527be7339..16a4b647cfe 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -114,11 +114,13 @@ bool ED_uvedit_test(Object *obedit)
BMEditMesh *em;
int ret;
- if (!obedit)
+ if (!obedit) {
return 0;
+ }
- if (obedit->type != OB_MESH)
+ if (obedit->type != OB_MESH) {
return 0;
+ }
em = BKE_editmesh_from_object(obedit);
ret = EDBM_uv_check(em);
@@ -142,8 +144,9 @@ static int UNUSED_FUNCTION(ED_operator_uvmap_mesh)(bContext *C)
if (ob && ob->type == OB_MESH) {
Mesh *me = ob->data;
- if (CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL)
+ if (CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL) {
return 1;
+ }
}
return 0;
@@ -172,8 +175,9 @@ bool ED_object_get_active_image(Object *ob,
bNode *node = (ntree) ? nodeGetActiveTexture(ntree) : NULL;
if (node && is_image_texture_node(node)) {
- if (r_ima)
+ if (r_ima) {
*r_ima = (Image *)node->id;
+ }
if (r_iuser) {
if (node->type == SH_NODE_TEX_IMAGE) {
*r_iuser = &((NodeTexImage *)node->storage)->iuser;
@@ -185,21 +189,27 @@ bool ED_object_get_active_image(Object *ob,
*r_iuser = NULL;
}
}
- if (r_node)
+ if (r_node) {
*r_node = node;
- if (r_ntree)
+ }
+ if (r_ntree) {
*r_ntree = ntree;
+ }
return true;
}
- if (r_ima)
+ if (r_ima) {
*r_ima = NULL;
- if (r_iuser)
+ }
+ if (r_iuser) {
*r_iuser = NULL;
- if (r_node)
+ }
+ if (r_node) {
*r_node = node;
- if (r_ntree)
+ }
+ if (r_ntree) {
*r_ntree = ntree;
+ }
return false;
}
@@ -263,10 +273,12 @@ static void uvedit_vertex_select_tagged(BMEditMesh *em,
bool uvedit_face_visible_nolocal_ex(const ToolSettings *ts, BMFace *efa)
{
- if (ts->uv_flag & UV_SYNC_SELECTION)
+ if (ts->uv_flag & UV_SYNC_SELECTION) {
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0);
- else
+ }
+ else {
return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0 && BM_elem_flag_test(efa, BM_ELEM_SELECT));
+ }
}
bool uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
{
@@ -301,8 +313,9 @@ bool uvedit_face_select_test_ex(const ToolSettings *ts, BMFace *efa, const int c
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- if (!(luv->flag & MLOOPUV_VERTSEL))
+ if (!(luv->flag & MLOOPUV_VERTSEL)) {
return false;
+ }
}
return true;
@@ -432,10 +445,12 @@ void uvedit_edge_select_enable(
ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
BM_face_select_set(em->bm, l->f, true);
- else if (ts->selectmode & SCE_SELECT_EDGE)
+ }
+ else if (ts->selectmode & SCE_SELECT_EDGE) {
BM_edge_select_set(em->bm, l->e, true);
+ }
else {
BM_vert_select_set(em->bm, l->e->v1, true);
BM_vert_select_set(em->bm, l->e->v2, true);
@@ -465,10 +480,12 @@ void uvedit_edge_select_disable(BMEditMesh *em,
ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
BM_face_select_set(em->bm, l->f, false);
- else if (ts->selectmode & SCE_SELECT_EDGE)
+ }
+ else if (ts->selectmode & SCE_SELECT_EDGE) {
BM_edge_select_set(em->bm, l->e, false);
+ }
else {
BM_vert_select_set(em->bm, l->e->v1, false);
BM_vert_select_set(em->bm, l->e->v2, false);
@@ -488,10 +505,12 @@ void uvedit_edge_select_disable(BMEditMesh *em,
bool uvedit_uv_select_test_ex(const ToolSettings *ts, BMLoop *l, const int cd_loop_uv_offset)
{
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
return BM_elem_flag_test_bool(l->f, BM_ELEM_SELECT);
- else
+ }
+ else {
return BM_elem_flag_test_bool(l->v, BM_ELEM_SELECT);
+ }
}
else {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -524,10 +543,12 @@ void uvedit_uv_select_enable(
ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
BM_face_select_set(em->bm, l->f, true);
- else
+ }
+ else {
BM_vert_select_set(em->bm, l->v, true);
+ }
if (do_history) {
BM_select_history_remove(em->bm, (BMElem *)l->v);
@@ -544,10 +565,12 @@ void uvedit_uv_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l, const int
ToolSettings *ts = scene->toolsettings;
if (ts->uv_flag & UV_SYNC_SELECTION) {
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
BM_face_select_set(em->bm, l->f, false);
- else
+ }
+ else {
BM_vert_select_set(em->bm, l->v, false);
+ }
}
else {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -623,8 +646,9 @@ bool ED_uvedit_minmax_multi(Scene *scene,
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -679,8 +703,9 @@ static bool ED_uvedit_median_multi(
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -1022,14 +1047,16 @@ static void uv_select_edgeloop_vertex_loop_flag(UvMapVert *first)
int count = 0;
for (iterv = first; iterv; iterv = iterv->next) {
- if (iterv->separate && iterv != first)
+ if (iterv->separate && iterv != first) {
break;
+ }
count++;
}
- if (count < 5)
+ if (count < 5) {
first->flag = 1;
+ }
}
static UvMapVert *uv_select_edgeloop_vertex_map_get(UvVertMap *vmap, BMFace *efa, BMLoop *l)
@@ -1038,10 +1065,12 @@ static UvMapVert *uv_select_edgeloop_vertex_map_get(UvVertMap *vmap, BMFace *efa
first = BM_uv_vert_map_at_index(vmap, BM_elem_index_get(l->v));
for (iterv = first; iterv; iterv = iterv->next) {
- if (iterv->separate)
+ if (iterv->separate) {
first = iterv;
- if (iterv->poly_index == BM_elem_index_get(efa))
+ }
+ if (iterv->poly_index == BM_elem_index_get(efa)) {
return first;
+ }
}
return NULL;
@@ -1058,18 +1087,21 @@ static bool uv_select_edgeloop_edge_tag_faces(BMEditMesh *em,
/* count number of faces this edge has */
for (iterv1 = first1; iterv1; iterv1 = iterv1->next) {
- if (iterv1->separate && iterv1 != first1)
+ if (iterv1->separate && iterv1 != first1) {
break;
+ }
for (iterv2 = first2; iterv2; iterv2 = iterv2->next) {
- if (iterv2->separate && iterv2 != first2)
+ if (iterv2->separate && iterv2 != first2) {
break;
+ }
if (iterv1->poly_index == iterv2->poly_index) {
/* if face already tagged, don't do this edge */
efa = BM_face_at_index(em->bm, iterv1->poly_index);
- if (BM_elem_flag_test(efa, BM_ELEM_TAG))
+ if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
return false;
+ }
tot++;
break;
@@ -1077,19 +1109,23 @@ static bool uv_select_edgeloop_edge_tag_faces(BMEditMesh *em,
}
}
- if (*totface == 0) /* start edge */
+ if (*totface == 0) { /* start edge */
*totface = tot;
- else if (tot != *totface) /* check for same number of faces as start edge */
+ }
+ else if (tot != *totface) { /* check for same number of faces as start edge */
return false;
+ }
/* tag the faces */
for (iterv1 = first1; iterv1; iterv1 = iterv1->next) {
- if (iterv1->separate && iterv1 != first1)
+ if (iterv1->separate && iterv1 != first1) {
break;
+ }
for (iterv2 = first2; iterv2; iterv2 = iterv2->next) {
- if (iterv2->separate && iterv2 != first2)
+ if (iterv2->separate && iterv2 != first2) {
break;
+ }
if (iterv1->poly_index == iterv2->poly_index) {
efa = BM_face_at_index(em->bm, iterv1->poly_index);
@@ -1156,10 +1192,12 @@ static int uv_select_edgeloop(Scene *scene,
uvedit_face_visible_test(scene, obedit, ima, efa)) {
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
/* check face not hidden and not tagged */
- if (!(iterv_curr = uv_select_edgeloop_vertex_map_get(vmap, efa, l)))
+ if (!(iterv_curr = uv_select_edgeloop_vertex_map_get(vmap, efa, l))) {
continue;
- if (!(iterv_next = uv_select_edgeloop_vertex_map_get(vmap, efa, l->next)))
+ }
+ if (!(iterv_next = uv_select_edgeloop_vertex_map_get(vmap, efa, l->next))) {
continue;
+ }
/* check if vertex is tagged and has right valence */
if (iterv_curr->flag || iterv_next->flag) {
@@ -1253,8 +1291,9 @@ static void uv_select_linked_multi(Scene *scene,
* keeping island-select working as is. */
vmap = BM_uv_vert_map_create(em->bm, limit, !select_faces, false);
- if (vmap == NULL)
+ if (vmap == NULL) {
return;
+ }
stack = MEM_mallocN(sizeof(*stack) * (em->bm->totface + 1), "UvLinkStack");
flag = MEM_callocN(sizeof(*flag) * em->bm->totface, "UvLinkFlag");
@@ -1312,15 +1351,18 @@ static void uv_select_linked_multi(Scene *scene,
startv = vlist;
for (iterv = vlist; iterv; iterv = iterv->next) {
- if (iterv->separate)
+ if (iterv->separate) {
startv = iterv;
- if (iterv->poly_index == a)
+ }
+ if (iterv->poly_index == a) {
break;
+ }
}
for (iterv = startv; iterv; iterv = iterv->next) {
- if ((startv != iterv) && (iterv->separate))
+ if ((startv != iterv) && (iterv->separate)) {
break;
+ }
else if (!flag[iterv->poly_index]) {
flag[iterv->poly_index] = 1;
stack[stacksize] = iterv->poly_index;
@@ -1407,8 +1449,9 @@ static float *uv_sel_co_from_eve(
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_ELEM (l, &liter, eve, BM_LOOPS_OF_VERT) {
- if (!uvedit_face_visible_test(scene, obedit, ima, l->f))
+ if (!uvedit_face_visible_test(scene, obedit, ima, l->f)) {
continue;
+ }
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -1620,8 +1663,9 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
BMLoop *l;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -1653,8 +1697,9 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
BMLoop *l;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -1672,8 +1717,9 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
BMLoop *l;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -1698,8 +1744,9 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
/* tag verts with a selected UV */
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
BM_ITER_ELEM (l, &liter, eve, BM_LOOPS_OF_VERT) {
- if (!uvedit_face_visible_test(scene, obedit, ima, l->f))
+ if (!uvedit_face_visible_test(scene, obedit, ima, l->f)) {
continue;
+ }
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
BM_elem_flag_enable(eve, BM_ELEM_TAG);
@@ -1775,23 +1822,28 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
eUVWeldAlign tool_local = tool;
if (tool_local == UV_STRAIGHTEN_X) {
- if (uv_start[1] == uv_end[1])
+ if (uv_start[1] == uv_end[1]) {
tool_local = UV_STRAIGHTEN;
- else
+ }
+ else {
a = (uv_end[0] - uv_start[0]) / (uv_end[1] - uv_start[1]);
+ }
}
else if (tool_local == UV_STRAIGHTEN_Y) {
- if (uv_start[0] == uv_end[0])
+ if (uv_start[0] == uv_end[0]) {
tool_local = UV_STRAIGHTEN;
- else
+ }
+ else {
a = (uv_end[1] - uv_start[1]) / (uv_end[0] - uv_start[0]);
+ }
}
/* go over all verts except for endpoints */
for (i = 0; i < BLI_array_len(eve_line); i++) {
BM_ITER_ELEM (l, &liter, eve_line[i], BM_LOOPS_OF_VERT) {
- if (!uvedit_face_visible_test(scene, obedit, ima, l->f))
+ if (!uvedit_face_visible_test(scene, obedit, ima, l->f)) {
continue;
+ }
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -1799,12 +1851,15 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool)
* new_y = (y2 - y1) / (x2 - x1) * (x - x1) + y1
* Maybe this should be a BLI func? Or is it already existing?
* Could use interp_v2_v2v2, but not sure it's worth it here...*/
- if (tool_local == UV_STRAIGHTEN_X)
+ if (tool_local == UV_STRAIGHTEN_X) {
luv->uv[0] = a * (luv->uv[1] - uv_start[1]) + uv_start[0];
- else if (tool_local == UV_STRAIGHTEN_Y)
+ }
+ else if (tool_local == UV_STRAIGHTEN_Y) {
luv->uv[1] = a * (luv->uv[0] - uv_start[0]) + uv_start[1];
- else
+ }
+ else {
closest_to_line_segment_v2(luv->uv, luv->uv, uv_start, uv_end);
+ }
changed = true;
}
}
@@ -2291,8 +2346,9 @@ static void uv_select_all_perform(Scene *scene, Image *ima, Object *obedit, int
}
else {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -2381,17 +2437,20 @@ static bool uv_sticky_select(
/* this function test if some vertex needs to selected
* in addition to the existing ones due to sticky select */
- if (sticky == SI_STICKY_DISABLE)
+ if (sticky == SI_STICKY_DISABLE) {
return false;
+ }
for (i = 0; i < hitlen; i++) {
if (hitv[i] == v) {
if (sticky == SI_STICKY_LOC) {
- if (fabsf(hituv[i][0] - uv[0]) < limit[0] && fabsf(hituv[i][1] - uv[1]) < limit[1])
+ if (fabsf(hituv[i][0] - uv[0]) < limit[0] && fabsf(hituv[i][1] - uv[1]) < limit[1]) {
return true;
+ }
}
- else if (sticky == SI_STICKY_VERTEX)
+ else if (sticky == SI_STICKY_VERTEX) {
return true;
+ }
}
}
@@ -2436,12 +2495,15 @@ static int uv_mouse_select_multi(
if (ts->uv_flag & UV_SYNC_SELECTION) {
sync = 1;
- if (ts->selectmode & SCE_SELECT_FACE)
+ if (ts->selectmode & SCE_SELECT_FACE) {
selectmode = UV_SELECT_FACE;
- else if (ts->selectmode & SCE_SELECT_EDGE)
+ }
+ else if (ts->selectmode & SCE_SELECT_EDGE) {
selectmode = UV_SELECT_EDGE;
- else
+ }
+ else {
selectmode = UV_SELECT_VERTEX;
+ }
sticky = SI_STICKY_DISABLE;
}
@@ -2585,14 +2647,16 @@ static int uv_mouse_select_multi(
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (uv_sticky_select(
- limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen)) {
uvedit_uv_select_set(em, scene, l, select, false, cd_loop_uv_offset);
+ }
}
}
@@ -2621,17 +2685,20 @@ static int uv_mouse_select_multi(
/* select sticky uvs */
if (sticky != SI_STICKY_DISABLE) {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- if (sticky == SI_STICKY_DISABLE)
+ if (sticky == SI_STICKY_DISABLE) {
continue;
+ }
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (uv_sticky_select(
- limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+ limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen)) {
uvedit_uv_select_enable(em, scene, l, false, cd_loop_uv_offset);
+ }
flush = 1;
}
@@ -3127,11 +3194,13 @@ static void uv_select_flush_from_tag_sticky_loc_internal(Scene *scene,
vlist_iter = BM_uv_vert_map_at_index(vmap, BM_elem_index_get(l->v));
while (vlist_iter) {
- if (vlist_iter->separate)
+ if (vlist_iter->separate) {
start_vlist = vlist_iter;
+ }
- if (efa_index == vlist_iter->poly_index)
+ if (efa_index == vlist_iter->poly_index) {
break;
+ }
vlist_iter = vlist_iter->next;
}
@@ -3139,8 +3208,9 @@ static void uv_select_flush_from_tag_sticky_loc_internal(Scene *scene,
vlist_iter = start_vlist;
while (vlist_iter) {
- if (vlist_iter != start_vlist && vlist_iter->separate)
+ if (vlist_iter != start_vlist && vlist_iter->separate) {
break;
+ }
if (efa_index != vlist_iter->poly_index) {
BMLoop *l_other;
@@ -3415,8 +3485,9 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
@@ -3826,8 +3897,9 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op)
}
}
- if (!changed)
+ if (!changed) {
return OPERATOR_CANCELLED;
+ }
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, sima);
@@ -3875,8 +3947,9 @@ static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, cons
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -3902,8 +3975,9 @@ static bool uv_snap_uvs_offset(Scene *scene, Image *ima, Object *obedit, const f
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -3991,8 +4065,9 @@ static bool uv_snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit
h = (float)height;
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (!uvedit_face_visible_test(scene, obedit, ima, efa))
+ if (!uvedit_face_visible_test(scene, obedit, ima, efa)) {
continue;
+ }
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
@@ -4329,8 +4404,9 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
}
}
}
- if (!swap)
+ if (!swap) {
uvedit_face_select_disable(scene, em, efa, cd_loop_uv_offset);
+ }
}
}
else if (em->selectmode == SCE_SELECT_FACE) {
@@ -4345,8 +4421,9 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (UV_SEL_TEST(luv, !swap)) {
BM_vert_select_set(em->bm, l->v, false);
- if (!swap)
+ if (!swap) {
luv->flag &= ~MLOOPUV_VERTSEL;
+ }
}
}
}
@@ -4354,8 +4431,9 @@ static int uv_hide_exec(bContext *C, wmOperator *op)
}
/* flush vertex selection changes */
- if (em->selectmode != SCE_SELECT_FACE)
+ if (em->selectmode != SCE_SELECT_FACE) {
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
+ }
BM_select_history_validate(em->bm);
@@ -4539,8 +4617,9 @@ static int uv_set_2d_cursor_exec(bContext *C, wmOperator *op)
{
SpaceImage *sima = CTX_wm_space_image(C);
- if (!sima)
+ if (!sima) {
return OPERATOR_CANCELLED;
+ }
RNA_float_get_array(op->ptr, "location", sima->cursor);
@@ -4650,20 +4729,23 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
UvMapVert *mv2cache = NULL, *mv2sep = NULL;
mvinit1 = vmap->vert[BM_elem_index_get(editedge->v1)];
- if (mark_seams)
+ if (mark_seams) {
BM_elem_flag_disable(editedge, BM_ELEM_SEAM);
+ }
for (mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next) {
- if (mv1->separate && commonFaces)
+ if (mv1->separate && commonFaces) {
v1coincident = 0;
+ }
separated2 = 0;
efa1 = BM_face_at_index(bm, mv1->poly_index);
mvinit2 = vmap->vert[BM_elem_index_get(editedge->v2)];
for (mv2 = mvinit2; mv2; mv2 = mv2->next) {
- if (mv2->separate)
+ if (mv2->separate) {
mv2sep = mv2;
+ }
efa2 = BM_face_at_index(bm, mv2->poly_index);
if (efa1 == efa2) {
@@ -4674,11 +4756,13 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
/* flag seam unless proved to be coincident with previous hit */
separated2 = 1;
for (mviter = mv2cache; mviter; mviter = mviter->next) {
- if (mviter->separate && mviter != mv2cache)
+ if (mviter->separate && mviter != mv2cache) {
break;
+ }
/* coincident with previous hit, do not flag seam */
- if (mviter == mv2)
+ if (mviter == mv2) {
separated2 = 0;
+ }
}
}
/* First hit case, store the hit in the cache */
@@ -4687,8 +4771,9 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
commonFaces = 1;
}
}
- else
+ else {
separated1 = 1;
+ }
if (separated1 || separated2) {
faces_separated = 1;
@@ -4699,10 +4784,12 @@ static int uv_seams_from_islands_exec(bContext *C, wmOperator *op)
}
if (faces_separated) {
- if (mark_seams)
+ if (mark_seams) {
BM_elem_flag_enable(editedge, BM_ELEM_SEAM);
- if (mark_sharp)
+ }
+ if (mark_sharp) {
BM_elem_flag_disable(editedge, BM_ELEM_SMOOTH);
+ }
}
}