From ce3b78c73a7ccc16fdccf7decedb5d1578dfdf0a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 26 Mar 2019 21:16:47 +1100 Subject: Cleanup: style, use braces for editor/spaces --- source/blender/editors/space_info/info_ops.c | 13 ++++-- source/blender/editors/space_info/info_report.c | 3 +- source/blender/editors/space_info/info_stats.c | 53 ++++++++++++++++++------- source/blender/editors/space_info/space_info.c | 15 ++++--- source/blender/editors/space_info/textview.c | 12 ++++-- 5 files changed, 67 insertions(+), 29 deletions(-) (limited to 'source/blender/editors/space_info') diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 538c41f730a..4f7e0f70ad9 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -219,7 +219,9 @@ static int unpack_all_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); int method = RNA_enum_get(op->ptr, "method"); - if (method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */ + if (method != PF_KEEP) { + unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */ + } G.fileflags &= ~G_FILE_AUTOPACK; return OPERATOR_FINISHED; @@ -241,10 +243,12 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED( return OPERATOR_CANCELLED; } - if (count == 1) + if (count == 1) { BLI_strncpy(title, IFACE_("Unpack 1 File"), sizeof(title)); - else + } + else { BLI_snprintf(title, sizeof(title), IFACE_("Unpack %d Files"), count); + } pup = UI_popup_menu_begin(C, title, ICON_NONE); layout = UI_popup_menu_layout(pup); @@ -303,8 +307,9 @@ static int unpack_item_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (method != PF_KEEP) + if (method != PF_KEEP) { BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */ + } G.fileflags &= ~G_FILE_AUTOPACK; diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 73c36f64cb5..a8f5d9b9b76 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -111,8 +111,9 @@ static int select_report_pick_exec(bContext *C, wmOperator *op) int report_index = RNA_int_get(op->ptr, "report_index"); Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index); - if (!report) + if (!report) { return OPERATOR_CANCELLED; + } report->flag ^= SELECT; /* toggle */ diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index fdcc915737d..054e9cd0026 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -128,7 +128,9 @@ static void stats_object(Object *ob, SceneStats *stats) const bool is_selected = (ob->base_flag & BASE_SELECTED) != 0; stats->totobj++; - if (is_selected) stats->totobjsel++; + if (is_selected) { + stats->totobjsel++; + } switch (ob->type) { case OB_MESH: @@ -158,8 +160,9 @@ static void stats_object(Object *ob, SceneStats *stats) { int totv = 0, totf = 0, tottri = 0; - if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first) + if (ob->runtime.curve_cache && ob->runtime.curve_cache->disp.first) { BKE_displist_count(&ob->runtime.curve_cache->disp, &totv, &totf, &tottri); + } stats->totvert += totv; stats->totface += totf; @@ -214,15 +217,20 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { stats->totbone++; - if ((ebo->flag & BONE_CONNECTED) && ebo->parent) + if ((ebo->flag & BONE_CONNECTED) && ebo->parent) { stats->totvert--; + } - if (ebo->flag & BONE_TIPSEL) + if (ebo->flag & BONE_TIPSEL) { stats->totvertsel++; - if (ebo->flag & BONE_ROOTSEL) + } + if (ebo->flag & BONE_ROOTSEL) { stats->totvertsel++; + } - if (ebo->flag & BONE_SELECTED) stats->totbonesel++; + if (ebo->flag & BONE_SELECTED) { + stats->totbonesel++; + } /* if this is a connected child and it's parent is being moved, remove our root */ if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) && @@ -249,9 +257,15 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) a = nu->pntsu; while (a--) { stats->totvert += 3; - if (bezt->f1 & SELECT) stats->totvertsel++; - if (bezt->f2 & SELECT) stats->totvertsel++; - if (bezt->f3 & SELECT) stats->totvertsel++; + if (bezt->f1 & SELECT) { + stats->totvertsel++; + } + if (bezt->f2 & SELECT) { + stats->totvertsel++; + } + if (bezt->f3 & SELECT) { + stats->totvertsel++; + } bezt++; } } @@ -260,7 +274,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) a = nu->pntsu * nu->pntsv; while (a--) { stats->totvert++; - if (bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) { + stats->totvertsel++; + } bp++; } } @@ -273,7 +289,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) for (ml = mball->editelems->first; ml; ml = ml->next) { stats->totvert++; - if (ml->flag & SELECT) stats->totvertsel++; + if (ml->flag & SELECT) { + stats->totvertsel++; + } } } else if (obedit->type == OB_LATTICE) { @@ -288,7 +306,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats) a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw; while (a--) { stats->totvert++; - if (bp->f1 & SELECT) stats->totvertsel++; + if (bp->f1 & SELECT) { + stats->totvertsel++; + } bp++; } } @@ -302,9 +322,11 @@ static void stats_object_pose(Object *ob, SceneStats *stats) for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { stats->totbone++; - if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) - if (pchan->bone->layer & arm->layer) + if (pchan->bone && (pchan->bone->flag & BONE_SELECTED)) { + if (pchan->bone->layer & arm->layer) { stats->totbonesel++; + } + } } } } @@ -448,8 +470,9 @@ static void stats_string(ViewLayer *view_layer) } if (obedit) { - if (BKE_keyblock_from_object(obedit)) + if (BKE_keyblock_from_object(obedit)) { ofs += BLI_strncpy_rlen(s + ofs, IFACE_("(Key) "), MAX_INFO_LEN - ofs); + } if (obedit->type == OB_MESH) { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 754941a12c0..997a40839ac 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -151,8 +151,9 @@ static void info_main_region_draw(const bContext *C, ARegion *ar) GPU_clear(GPU_COLOR_BIT); /* quick way to avoid drawing if not bug enough */ - if (ar->winy < 16) + if (ar->winy < 16) { return; + } info_textview_update_rect(C, ar); @@ -241,20 +242,24 @@ static void info_header_listener( } break; case NC_WM: - if (wmn->data == ND_JOB) + if (wmn->data == ND_JOB) { ED_region_tag_redraw(ar); + } break; case NC_SCENE: - if (wmn->data == ND_RENDER_RESULT) + if (wmn->data == ND_RENDER_RESULT) { ED_region_tag_redraw(ar); + } break; case NC_SPACE: - if (wmn->data == ND_SPACE_INFO) + if (wmn->data == ND_SPACE_INFO) { ED_region_tag_redraw(ar); + } break; case NC_ID: - if (wmn->action == NA_RENAME) + if (wmn->action == NA_RENAME) { ED_region_tag_redraw(ar); + } break; } diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index a335d6d0bfb..7585cda5e19 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -291,11 +291,13 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous xy[0] = x_orig; xy[1] = y_orig; - if (mval[1] != INT_MAX) + if (mval[1] != INT_MAX) { mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN); + } - if (pos_pick) + if (pos_pick) { *pos_pick = 0; + } /* constants for the sequencer context */ cdc.font_id = font_id; @@ -306,8 +308,9 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous /* note, scroll bar must be already subtracted () */ cdc.console_width = (tvc->winx - (CONSOLE_DRAW_MARGIN * 2)) / cdc.cwidth; /* avoid divide by zero on small windows */ - if (cdc.console_width < 1) + if (cdc.console_width < 1) { cdc.console_width = 1; + } cdc.winx = tvc->winx - CONSOLE_DRAW_MARGIN; cdc.ymin = tvc->ymin; cdc.ymax = tvc->ymax; @@ -341,8 +344,9 @@ int textview_draw(TextViewContext *tvc, const int draw, int mval[2], void **mous y_prev = xy[1]; - if (draw) + if (draw) { color_flag = tvc->line_color(tvc, fg, bg); + } tvc->line_get(tvc, &ext_line, &ext_len); -- cgit v1.2.3