diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 16:21:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 16:22:52 +0300 |
commit | aba4e6810f8b4d0e459137b64e061a2cadc457d1 (patch) | |
tree | 2b6159c7ba0f23c020600b71276772fa4a882b5b /source/blender/editors | |
parent | 72a563cdee8fef198a200ff65b57ddb847c01795 (diff) |
Cleanup: style, use braces in source/ (include disabled blocks)
Diffstat (limited to 'source/blender/editors')
30 files changed, 288 insertions, 145 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 9e09fc485a6..21b9c7252d2 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -278,8 +278,9 @@ void ANIM_deselect_anim_channels( break; case ANIMTYPE_OBJECT: #if 0 /* for now, do not take object selection into account, since it gets too annoying */ - if (ale->flag & SELECT) + if (ale->flag & SELECT) { sel = ACHANNEL_SETFLAG_CLEAR; + } #endif break; case ANIMTYPE_GROUP: diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index a228d819286..e5846e270f0 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -455,10 +455,12 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac) { \ int _filter = filter_mode; \ short _doSubChannels = 0; \ - if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) \ + if (!(filter_mode & ANIMFILTER_LIST_VISIBLE) || (expanded_check)) { \ _doSubChannels = 1; \ - else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) \ + } \ + else if (!(filter_mode & ANIMFILTER_LIST_CHANNELS)) { \ _doSubChannels = 2; \ + } \ else { \ filter_mode |= ANIMFILTER_TMP_PEEK; \ } \ diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 81030c7f199..6bf507df421 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1198,17 +1198,21 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb) { int tb, ti, te, ts; tb = ti = te = ts = 0; - for (a = 0; a < size * size * size; a++) - if (tag[a] == MESHDEFORM_TAG_BOUNDARY) + for (a = 0; a < size * size * size; a++) { + if (tag[a] == MESHDEFORM_TAG_BOUNDARY) { tb++; - else if (tag[a] == MESHDEFORM_TAG_INTERIOR) + } + else if (tag[a] == MESHDEFORM_TAG_INTERIOR) { ti++; + } else if (tag[a] == MESHDEFORM_TAG_EXTERIOR) { te++; - if (mdb->semibound[a]) + if (mdb->semibound[a]) { ts++; + } } + } printf("interior %d exterior %d boundary %d semi-boundary %d\n", ti, te, tb, ts); } @@ -1557,14 +1561,17 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind #if 0 /* sanity check */ - for (b = 0; b < mdb->size3; b++) - if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR) - if (fabsf(mdb->totalphi[b] - 1.0f) > 1e-4f) + for (b = 0; b < mdb->size3; b++) { + if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR) { + if (fabsf(mdb->totalphi[b] - 1.0f) > 1e-4f) { printf("totalphi deficiency [%s|%d] %d: %.10f\n", (mdb->tag[b] == MESHDEFORM_TAG_INTERIOR) ? "interior" : "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]); + } + } + } #endif /* free */ diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 954beda7777..745af06c7af 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -162,14 +162,16 @@ static bool pose_has_protected_selected(Object *ob, short warn) for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone && (pchan->bone->layer & arm->layer)) { if (pchan->bone->layer & arm->layer_protected) { - if (pchan->bone->flag & BONE_SELECTED) + if (pchan->bone->flag & BONE_SELECTED) { break; + } } } } if (pchan) { - if (warn) + if (warn) { error("Cannot change Proxy protected bones"); + } return 1; } } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 48094c7a3eb..d1d43a49826 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -104,13 +104,15 @@ void printknots(Object *obedit) if (ED_curve_nurb_select_check(nu) && nu->type == CU_NURBS) { if (nu->knotsu) { num = KNOTSU(nu); - for (a = 0; a < num; a++) + for (a = 0; a < num; a++) { printf("knotu %d: %f\n", a, nu->knotsu[a]); + } } if (nu->knotsv) { num = KNOTSV(nu); - for (a = 0; a < num; a++) + for (a = 0; a < num; a++) { printf("knotv %d: %f\n", a, nu->knotsv[a]); + } } } } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index d0f44314c95..f4636e81966 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -536,8 +536,9 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) static short snap_gpf_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene)) { #if 0 /* note: gpf->framenum is already an int! */ - if (gpf->flag & GP_FRAME_SELECT) + if (gpf->flag & GP_FRAME_SELECT) { gpf->framenum = (int)(floor(gpf->framenum + 0.5)); + } #endif return 0; } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 7a29e6b5e66..230d62d400c 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -760,12 +760,15 @@ float ANIM_unit_mapping_get_factor( */ #define ACHANNEL_SET_FLAG(channel, smode, sflag) \ { \ - if (smode == ACHANNEL_SETFLAG_INVERT) \ + if (smode == ACHANNEL_SETFLAG_INVERT) { \ (channel)->flag ^= (sflag); \ - else if (smode == ACHANNEL_SETFLAG_ADD) \ + } \ + else if (smode == ACHANNEL_SETFLAG_ADD) { \ (channel)->flag |= (sflag); \ - else \ + } \ + else { \ (channel)->flag &= ~(sflag); \ + } \ } \ ((void)0) @@ -776,12 +779,15 @@ float ANIM_unit_mapping_get_factor( */ #define ACHANNEL_SET_FLAG_NEG(channel, smode, sflag) \ { \ - if (smode == ACHANNEL_SETFLAG_INVERT) \ + if (smode == ACHANNEL_SETFLAG_INVERT) { \ (channel)->flag ^= (sflag); \ - else if (smode == ACHANNEL_SETFLAG_ADD) \ + } \ + else if (smode == ACHANNEL_SETFLAG_ADD) { \ (channel)->flag &= ~(sflag); \ - else \ + } \ + else { \ (channel)->flag |= (sflag); \ + } \ } \ ((void)0) diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 385b3c69422..a6934326d68 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -1133,12 +1133,15 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, return; } - if (verts) + if (verts) { mesh_add_verts(mesh, verts); - if (edges) + } + if (edges) { mesh_add_edges(mesh, edges); - if (faces) + } + if (faces) { mesh_add_faces(mesh, faces); + } } #endif diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index abdf64af595..e424d2cc5bf 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -222,8 +222,9 @@ static void update_pyconstraint_cb(void *arg1, void *arg2) # else Object *owner = (Object *)arg1; bConstraint *con = (bConstraint *)arg2; - if (owner && con) + if (owner && con) { BPY_pyconstraint_update(owner, con); + } # endif } #endif // UNUSED diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 6879a7f4a06..f748fd247ee 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1384,10 +1384,12 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr)) Scene *sce = (Scene *)BLI_findlink(&bmain->scene, G.curscreen->scenenr - 1); Base *base, *nbase; - if (sce == NULL) + if (sce == NULL) { return; - if (sce->id.lib) + } + if (sce->id.lib) { return; + } for (base = FIRSTBASE; base; base = base->next) { if (BASE_SELECTED(v3d, base)) { diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 05a3d86a23c..2e958385a60 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2437,8 +2437,9 @@ void ED_vgroup_mirror(Object *ob, /* disabled, confusing when you have an active pose bone */ #if 0 /* flip active group index */ - if (flip_vgroups && flip_map[def_nr] >= 0) + if (flip_vgroups && flip_map[def_nr] >= 0) { ob->actdef = flip_map[def_nr] + 1; + } #endif cleanup: diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index af90bbc9975..773f596ec79 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3813,10 +3813,12 @@ static int region_quadview_exec(bContext *C, wmOperator *op) RV3D_ORTHO); /* forcing camera is distracting */ #if 0 - if (v3d->camera) + if (v3d->camera) { region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_CAMERA, RV3D_CAMOB); - else + } + else { region_quadview_init_rv3d(sa, (ar = ar->next), 0, RV3D_VIEW_USER, RV3D_PERSP); + } #else (void)v3d; #endif @@ -4580,12 +4582,15 @@ static int box_select_exec(bContext *C, wmOperator *op) { int event_type = RNA_int_get(op->ptr, "event_type"); - if (event_type == LEFTMOUSE) + if (event_type == LEFTMOUSE) { printf("box select do select\n"); - else if (event_type == RIGHTMOUSE) + } + else if (event_type == RIGHTMOUSE) { printf("box select deselect\n"); - else + } + else { printf("box select do something\n"); + } return 1; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index f7a589350f9..2bbb99b2b67 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -653,16 +653,18 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke) /* duplicate warning, see texpaint_init */ #if 0 - if (pop->s.warnmultifile) + if (pop->s.warnmultifile) { BKE_reportf(op->reports, RPT_WARNING, "Image requires 4 color channels to paint: %s", pop->s.warnmultifile); - if (pop->s.warnpackedfile) + } + if (pop->s.warnpackedfile) { BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile); + } #endif MEM_freeN(pop); } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 90ef64b01b7..bae79d5ea60 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -2256,8 +2256,9 @@ static bool project_bucket_isect_circle(const float cent[2], * this is even less work then an intersection test. */ #if 0 - if (BLI_rctf_isect_pt_v(bucket_bounds, cent)) + if (BLI_rctf_isect_pt_v(bucket_bounds, cent)) { return 1; + } #endif if ((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) || diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 23656737153..2dc1e53af89 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4225,8 +4225,9 @@ void sculpt_cache_calc_brushdata_symm(StrokeCache *cache, printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce); - if (frac < 1) + if (frac < 1) { mul_v3_fl(cache->grab_delta_symmetry, reduce); + } } #endif diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index c66c1d91a77..965f31cbb6b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -654,8 +654,9 @@ static bool sculpt_undo_cleanup(bContext *C, ListBase *lb) unode = lb->first; if (unode && !STREQ(unode->idname, ob->id.name)) { - if (unode->bm_entry) + if (unode->bm_entry) { BM_log_cleanup_entry(unode->bm_entry); + } return true; } diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 1fc218c9461..fc0adb655b7 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -141,8 +141,9 @@ static void console_lb_debug__internal(ListBase *lb) ConsoleLine *cl; printf("%d: ", BLI_listbase_count(lb)); - for (cl = lb->first; cl; cl = cl->next) + for (cl = lb->first; cl; cl = cl->next) { printf("<%s> ", cl->line); + } printf("\n"); } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 564dd0ec81d..f2d1b6eab83 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2471,13 +2471,15 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) BLI_assert(filelist->filelist.entries == NULL); - if (filelist->filelist.root[0] == '/') + if (filelist->filelist.root[0] == '/') { filelist->filelist.root[0] = '\0'; + } if (filelist->filelist.root[0]) { idcode = groupname_to_code(filelist->filelist.root); - if (idcode == 0) + if (idcode == 0) { filelist->filelist.root[0] = '\0'; + } } if (filelist->dir[0] == 0) { @@ -2525,8 +2527,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) idcode = groupname_to_code(filelist->filelist.root); lb = which_libbase(bmain, idcode); - if (lb == NULL) + if (lb == NULL) { return; + } filelist->filelist.nbr_entries = 0; for (id = lb->first; id; id = id->next) { @@ -2537,8 +2540,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) /* XXX TODO: if databrowse F4 or append/link * filelist->flags & FLF_HIDE_PARENT has to be set */ - if (!(filelist->filter_data.flags & FLF_HIDE_PARENT)) + if (!(filelist->filter_data.flags & FLF_HIDE_PARENT)) { filelist->filelist.nbr_entries++; + } if (filelist->filelist.nbr_entries > 0) { filelist_resize(filelist, filelist->filelist.nbr_entries); @@ -2604,8 +2608,9 @@ static void filelist_readjob_main_rec(Main *bmain, FileList *filelist) # endif if (id->lib) { - if (totlib == 0) + if (totlib == 0) { firstlib = files; + } totlib++; } diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index fc6546f0079..829a78b2bfa 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -142,11 +142,14 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock) if (sima && sima->image) { #if 0 - if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare()) + if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare()) { return BIF_render_spare_imbuf(); + } else #endif - ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, r_lock); + { + ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, r_lock); + } if (ibuf) { if (ibuf->rect || ibuf->rect_float) { diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 4c00512d838..0fa9ddacc20 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -77,16 +77,21 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo)) #if 0 int report_mask = 0; - if (sinfo->rpt_mask & INFO_RPT_DEBUG) + if (sinfo->rpt_mask & INFO_RPT_DEBUG) { report_mask |= RPT_DEBUG_ALL; - if (sinfo->rpt_mask & INFO_RPT_INFO) + } + if (sinfo->rpt_mask & INFO_RPT_INFO) { report_mask |= RPT_INFO_ALL; - if (sinfo->rpt_mask & INFO_RPT_OP) + } + if (sinfo->rpt_mask & INFO_RPT_OP) { report_mask |= RPT_OPERATOR_ALL; - if (sinfo->rpt_mask & INFO_RPT_WARN) + } + if (sinfo->rpt_mask & INFO_RPT_WARN) { report_mask |= RPT_WARNING_ALL; - if (sinfo->rpt_mask & INFO_RPT_ERR) + } + if (sinfo->rpt_mask & INFO_RPT_ERR) { report_mask |= RPT_ERROR_ALL; + } return report_mask; #endif diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index e39e024e44a..e63c8331f18 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -135,8 +135,9 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt if (cumap) { cumap->flag |= CUMA_DRAW_CFRA; - if (node->custom1 < node->custom2) + if (node->custom1 < node->custom2) { cumap->sample[0] = (float)(CFRA - node->custom1) / (float)(node->custom2 - node->custom1); + } } #endif @@ -205,8 +206,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) bNode *node = node_v; Tex *tex; - if (node->menunr < 1) + if (node->menunr < 1) { return; + } if (node->id) { id_us_min(node->id); @@ -220,8 +222,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) nodeSetActive(ntree, node); - if (ntree->type == NTREE_TEXTURE) + if (ntree->type == NTREE_TEXTURE) { ntreeTexCheckCyclics(ntree); + } // allqueue(REDRAWBUTSSHADING, 0); // allqueue(REDRAWNODE, 0); @@ -1143,8 +1146,9 @@ static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA node_shader_buts_script(layout, C, ptr); #if 0 /* not implemented yet */ - if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) + if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) { uiItemR(layout, ptr, "use_auto_update", 0, NULL, ICON_NONE); + } #endif } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index fb34d9dc459..235bc6aeb96 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -745,10 +745,11 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) else if (ntree->type == NTREE_TEXTURE) { // XXX #if 0 - if (node->id) - ; // XXX BIF_preview_changed(-1); - // allqueue(REDRAWBUTSSHADING, 1); - // allqueue(REDRAWIPO, 0); + if (node->id) { + // XXX BIF_preview_changed(-1); + // allqueue(REDRAWBUTSSHADING, 1); + // allqueue(REDRAWIPO, 0); + } #endif } } @@ -784,17 +785,21 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op) { if (!RNA_struct_property_is_set(op->ptr, "node")) { bNode *node = CTX_data_pointer_get_type(C, "node", &RNA_Node).data; - if (!node) + if (!node) { return 0; - else + } + else { RNA_string_set(op->ptr, "node", node->name); + } } - if (!RNA_struct_property_is_set(op->ptr, "in_out")) + if (!RNA_struct_property_is_set(op->ptr, "in_out")) { RNA_enum_set(op->ptr, "in_out", SOCK_IN); + } - if (!RNA_struct_property_is_set(op->ptr, "socket")) + if (!RNA_struct_property_is_set(op->ptr, "socket")) { RNA_int_set(op->ptr, "socket", 0); + } return 1; } @@ -823,12 +828,15 @@ static void edit_node_properties_get( break; } - if (rnode) + if (rnode) { *rnode = node; - if (rsock) + } + if (rsock) { *rsock = sock; - if (rin_out) + } + if (rin_out) { *rin_out = in_out; + } } #endif diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index c32b2b051f8..de6e89e47c4 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1312,19 +1312,22 @@ static TreeElement *outliner_find_name( if (found) { /* name is right, but is element the previous one? */ if (prev) { - if ((te != prev) && (*prevFound)) + if ((te != prev) && (*prevFound)) { return te; + } if (te == prev) { *prevFound = 1; } } - else + else { return te; + } } tes = outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound); - if (tes) + if (tes) { return tes; + } } /* nothing valid found */ @@ -1372,8 +1375,9 @@ static void outliner_find_panel( tselem = TREESTORE(te); if (tselem) { /* expand branches so that it will be visible, we need to get correct coordinates */ - if (outliner_open_back(soops, te)) + if (outliner_open_back(soops, te)) { outliner_set_coordinates(ar, soops); + } /* deselect all visible, and select found element */ outliner_flag_set(soops, &soops->tree, TSE_SELECTED, 0); @@ -1381,8 +1385,9 @@ static void outliner_find_panel( /* make te->ys center of view */ ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2); - if (ytop > 0) + if (ytop > 0) { ytop = 0; + } ar->v2d.cur.ymax = (float)ytop; ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask)); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 6da2e913003..4e4f25206a5 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -376,12 +376,15 @@ static void outliner_add_object_contents(SpaceOutliner *soops, soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index); #if 0 /* disabled as it needs to be reworked for recoded constraints system */ target = get_constraint_target(con, &str); - if (str && str[0]) + if (str && str[0]) { ten1->name = str; - else if (target) + } + else if (target) { ten1->name = target->id.name + 2; - else + } + else { ten1->name = con->name; + } #endif ten1->name = con->name; ten1->directdata = con; @@ -441,12 +444,15 @@ static void outliner_add_object_contents(SpaceOutliner *soops, ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a); #if 0 /* disabled due to constraints system targets recode... code here needs review */ target = get_constraint_target(con, &str); - if (str && str[0]) + if (str && str[0]) { ten->name = str; - else if (target) + } + else if (target) { ten->name = target->id.name + 2; - else + } + else { ten->name = con->name; + } #endif ten->name = con->name; ten->directdata = con; @@ -1678,20 +1684,25 @@ static int treesort_obtype_alpha(const void *v1, const void *v2) else { /* 2nd we check ob type */ if (x1->idcode == ID_OB && x2->idcode == ID_OB) { - if (((Object *)x1->id)->type > ((Object *)x2->id)->type) + if (((Object *)x1->id)->type > ((Object *)x2->id)->type) { return 1; - else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) + } + else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) { return -1; - else + } + else { return 0; + } } else { int comp = strcmp(x1->name, x2->name); - if (comp > 0) + if (comp > 0) { return 1; - else if (comp < 0) + } + else if (comp < 0) { return -1; + } return 0; } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index b48b0123bdf..ed7205328eb 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1025,11 +1025,13 @@ static void set_filter_seq(Scene *scene) Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, false); - if (ed == NULL) + if (ed == NULL) { return; + } - if (okee("Set Deinterlace") == 0) + if (okee("Set Deinterlace") == 0) { return; + } SEQP_BEGIN (ed, seq) { if (seq->flag & SELECT) { @@ -3159,8 +3161,9 @@ static Sequence *sequence_find_parent(Scene *scene, Sequence *child) Sequence *parent = NULL; Sequence *seq; - if (ed == NULL) + if (ed == NULL) { return NULL; + } for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq != child) && seq_is_parent(seq, child)) { diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 2138b1c16da..af4b53ee858 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -149,8 +149,9 @@ void select_surround_from_last(Scene *scene) { Sequence *seq = get_last_seq(scene); - if (seq == NULL) + if (seq == NULL) { return; + } select_surrounding_handles(scene, seq); } diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index ac1fb4af1c2..c03b804aa2c 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -107,11 +107,13 @@ static void txt_format_text(SpaceText *st) { TextLine *linep; - if (!st->text) + if (!st->text) { return; + } - for (linep = st->text->lines.first; linep; linep = linep->next) + for (linep = st->text->lines.first; linep; linep = linep->next) { txt_format_line(st, linep, 0); + } } #endif @@ -1024,23 +1026,29 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) int i, br, lines; int boxw, boxh, l, x, y /* , top */ /* UNUSED */; - if (!st || !st->text) + if (!st || !st->text) { return; - if (!texttool_text_is_active(st->text)) + } + if (!texttool_text_is_active(st->text)) { return; + } docs = texttool_docs_get(); - if (!docs) + if (!docs) { return; + } text_draw_context_init(st, &tdc); /* Count the visible lines to the cursor */ - for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) - ; - if (l < 0) + for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) { + /* pass */ + } + + if (l < 0) { return; + } if (st->showlinenrs) { x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4; @@ -1089,10 +1097,12 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) br = DOC_WIDTH; lines = 0; // XXX -doc_scroll; for (p = docs; *p; p++) { - if (*p == '\r' && *(++p) != '\n') + if (*p == '\r' && *(++p) != '\n') { *(--p) = '\n'; /* Fix line endings */ - if (*p == ' ' || *p == '\t') + } + if (*p == ' ' || *p == '\t') { br = i; + } else if (*p == '\n') { buf[i] = '\0'; if (lines >= 0) { @@ -1115,8 +1125,9 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) br = DOC_WIDTH; lines++; } - if (lines >= DOC_HEIGHT) + if (lines >= DOC_HEIGHT) { break; + } } } #endif diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c3acd604ee1..2deba69ed22 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -718,8 +718,9 @@ static void view_editmove(unsigned short UNUSED(event)) /* only work in 3D window for now * In the end, will have to send to event to a 2D window handler instead */ - if (Trans.flag & T_2D_EDIT) + if (Trans.flag & T_2D_EDIT) { return; + } switch (event) { case WHEELUPMOUSE: @@ -743,10 +744,12 @@ static void view_editmove(unsigned short UNUSED(event)) persptoetsen(PAD4); } } - else if (U.uiflag & USER_WHEELZOOMDIR) + else if (U.uiflag & USER_WHEELZOOMDIR) { persptoetsen(PADMINUS); - else + } + else { persptoetsen(PADPLUSKEY); + } refresh = 1; break; @@ -771,17 +774,20 @@ static void view_editmove(unsigned short UNUSED(event)) persptoetsen(PAD6); } } - else if (U.uiflag & USER_WHEELZOOMDIR) + else if (U.uiflag & USER_WHEELZOOMDIR) { persptoetsen(PADPLUSKEY); - else + } + else { persptoetsen(PADMINUS); + } refresh = 1; break; } - if (refresh) + if (refresh) { setTransformViewMatrices(&Trans); + } #endif } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 30ded60bd84..71bf6a1946a 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2716,10 +2716,12 @@ static int uv_mouse_select_multi(bContext *C, /* before bmesh */ #if 0 if (ts->selectmode != SCE_SELECT_FACE) { - if (flush == 1) + if (flush == 1) { EDBM_select_flush(em); - else if (flush == -1) + } + else if (flush == -1) { EDBM_deselect_flush(em); + } } #else if (flush != 0) { diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 10b2df48f2f..39eb93af199 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -630,8 +630,9 @@ static void p_chart_topological_sanity_check(PChart *chart) PVert *v; PEdge *e; - for (v = chart->verts; v; v = v->nextlink) + for (v = chart->verts; v; v = v->nextlink) { param_test_equals_ptr("v->edge->vert", v, v->edge->vert); + } for (e = chart->edges; e; e = e->nextlink) { if (e->pair) { @@ -1428,12 +1429,15 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer) static int p_polygon_point_in(float *cp1, float *cp2, float *p) { - if ((cp1[0] == p[0]) && (cp1[1] == p[1])) + if ((cp1[0] == p[0]) && (cp1[1] == p[1])) { return 2; - else if ((cp2[0] == p[0]) && (cp2[1] == p[1])) + } + else if ((cp2[0] == p[0]) && (cp2[1] == p[1])) { return 3; - else + } + else { return (p_area_signed(cp1, cp2, p) >= 0.0f); + } } static void p_polygon_kernel_clip(float (*oldpoints)[2], @@ -1562,8 +1566,9 @@ static float p_vert_cotan(float *v1, float *v2, float *v3) clen = len_v3(c); - if (clen == 0.0f) + if (clen == 0.0f) { return 0.0f; + } return dot_v3v3(a, b) / clen; } @@ -1573,8 +1578,9 @@ static PBool p_vert_flipped_wheel_triangle(PVert *v) PEdge *e = v->edge; do { - if (p_face_uv_area_signed(e->face) < 0.0f) + if (p_face_uv_area_signed(e->face) < 0.0f) { return P_TRUE; + } e = p_wheel_edge_next(e); } while (e && (e != v->edge)); @@ -1672,8 +1678,9 @@ static void p_vert_harmonic_insert(PVert *v) e = p_wheel_edge_next(e); } while (e && (e != v->edge)); - if (e == NULL) + if (e == NULL) { npoints++; + } points = MEM_mallocN(sizeof(float) * 2 * npoints, "PHarmonicPoints"); @@ -1703,8 +1710,9 @@ static void p_vert_harmonic_insert(PVert *v) e = v->edge; do { - if (!(e->next->vert->flag & PVERT_PIN)) + if (!(e->next->vert->flag & PVERT_PIN)) { p_vert_map_harmonic_weights(e->next->vert); + } e = p_wheel_edge_next(e); } while (e && (e != v->edge)); @@ -1719,8 +1727,9 @@ static void p_vert_fix_edge_pointer(PVert *v) while (v->edge->pair) { v->edge = p_wheel_edge_prev(v->edge); - if (v->edge == start) + if (v->edge == start) { break; + } } } @@ -1747,37 +1756,44 @@ static void p_collapse_edge(PEdge *edge, PEdge *pair) /* change e->vert pointers from old vertex to the target vertex */ e = oldv->edge; do { - if ((e != edge) && !(pair && pair->next == e)) + if ((e != edge) && !(pair && pair->next == e)) { e->vert = keepv; + } e = p_wheel_edge_next(e); } while (e && (e != oldv->edge)); /* set keepv->edge pointer */ if ((edge && (keepv->edge == edge->next)) || (keepv->edge == pair)) { - if (edge && edge->next->pair) + if (edge && edge->next->pair) { keepv->edge = edge->next->pair->next; - else if (pair && pair->next->next->pair) + } + else if (pair && pair->next->next->pair) { keepv->edge = pair->next->next->pair; - else if (edge && edge->next->next->pair) + } + else if (edge && edge->next->next->pair) { keepv->edge = edge->next->next->pair; - else + } + else { keepv->edge = pair->next->pair->next; + } } /* update pairs and v->edge pointers */ if (edge) { PEdge *e1 = edge->next, *e2 = e1->next; - if (e1->pair) + if (e1->pair) { e1->pair->pair = e2->pair; + } if (e2->pair) { e2->pair->pair = e1->pair; e2->vert->edge = p_wheel_edge_prev(e2); } - else + else { e2->vert->edge = p_wheel_edge_next(e2); + } p_vert_fix_edge_pointer(e2->vert); } @@ -1785,15 +1801,17 @@ static void p_collapse_edge(PEdge *edge, PEdge *pair) if (pair) { PEdge *e1 = pair->next, *e2 = e1->next; - if (e1->pair) + if (e1->pair) { e1->pair->pair = e2->pair; + } if (e2->pair) { e2->pair->pair = e1->pair; e2->vert->edge = p_wheel_edge_prev(e2); } - else + else { e2->vert->edge = p_wheel_edge_next(e2); + } p_vert_fix_edge_pointer(e2->vert); } @@ -1835,10 +1853,12 @@ static void p_split_vertex(PEdge *edge, PEdge *pair) if (edge) { PEdge *e1 = edge->next, *e2 = e1->next; - if (e1->pair) + if (e1->pair) { e1->pair->pair = e1; - if (e2->pair) + } + if (e2->pair) { e2->pair->pair = e2; + } e2->vert->edge = e2; p_vert_fix_edge_pointer(e2->vert); @@ -1848,10 +1868,12 @@ static void p_split_vertex(PEdge *edge, PEdge *pair) if (pair) { PEdge *e1 = pair->next, *e2 = e1->next; - if (e1->pair) + if (e1->pair) { e1->pair->pair = e1; - if (e2->pair) + } + if (e2->pair) { e2->pair->pair = e2; + } e2->vert->edge = e2; p_vert_fix_edge_pointer(e2->vert); @@ -1877,15 +1899,18 @@ static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair) /* boundary edges */ if (!edge || !pair) { /* avoid collapsing chart into an edge */ - if (edge && !edge->next->pair && !edge->next->next->pair) + if (edge && !edge->next->pair && !edge->next->next->pair) { return P_FALSE; - else if (pair && !pair->next->pair && !pair->next->next->pair) + } + else if (pair && !pair->next->pair && !pair->next->next->pair) { return P_FALSE; + } } /* avoid merging two boundaries (oldv and keepv are on the 'other side' of * the chart) */ - else if (!p_vert_interior(oldv) && !p_vert_interior(keepv)) + else if (!p_vert_interior(oldv) && !p_vert_interior(keepv)) { return P_FALSE; + } return P_TRUE; } @@ -1931,8 +1956,9 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) continue; } - if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co)) + if (p_collapse_normal_flipped(v1->co, v2->co, oldv->co, keepv->co)) { return P_FALSE; + } a[0] = angle; a[1] = p_vec_angle(v2->co, v1->co, oldv->co); @@ -1947,10 +1973,12 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) maxangle = M_PI - minangle; for (i = 0; i < 3; i++) { - if ((b[i] < a[i]) && (b[i] < minangle)) + if ((b[i] < a[i]) && (b[i] < minangle)) { return P_FALSE; - else if ((b[i] > a[i]) && (b[i] > maxangle)) + } + else if ((b[i] > a[i]) && (b[i] > maxangle)) { return P_FALSE; + } } e = p_wheel_edge_next(e); @@ -1958,21 +1986,24 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) if (p_vert_interior(oldv)) { /* hlscm criterion: angular defect smaller than threshold */ - if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) + if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) { return P_FALSE; + } } else { PVert *v1 = p_boundary_edge_next(oldv->edge)->vert; PVert *v2 = p_boundary_edge_prev(oldv->edge)->vert; /* abf++ criterion 2: avoid collapsing verts inwards */ - if (p_vert_interior(keepv)) + if (p_vert_interior(keepv)) { return P_FALSE; + } /* don't collapse significant boundary changes */ angle = p_vec_angle(v1->co, oldv->co, v2->co); - if (angle < (M_PI * 160.0 / 180.0)) + if (angle < (M_PI * 160.0 / 180.0)) { return P_FALSE; + } } return P_TRUE; @@ -1984,8 +2015,9 @@ static PBool p_collapse_allowed(PEdge *edge, PEdge *pair) p_collapsing_verts(edge, pair, &oldv, &keepv); - if (oldv->flag & PVERT_PIN) + if (oldv->flag & PVERT_PIN) { return P_FALSE; + } return (p_collapse_allowed_topologic(edge, pair) && p_collapse_allowed_geometric(edge, pair)); } @@ -2027,8 +2059,9 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) # if 0 shapecost += dot_v3v3(co1, keepv->co); - if (p_wheel_edge_next(e) == NULL) + if (p_wheel_edge_next(e) == NULL) { shapecost += dot_v3v3(co2, keepv->co); + } # endif p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3); @@ -2239,19 +2272,23 @@ static void p_chart_simplify_compute(PChart *chart) p_collapse_cost_vertex(v, &cost, &e); - if (e) + if (e) { v->u.heaplink = BLI_heap_insert(heap, cost, e); - else + } + else { v->u.heaplink = NULL; + } } - for (e = chart->edges; e; e = e->nextlink) + for (e = chart->edges; e; e = e->nextlink) { e->u.nextcollapse = NULL; + } /* pop edge collapse out of heap one by one */ while (!BLI_heap_is_empty(heap)) { - if (ncollapsed == NCOLLAPSE) + if (ncollapsed == NCOLLAPSE) { break; + } HeapNode *link = BLI_heap_top(heap); PEdge *edge = (PEdge *)BLI_heap_pop_min(heap), *pair = edge->pair; @@ -2282,8 +2319,9 @@ static void p_chart_simplify_compute(PChart *chart) wheelverts[nwheelverts++] = wheele->next->vert; nexte = p_wheel_edge_next(wheele); - if (nexte == NULL) + if (nexte == NULL) { wheelverts[nwheelverts++] = wheele->next->next->vert; + } wheele = nexte; } while (wheele && (wheele != oldv->edge)); @@ -2304,8 +2342,9 @@ static void p_chart_simplify_compute(PChart *chart) p_collapse_cost_vertex(v, &cost, &collapse); - if (collapse) + if (collapse) { v->u.heaplink = BLI_heap_insert(heap, cost, collapse); + } } ncollapsed++; @@ -2324,8 +2363,9 @@ static void p_chart_complexify(PChart *chart) int x = 0; for (e = chart->collapsed_edges; e; e = e->nextlink) { - if (!(e->flag & PEDGE_COLLAPSE_EDGE)) + if (!(e->flag & PEDGE_COLLAPSE_EDGE)) { break; + } edge = e; pair = e->pair; |