Cleanup: use braces for interface code
authorCampbell Barton <ideasman42@gmail.com>
Sun, 24 Mar 2019 23:15:20 +0000 (10:15 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Mar 2019 00:16:46 +0000 (11:16 +1100)
28 files changed:
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_align.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/interface/interface_context_menu.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_eyedropper.c
source/blender/editors/interface/interface_eyedropper_driver.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_ops.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_query.c
source/blender/editors/interface/interface_region_color_picker.c
source/blender/editors/interface/interface_region_menu_pie.c
source/blender/editors/interface/interface_region_menu_popup.c
source/blender/editors/interface/interface_region_popover.c
source/blender/editors/interface/interface_region_popup.c
source/blender/editors/interface/interface_region_search.c
source/blender/editors/interface/interface_region_tooltip.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c

index c4a81b5..48a3e08 100644 (file)
@@ -88,7 +88,10 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
 
 /* avoid unneeded calls to ui_but_value_get */
 #define UI_BUT_VALUE_UNSET DBL_MAX
-#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) {  (_value) = ui_but_value_get(_but); } (void)0
+#define UI_GET_BUT_VALUE_INIT(_but, _value) \
+       if (_value == DBL_MAX) { \
+               (_value) = ui_but_value_get(_but); \
+       } ((void)0)
 
 #define B_NOP -1
 
@@ -345,8 +348,9 @@ static void ui_block_bounds_calc_text(uiBlock *block, float offset)
                if (!ELEM(bt->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER)) {
                        j = BLF_width(style->widget.uifont_id, bt->drawstr, sizeof(bt->drawstr));
 
-                       if (j > i)
+                       if (j > i) {
                                i = j;
+                       }
                }
 
                if (bt->next && bt->rect.xmin < bt->next->rect.xmin) {
@@ -403,8 +407,12 @@ void ui_block_bounds_calc(uiBlock *block)
 
        /* hardcoded exception... but that one is annoying with larger safety */
        bt = block->buttons.first;
-       if (bt && STREQLEN(bt->str, "ERROR", 5)) xof = 10;
-       else xof = 40;
+       if (bt && STREQLEN(bt->str, "ERROR", 5)) {
+               xof = 10;
+       }
+       else {
+               xof = 40;
+       }
 
        block->safety.xmin = block->rect.xmin - xof;
        block->safety.ymin = block->rect.ymin - xof;
@@ -523,8 +531,9 @@ static void ui_block_bounds_calc_popup(
 /* used for various cases */
 void UI_block_bounds_set_normal(uiBlock *block, int addval)
 {
-       if (block == NULL)
+       if (block == NULL) {
                return;
+       }
 
        block->bounds = addval;
        block->bounds_type = UI_BLOCK_BOUNDS;
@@ -610,16 +619,16 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
 {
        /* various properties are being compared here, hopefully sufficient
         * to catch all cases, but it is simple to add more checks later */
-       if (but->retval != oldbut->retval) return false;
-       if (but->rnapoin.data != oldbut->rnapoin.data) return false;
-       if (but->rnaprop != oldbut->rnaprop || but->rnaindex != oldbut->rnaindex) return false;
-       if (but->func != oldbut->func) return false;
-       if (but->funcN != oldbut->funcN) return false;
-       if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return false;
-       if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return false;
+       if (but->retval != oldbut->retval) { return false; }
+       if (but->rnapoin.data != oldbut->rnapoin.data) { return false; }
+       if (but->rnaprop != oldbut->rnaprop || but->rnaindex != oldbut->rnaindex) { return false; }
+       if (but->func != oldbut->func) { return false; }
+       if (but->funcN != oldbut->funcN) { return false; }
+       if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) { return false; }
+       if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) { return false; }
        if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) ||
-                           (but->pointype != oldbut->pointype))) return false;
-       if (but->optype != oldbut->optype) return false;
+                           (but->pointype != oldbut->pointype))) { return false; }
+       if (but->optype != oldbut->optype) { return false; }
 
        return true;
 }
@@ -888,8 +897,9 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
        int tot_missing = 0;
 
        /* only do it before bounding */
-       if (block->rect.xmin != block->rect.xmax)
+       if (block->rect.xmin != block->rect.xmax) {
                return;
+       }
 
        for (pass = 0; pass < 2; pass++) {
                /* 2 Passes, on for first letter only, second for any letter if first fails
@@ -916,11 +926,13 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 
                                                if (pass == 0) {
                                                        /* Skip to next delimiter on first pass (be picky) */
-                                                       while (isalpha(*str_pt))
+                                                       while (isalpha(*str_pt)) {
                                                                str_pt++;
+                                                       }
 
-                                                       if (*str_pt)
+                                                       if (*str_pt) {
                                                                str_pt++;
+                                                       }
                                                }
                                                else {
                                                        /* just step over every char second pass and find first usable key */
@@ -1402,8 +1414,9 @@ void UI_block_update_from_old(const bContext *C, uiBlock *block)
        uiBut *but_old;
        uiBut *but;
 
-       if (!block->oldblock)
+       if (!block->oldblock) {
                return;
+       }
 
        but_old = block->oldblock->buttons.first;
 
@@ -1450,15 +1463,17 @@ void UI_block_end_ex(const bContext *C, uiBlock *block, const int xy[2], int r_x
                if (but->optype) {
                        wmOperatorType *ot = but->optype;
 
-                       if (but->context)
+                       if (but->context) {
                                CTX_store_set((bContext *)C, but->context);
+                       }
 
                        if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) {
                                but->flag |= UI_BUT_DISABLED;
                        }
 
-                       if (but->context)
+                       if (but->context) {
                                CTX_store_set((bContext *)C, NULL);
+                       }
                }
 
                ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
@@ -1538,10 +1553,12 @@ void ui_fontscale(short *points, float aspect)
                //aspect = sqrt(aspect);
                pointsf /= aspect;
 
-               if (aspect > 1.0f)
+               if (aspect > 1.0f) {
                        *points = ceilf(pointsf);
-               else
+               }
+               else {
                        *points = floorf(pointsf);
+               }
        }
 }
 
@@ -1565,11 +1582,13 @@ void UI_block_draw(const bContext *C, uiBlock *block)
 
        /* get menu region or area region */
        ar = CTX_wm_menu(C);
-       if (!ar)
+       if (!ar) {
                ar = CTX_wm_region(C);
+       }
 
-       if (!block->endblock)
+       if (!block->endblock) {
                UI_block_end(C, block);
+       }
 
        /* we set this only once */
        GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
@@ -1591,12 +1610,15 @@ void UI_block_draw(const bContext *C, uiBlock *block)
        wmOrtho2_region_pixelspace(ar);
 
        /* back */
-       if (block->flag & UI_BLOCK_RADIAL)
+       if (block->flag & UI_BLOCK_RADIAL) {
                ui_draw_pie_center(block);
-       else if (block->flag & UI_BLOCK_POPOVER)
+       }
+       else if (block->flag & UI_BLOCK_POPOVER) {
                ui_draw_popover_back(ar, &style, block, &rect);
-       else if (block->flag & UI_BLOCK_LOOP)
+       }
+       else if (block->flag & UI_BLOCK_LOOP) {
                ui_draw_menu_back(&style, block, &rect);
+       }
        else if (block->panel) {
                bool show_background = ar->alignment != RGN_ALIGN_FLOAT;
                ui_draw_aligned_panel(
@@ -1615,8 +1637,9 @@ void UI_block_draw(const bContext *C, uiBlock *block)
 
                        /* XXX: figure out why invalid coordinates happen when closing render window */
                        /* and material preview is redrawn in main window (temp fix for bug #23848) */
-                       if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
+                       if (rect.xmin < rect.xmax && rect.ymin < rect.ymax) {
                                ui_draw_but(C, ar, &style, but, &rect);
+                       }
                }
        }
 
@@ -1699,13 +1722,17 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
                        case UI_BTYPE_ICON_TOGGLE:
                        case UI_BTYPE_CHECKBOX:
                                UI_GET_BUT_VALUE_INIT(but, *value);
-                               if (*value != (double)but->hardmin) is_push = true;
+                               if (*value != (double)but->hardmin) {
+                                       is_push = true;
+                               }
                                break;
                        case UI_BTYPE_ICON_TOGGLE_N:
                        case UI_BTYPE_TOGGLE_N:
                        case UI_BTYPE_CHECKBOX_N:
                                UI_GET_BUT_VALUE_INIT(but, *value);
-                               if (*value == 0.0) is_push = true;
+                               if (*value == 0.0) {
+                                       is_push = true;
+                               }
                                break;
                        case UI_BTYPE_ROW:
                        case UI_BTYPE_LISTROW:
@@ -1728,10 +1755,14 @@ int ui_but_is_pushed_ex(uiBut *but, double *value)
                                UI_GET_BUT_VALUE_INIT(but, *value);
                                /* support for rna enum buts */
                                if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
-                                       if ((int)*value & (int)but->hardmax) is_push = true;
+                                       if ((int)*value & (int)but->hardmax) {
+                                               is_push = true;
+                                       }
                                }
                                else {
-                                       if (*value == (double)but->hardmax) is_push = true;
+                                       if (*value == (double)but->hardmax) {
+                                               is_push = true;
+                                       }
                                }
                                break;
                        default:
@@ -1945,25 +1976,30 @@ void ui_but_v3_set(uiBut *but, const float vec[3])
 
 bool ui_but_is_float(const uiBut *but)
 {
-       if (but->pointype == UI_BUT_POIN_FLOAT && but->poin)
+       if (but->pointype == UI_BUT_POIN_FLOAT && but->poin) {
                return true;
+       }
 
-       if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
+       if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT) {
                return true;
+       }
 
        return false;
 }
 
 bool ui_but_is_bool(const uiBut *but)
 {
-       if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_TAB))
+       if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_TAB)) {
                return true;
+       }
 
-       if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN)
+       if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_BOOLEAN) {
                return true;
+       }
 
-       if ((but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) && (but->type == UI_BTYPE_ROW))
+       if ((but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) && (but->type == UI_BTYPE_ROW)) {
                return true;
+       }
 
        return false;
 }
@@ -1974,17 +2010,20 @@ bool ui_but_is_unit(const uiBut *but)
        UnitSettings *unit = but->block->unit;
        const int unit_type = UI_but_unit_type_get(but);
 
-       if (unit_type == PROP_UNIT_NONE)
+       if (unit_type == PROP_UNIT_NONE) {
                return false;
+       }
 
 #if 1 /* removed so angle buttons get correct snapping */
-       if (ui_but_is_unit_radians_ex(unit, unit_type))
+       if (ui_but_is_unit_radians_ex(unit, unit_type)) {
                return false;
+       }
 #endif
 
        /* for now disable time unit conversion */
-       if (unit_type == PROP_UNIT_TIME)
+       if (unit_type == PROP_UNIT_TIME) {
                return false;
+       }
 
        if (unit->system == USER_UNIT_NONE) {
                if (unit_type != PROP_UNIT_ROTATION) {
@@ -2000,20 +2039,25 @@ bool ui_but_is_unit(const uiBut *but)
  */
 bool ui_but_is_compatible(const uiBut *but_a, const uiBut *but_b)
 {
-       if (but_a->type != but_b->type)
+       if (but_a->type != but_b->type) {
                return false;
-       if (but_a->pointype != but_b->pointype)
+       }
+       if (but_a->pointype != but_b->pointype) {
                return false;
+       }
 
        if (but_a->rnaprop) {
                /* skip 'rnapoin.data', 'rnapoin.id.data'
                 * allow different data to have the same props edited at once */
-               if (but_a->rnapoin.type != but_b->rnapoin.type)
+               if (but_a->rnapoin.type != but_b->rnapoin.type) {
                        return false;
-               if (RNA_property_type(but_a->rnaprop) != RNA_property_type(but_b->rnaprop))
+               }
+               if (RNA_property_type(but_a->rnaprop) != RNA_property_type(but_b->rnaprop)) {
                        return false;
-               if (RNA_property_subtype(but_a->rnaprop) != RNA_property_subtype(but_b->rnaprop))
+               }
+               if (RNA_property_subtype(but_a->rnaprop) != RNA_property_subtype(but_b->rnaprop)) {
                        return false;
+               }
        }
 
        return true;
@@ -2046,8 +2090,12 @@ double ui_but_value_get(uiBut *but)
        PropertyRNA *prop;
        double value = 0.0;
 
-       if (but->editval) { return *(but->editval); }
-       if (but->poin == NULL && but->rnapoin.data == NULL) return 0.0;
+       if (but->editval) {
+               return *(but->editval);
+       }
+       if (but->poin == NULL && but->rnapoin.data == NULL) {
+               return 0.0;
+       }
 
        if (but->rnaprop) {
                prop = but->rnaprop;
@@ -2058,22 +2106,28 @@ double ui_but_value_get(uiBut *but)
 
                switch (RNA_property_type(prop)) {
                        case PROP_BOOLEAN:
-                               if (RNA_property_array_check(prop))
+                               if (RNA_property_array_check(prop)) {
                                        value = RNA_property_boolean_get_index(&rnapoin_eval, prop, but->rnaindex);
-                               else
+                               }
+                               else {
                                        value = RNA_property_boolean_get(&rnapoin_eval, prop);
+                               }
                                break;
                        case PROP_INT:
-                               if (RNA_property_array_check(prop))
+                               if (RNA_property_array_check(prop)) {
                                        value = RNA_property_int_get_index(&rnapoin_eval, prop, but->rnaindex);
-                               else
+                               }
+                               else {
                                        value = RNA_property_int_get(&rnapoin_eval, prop);
+                               }
                                break;
                        case PROP_FLOAT:
-                               if (RNA_property_array_check(prop))
+                               if (RNA_property_array_check(prop)) {
                                        value = RNA_property_float_get_index(&rnapoin_eval, prop, but->rnaindex);
-                               else
+                               }
+                               else {
                                        value = RNA_property_float_get(&rnapoin_eval, prop);
+                               }
                                break;
                        case PROP_ENUM:
                                value = RNA_property_enum_get(&rnapoin_eval, prop);
@@ -2110,22 +2164,28 @@ void ui_but_value_set(uiBut *but, double value)
                if (RNA_property_editable(&but->rnapoin, prop)) {
                        switch (RNA_property_type(prop)) {
                                case PROP_BOOLEAN:
-                                       if (RNA_property_array_check(prop))
+                                       if (RNA_property_array_check(prop)) {
                                                RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
-                                       else
+                                       }
+                                       else {
                                                RNA_property_boolean_set(&but->rnapoin, prop, value);
+                                       }
                                        break;
                                case PROP_INT:
-                                       if (RNA_property_array_check(prop))
+                                       if (RNA_property_array_check(prop)) {
                                                RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
-                                       else
+                                       }
+                                       else {
                                                RNA_property_int_set(&but->rnapoin, prop, (int)value);
+                                       }
                                        break;
                                case PROP_FLOAT:
-                                       if (RNA_property_array_check(prop))
+                                       if (RNA_property_array_check(prop)) {
                                                RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
-                                       else
+                                       }
+                                       else {
                                                RNA_property_float_set(&but->rnapoin, prop, value);
+                                       }
                                        break;
                                case PROP_ENUM:
                                        if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
@@ -2163,21 +2223,29 @@ void ui_but_value_set(uiBut *but, double value)
                }
                else if (but->pointype == UI_BUT_POIN_FLOAT) {
                        float fval = (float)value;
-                       if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f;  /* prevent negative zero */
+                       if (fval >= -0.00001f && fval <= 0.00001f) {
+                               /* prevent negative zero */
+                               fval = 0.0f;
+                       }
                        value = fval;
                }
 
                /* then set value with possible edit override */
-               if (but->editval)
+               if (but->editval) {
                        value = *but->editval = value;
-               else if (but->pointype == UI_BUT_POIN_CHAR)
+               }
+               else if (but->pointype == UI_BUT_POIN_CHAR) {
                        value = *((char *)but->poin) = (char)value;
-               else if (but->pointype == UI_BUT_POIN_SHORT)
+               }
+               else if (but->pointype == UI_BUT_POIN_SHORT) {
                        value = *((short *)but->poin) = (short)value;
-               else if (but->pointype == UI_BUT_POIN_INT)
+               }
+               else if (but->pointype == UI_BUT_POIN_INT) {
                        value = *((int *)but->poin) = (int)value;
-               else if (but->pointype == UI_BUT_POIN_FLOAT)
+               }
+               else if (but->pointype == UI_BUT_POIN_FLOAT) {
                        value = *((float *)but->poin) = (float)value;
+               }
        }
 
        ui_but_update_select_flag(but, &value);
@@ -2185,10 +2253,12 @@ void ui_but_value_set(uiBut *but, double value)
 
 int ui_but_string_get_max_length(uiBut *but)
 {
-       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU))
+       if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
                return but->hardmax;
-       else
+       }
+       else {
                return UI_MAX_DRAW_STR;
+       }
 }
 
 uiBut *ui_but_drag_multi_edit_get(uiBut *but)
@@ -2313,14 +2383,20 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
        int unit_type = UI_but_unit_type_get(but);
        int precision;
 
-       if (unit->scale_length < 0.0001f) unit->scale_length = 1.0f;  // XXX do_versions
+       if (unit->scale_length < 0.0001f) {
+               unit->scale_length = 1.0f;  // XXX do_versions
+       }
 
        /* Use precision override? */
        if (float_precision == -1) {
                /* Sanity checks */
                precision = (int)but->a2;
-               if      (precision > UI_PRECISION_FLOAT_MAX) precision = UI_PRECISION_FLOAT_MAX;
-               else if (precision == -1)                    precision = 2;
+               if (precision > UI_PRECISION_FLOAT_MAX) {
+                       precision = UI_PRECISION_FLOAT_MAX;
+               }
+               else if (precision == -1) {
+                       precision = 2;
+               }
        }
        else {
                precision = float_precision;
@@ -2776,8 +2852,8 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str)
                }
 
                /* not that we use hard limits here */
-               if (value < (double)but->hardmin) value = but->hardmin;
-               if (value > (double)but->hardmax) value = but->hardmax;
+               if (value < (double)but->hardmin) { value = but->hardmin; }
+               if (value > (double)but->hardmax) { value = but->hardmax; }
 
                ui_but_value_set(but, value);
                return true;
@@ -2810,12 +2886,15 @@ static double soft_range_round_up(double value, double max)
         * checking for 0.0 prevents floating point exceptions */
        double newmax = (value != 0.0) ? pow(10.0, ceil(log(value) / M_LN10)) : 0.0;
 
-       if (newmax * 0.2 >= max && newmax * 0.2 >= value)
+       if (newmax * 0.2 >= max && newmax * 0.2 >= value) {
                return newmax * 0.2;
-       else if (newmax * 0.5 >= max && newmax * 0.5 >= value)
+       }
+       else if (newmax * 0.5 >= max && newmax * 0.5 >= value) {
                return newmax * 0.5;
-       else
+       }
+       else {
                return newmax;
+       }
 }
 
 static double soft_range_round_down(double value, double max)
@@ -2824,12 +2903,15 @@ static double soft_range_round_down(double value, double max)
         * checking for 0.0 prevents floating point exceptions */
        double newmax = (value != 0.0) ? pow(10.0, floor(log(value) / M_LN10)) : 0.0;
 
-       if (newmax * 5.0 <= max && newmax * 5.0 <= value)
+       if (newmax * 5.0 <= max && newmax * 5.0 <= value) {
                return newmax * 5.0;
-       else if (newmax * 2.0 <= max && newmax * 2.0 <= value)
+       }
+       else if (newmax * 2.0 <= max && newmax * 2.0 <= value) {
                return newmax * 2.0;
-       else
+       }
+       else {
                return newmax;
+       }
 }
 
 /* note: this could be split up into functions which handle arrays and not */
@@ -2893,22 +2975,28 @@ static void ui_set_but_soft_range(uiBut *but)
 
                /* if the value goes out of the soft/max range, adapt the range */
                if (value_min + 1e-10 < softmin) {
-                       if (value_min < 0.0)
+                       if (value_min < 0.0) {
                                softmin = -soft_range_round_up(-value_min, -softmin);
-                       else
+                       }
+                       else {
                                softmin = soft_range_round_down(value_min, softmin);
+                       }
 
-                       if (softmin < (double)but->hardmin)
+                       if (softmin < (double)but->hardmin) {
                                softmin = (double)but->hardmin;
+                       }
                }
                if (value_max - 1e-10 > softmax) {
-                       if (value_max < 0.0)
+                       if (value_max < 0.0) {
                                softmax = -soft_range_round_down(-value_max, -softmax);
-                       else
+                       }
+                       else {
                                softmax = soft_range_round_up(value_max, softmax);
+                       }
 
-                       if (softmax > (double)but->hardmax)
+                       if (softmax > (double)but->hardmax) {
                                softmax = but->hardmax;
+                       }
                }
 
                but->softmin = softmin;
@@ -3053,8 +3141,9 @@ void UI_blocklist_free_inactive(const bContext *C, ListBase *lb)
                                BLI_remlink(lb, block);
                                UI_block_free(C, block);
                        }
-                       else
+                       else {
                                block->active = 0;
+                       }
                }
        }
 }
@@ -3114,8 +3203,9 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, sh
 
        BLI_strncpy(block->name, name, sizeof(block->name));
 
-       if (region)
+       if (region) {
                UI_block_region_set(block, region);
+       }
 
        /* Set window matrix and aspect for region and OpenGL state. */
        ui_update_window_matrix(window, region, block);
@@ -3348,14 +3438,18 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
                                        char *str = but->drawstr;
                                        but->drawstr[0] = '\0';
 
-                                       if (but->modifier_key & KM_SHIFT)
+                                       if (but->modifier_key & KM_SHIFT) {
                                                str += BLI_strcpy_rlen(str, "Shift ");
-                                       if (but->modifier_key & KM_CTRL)
+                                       }
+                                       if (but->modifier_key & KM_CTRL) {
                                                str += BLI_strcpy_rlen(str, "Ctrl ");
-                                       if (but->modifier_key & KM_ALT)
+                                       }
+                                       if (but->modifier_key & KM_ALT) {
                                                str += BLI_strcpy_rlen(str, "Alt ");
-                                       if (but->modifier_key & KM_OSKEY)
+                                       }
+                                       if (but->modifier_key & KM_OSKEY) {
                                                str += BLI_strcpy_rlen(str, "Cmd ");
+                                       }
 
                                        (void)str; /* UNUSED */
                                }
@@ -3363,8 +3457,9 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
                                        BLI_strncpy(but->drawstr, "Press a key", UI_MAX_DRAW_STR);
                                }
                        }
-                       else
+                       else {
                                BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+                       }
 
                        break;
 
@@ -3378,8 +3473,9 @@ static void ui_but_update_ex(uiBut *but, const bool validate)
        }
 
        /* if we are doing text editing, this will override the drawstr */
-       if (but->editstr)
+       if (but->editstr) {
                but->drawstr[0] = '\0';
+       }
 
        /* text clipping moved to widget drawing code itself */
 }
@@ -3397,7 +3493,9 @@ void ui_but_update_edited(uiBut *but)
 void UI_block_align_begin(uiBlock *block)
 {
        /* if other align was active, end it */
-       if (block->flag & UI_BUT_ALIGN) UI_block_align_end(block);
+       if (block->flag & UI_BUT_ALIGN) {
+               UI_block_align_end(block);
+       }
 
        block->flag |= UI_BUT_ALIGN_DOWN;
        block->alignnr++;
@@ -3497,16 +3595,18 @@ static uiBut *ui_def_but(
 
        but->block = block;  /* pointer back, used for frontbuffer status, and picker */
 
-       if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
+       if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but)) {
                but->alignnr = block->alignnr;
+       }
 
        but->func = block->func;
        but->func_arg1 = block->func_arg1;
        but->func_arg2 = block->func_arg2;
 
        but->funcN = block->funcN;
-       if (block->func_argN)
+       if (block->func_argN) {
                but->func_argN = MEM_dupallocN(block->func_argN);
+       }
 
        but->pos = -1;   /* cursor invisible */
 
@@ -3565,8 +3665,9 @@ static uiBut *ui_def_but(
 
        BLI_addtail(&block->buttons, but);
 
-       if (block->curlayout)
+       if (block->curlayout) {
                ui_layout_add_but(block->curlayout, but);
+       }
 
 #ifdef WITH_PYTHON
        /* if the 'UI_OT_editsource' is running, extract the source info from the button  */
@@ -3637,16 +3738,20 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
 
        /* Columns and row estimation. Ignore simple separators here. */
        columns = (nbr_entries_nosepr + 20) / 20;
-       if (columns < 1)
+       if (columns < 1) {
                columns = 1;
-       if (columns > 8)
+       }
+       if (columns > 8) {
                columns = (nbr_entries_nosepr + 25) / 25;
+       }
 
        rows = totitems / columns;
-       if (rows < 1)
+       if (rows < 1) {
                rows = 1;
-       while (rows * columns < totitems)
+       }
+       while (rows * columns < totitems) {
                rows++;
+       }
 
        if (block->flag & UI_BLOCK_NO_FLIP) {
                /* Title at the top for menus with categories. */
@@ -3810,8 +3915,9 @@ static uiBut *ui_def_but_rna(
                icon = RNA_property_ui_icon(prop);
        }
 
-       if (!tip && proptype != PROP_ENUM)
+       if (!tip && proptype != PROP_ENUM) {
                tip = RNA_property_ui_description(prop);
+       }
 
        if (min == max || a1 == -1 || a2 == -1) {
                if (proptype == PROP_INT) {
@@ -3824,10 +3930,12 @@ static uiBut *ui_def_but_rna(
                                min = hardmin;
                                max = hardmax;
                        }
-                       if (a1 == -1)
+                       if (a1 == -1) {
                                a1 = step;
-                       if (a2 == -1)
+                       }
+                       if (a2 == -1) {
                                a2 = 0;
+                       }
                }
                else if (proptype == PROP_FLOAT) {
                        float hardmin, hardmax, softmin, softmax, step, precision;
@@ -3839,10 +3947,12 @@ static uiBut *ui_def_but_rna(
                                min = hardmin;
                                max = hardmax;
                        }
-                       if (a1 == -1)
+                       if (a1 == -1) {
                                a1 = step;
-                       if (a2 == -1)
+                       }
+                       if (a2 == -1) {
                                a2 = precision;
+                       }
                }
                else if (proptype == PROP_STRING) {
                        min = 0;
@@ -3857,10 +3967,12 @@ static uiBut *ui_def_but_rna(
        but->rnapoin = *ptr;
        but->rnaprop = prop;
 
-       if (RNA_property_array_check(but->rnaprop))
+       if (RNA_property_array_check(but->rnaprop)) {
                but->rnaindex = index;
-       else
+       }
+       else {
                but->rnaindex = 0;
+       }
 
        if (icon) {
                ui_def_but_icon(but, icon, UI_HAS_ICON);
@@ -3922,10 +4034,12 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
        uiBut *but;
 
        if (!str) {
-               if (ot && ot->srna)
+               if (ot && ot->srna) {
                        str = RNA_struct_ui_name(ot->srna);
-               else
+               }
+               else {
                        str = "";
+               }
        }
 
        if ((!tip || tip[0] == '\0') && ot && ot->srna) {
@@ -4009,15 +4123,17 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
        int a;
 
        for (a = 0; a < autocpl->maxlen - 1; a++) {
-               if (startname[a] == 0 || startname[a] != name[a])
+               if (startname[a] == 0 || startname[a] != name[a]) {
                        break;
+               }
        }
        /* found a match */
        if (startname[a] == 0) {
                autocpl->matches++;
                /* first match */
-               if (truncate[0] == 0)
+               if (truncate[0] == 0) {
                        BLI_strncpy(truncate, name, autocpl->maxlen);
+               }
                else {
                        /* remove from truncate what is not in bone->name */
                        for (a = 0; a < autocpl->maxlen - 1; a++) {
@@ -4025,8 +4141,9 @@ void UI_autocomplete_update_name(AutoComplete *autocpl, const char *name)
                                        truncate[a] = 0;
                                        break;
                                }
-                               else if (truncate[a] != name[a])
+                               else if (truncate[a] != name[a]) {
                                        truncate[a] = 0;
+                               }
                        }
                }
        }
@@ -4131,7 +4248,9 @@ uiBut *uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext
 uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
 {
        wmOperatorType *ot = WM_operatortype_find(opname, 0);
-       if (str == NULL && ot == NULL) str = opname;
+       if (str == NULL && ot == NULL) {
+               str = opname;
+       }
        return uiDefButO_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
 }
 
@@ -4291,8 +4410,9 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int o
 uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
 {
        wmOperatorType *ot = WM_operatortype_find(opname, 0);
-       if (str && str[0] == '\0')
+       if (str && str[0] == '\0') {
                return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip);
+       }
        return uiDefIconTextButO_ptr(block, type, ot, opcontext, icon, str, x, y, width, height, tip);
 }
 
@@ -4305,9 +4425,11 @@ int UI_blocklist_min_y_get(ListBase *lb)
        uiBlock *block;
        int min = 0;
 
-       for (block = lb->first; block; block = block->next)
-               if (block == lb->first || block->rect.ymin < min)
+       for (block = lb->first; block; block = block->next) {
+               if (block == lb->first || block->rect.ymin < min) {
                        min = block->rect.ymin;
+               }
+       }
 
        return min;
 }
@@ -4323,15 +4445,23 @@ void UI_block_order_flip(uiBlock *block)
        uiBut *but;
        float centy, miny = 10000, maxy = -10000;
 
-       if (U.uiflag & USER_MENUFIXEDORDER)
+       if (U.uiflag & USER_MENUFIXEDORDER) {
                return;
-       else if (block->flag & UI_BLOCK_NO_FLIP)
+       }
+       else if (block->flag & UI_BLOCK_NO_FLIP) {
                return;
+       }
 
        for (but = block->buttons.first; but; but = but->next) {
-               if (but->drawflag & UI_BUT_ALIGN) return;
-               if (but->rect.ymin < miny) miny = but->rect.ymin;
-               if (but->rect.ymax > maxy) maxy = but->rect.ymax;
+               if (but->drawflag & UI_BUT_ALIGN) {
+                       return;
+               }
+               if (but->rect.ymin < miny) {
+                       miny = but->rect.ymin;
+               }
+               if (but->rect.ymax > maxy) {
+                       maxy = but->rect.ymax;
+               }
        }
        /* mirror trick */
        centy = (miny + maxy) / 2.0f;
@@ -4748,8 +4878,9 @@ void UI_but_func_search_set(
        /* search buttons show red-alert if item doesn't exist, not for menus */
        if (0 == (but->block->flag & UI_BLOCK_LOOP)) {
                /* skip empty buttons, not all buttons need input, we only show invalid */
-               if (but->drawstr[0])
+               if (but->drawstr[0]) {
                        ui_but_search_refresh(but);
+               }
        }
 }
 
@@ -4778,8 +4909,9 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c
                        /* note: need to give the index rather than the
                         * identifier because the enum can be freed */
                        if (BLI_strcasestr(item->name, str)) {
-                               if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon))
+                               if (false == UI_search_item_add(items, item->name, POINTER_FROM_INT(item->value), item->icon)) {
                                        break;
+                               }
                        }
                }
 
@@ -4898,21 +5030,26 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
                        if (but->tip_func) {
                                tmp = but->tip_func(C, but->tip_argN, but->tip);
                        }
-                       else if (but->tip && but->tip[0])
+                       else if (but->tip && but->tip[0]) {
                                tmp = BLI_strdup(but->tip);
-                       else
+                       }
+                       else {
                                type = BUT_GET_RNA_TIP;  /* Fail-safe solution... */
+                       }
                }
 
                if (type == BUT_GET_RNAPROP_IDENTIFIER) {
-                       if (but->rnaprop)
+                       if (but->rnaprop) {
                                tmp = BLI_strdup(RNA_property_identifier(but->rnaprop));
+                       }
                }
                else if (type == BUT_GET_RNASTRUCT_IDENTIFIER) {
-                       if (but->rnaprop && but->rnapoin.data)
+                       if (but->rnaprop && but->rnapoin.data) {
                                tmp = BLI_strdup(RNA_struct_identifier(but->rnapoin.type));
-                       else if (but->optype)
+                       }
+                       else if (but->optype) {
                                tmp = BLI_strdup(but->optype->idname);
+                       }
                        else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) {
                                MenuType *mt = UI_but_menutype_get(but);
                                if (mt) {
@@ -4928,21 +5065,25 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
                }
                else if (ELEM(type, BUT_GET_RNA_LABEL, BUT_GET_RNA_TIP)) {
                        if (but->rnaprop) {
-                               if (type == BUT_GET_RNA_LABEL)
+                               if (type == BUT_GET_RNA_LABEL) {
                                        tmp = BLI_strdup(RNA_property_ui_name(but->rnaprop));
+                               }
                                else {
                                        const char *t = RNA_property_ui_description(but->rnaprop);
-                                       if (t && t[0])
+                                       if (t && t[0]) {
                                                tmp = BLI_strdup(t);
+                                       }
                                }
                        }
                        else if (but->optype) {
-                               if (type == BUT_GET_RNA_LABEL)
+                               if (type == BUT_GET_RNA_LABEL) {
                                        tmp = BLI_strdup(RNA_struct_ui_name(but->optype->srna));
+                               }
                                else {
                                        const char *t = RNA_struct_ui_description(but->optype->srna);
-                                       if (t && t[0])
+                                       if (t && t[0]) {
                                                tmp = BLI_strdup(t);
+                                       }
                                }
                        }
                        else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) {
@@ -4950,12 +5091,14 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
                                if (mt) {
                                        /* not all menus are from python */
                                        if (mt->ext.srna) {
-                                               if (type == BUT_GET_RNA_LABEL)
+                                               if (type == BUT_GET_RNA_LABEL) {
                                                        tmp = BLI_strdup(RNA_struct_ui_name(mt->ext.srna));
+                                               }
                                                else {
                                                        const char *t = RNA_struct_ui_description(mt->ext.srna);
-                                                       if (t && t[0])
+                                                       if (t && t[0]) {
                                                                tmp = BLI_strdup(t);
+                                                       }
                                                }
                                        }
                                }
@@ -4963,14 +5106,17 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
                }
                else if (type == BUT_GET_RNA_LABEL_CONTEXT) {
                        const char *_tmp = BLT_I18NCONTEXT_DEFAULT;
-                       if (but->rnaprop)
+                       if (but->rnaprop) {
                                _tmp = RNA_property_translation_context(but->rnaprop);
-                       else if (but->optype)
+                       }
+                       else if (but->optype) {
                                _tmp = RNA_struct_translation_context(but->optype->srna);
+                       }
                        else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) {
                                MenuType *mt = UI_but_menutype_get(but);
-                               if (mt)
+                               if (mt) {
                                        _tmp = RNA_struct_translation_context(mt->ext.srna);
+                               }
                        }
                        if (BLT_is_default_context(_tmp)) {
                                _tmp = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
@@ -5017,17 +5163,21 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
 
                                        RNA_property_enum_items_gettexted(C, ptr, prop, &items, &totitems, &free_items);
                                        for (i = 0, item = items; i < totitems; i++, item++) {
-                                               if (item->identifier[0] && item->value == value)
+                                               if (item->identifier[0] && item->value == value) {
                                                        break;
+                                               }
                                        }
                                }
                                if (item && item->identifier) {
-                                       if (type == BUT_GET_RNAENUM_IDENTIFIER)
+                                       if (type == BUT_GET_RNAENUM_IDENTIFIER) {
                                                tmp = BLI_strdup(item->identifier);
-                                       else if (type == BUT_GET_RNAENUM_LABEL)
+                                       }
+                                       else if (type == BUT_GET_RNAENUM_LABEL) {
                                                tmp = BLI_strdup(item->name);
-                                       else if (item->description && item->description[0])
+                                       }
+                                       else if (item->description && item->description[0]) {
                                                tmp = BLI_strdup(item->description);
+                                       }
                                }
                        }
                }
index 9fc8c8f..8e7dc79 100644 (file)
@@ -555,8 +555,12 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
 
        for (but = first; but && but->alignnr == nr; but = but->next) {
                if (but->next && but->next->alignnr == nr) {
-                       if (buts_are_horiz(but, but->next)) cols++;
-                       else rows++;
+                       if (buts_are_horiz(but, but->next)) {
+                               cols++;
+                       }
+                       else {
+                               rows++;
+                       }
                }
        }
 
@@ -565,8 +569,9 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
        /* note;  how it uses 'flag' in loop below (either set it, or OR it) is confusing */
        for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) {
                next = but->next;
-               if (next && next->alignnr != nr)
+               if (next && next->alignnr != nr) {
                        next = NULL;
+               }
 
                /* clear old flag */
                but->drawflag &= ~UI_BUT_ALIGN;
@@ -574,10 +579,12 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
                if (flag == 0) {  /* first case */
                        if (next) {
                                if (buts_are_horiz(but, next)) {
-                                       if (rows == 0)
+                                       if (rows == 0) {
                                                flag = UI_BUT_ALIGN_RIGHT;
-                                       else
+                                       }
+                                       else {
                                                flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT;
+                                       }
                                }
                                else {
                                        flag = UI_BUT_ALIGN_DOWN;
@@ -587,10 +594,12 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
                else if (next == NULL) {  /* last case */
                        if (prev) {
                                if (buts_are_horiz(prev, but)) {
-                                       if (rows == 0)
+                                       if (rows == 0) {
                                                flag = UI_BUT_ALIGN_LEFT;
-                                       else
+                                       }
+                                       else {
                                                flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT;
+                                       }
                                }
                                else {
                                        flag = UI_BUT_ALIGN_TOP;
@@ -611,7 +620,9 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
                                                }
                                                bt = bt->next;
                                        }
-                                       if (bt == NULL || bt->alignnr != nr) flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT;
+                                       if (bt == NULL || bt->alignnr != nr) {
+                                               flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT;
+                                       }
                                }
                        }
                        else {
@@ -624,8 +635,9 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
                        }
                        else {  /* next button switches to new row */
 
-                               if (prev && buts_are_horiz(prev, but))
+                               if (prev && buts_are_horiz(prev, but)) {
                                        flag |= UI_BUT_ALIGN_LEFT;
+                               }
                                else {
                                        flag &= ~UI_BUT_ALIGN_LEFT;
                                        flag |= UI_BUT_ALIGN_TOP;
@@ -633,18 +645,21 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
 
                                if ((flag & UI_BUT_ALIGN_TOP) == 0) {  /* still top row */
                                        if (prev) {
-                                               if (next && buts_are_horiz(but, next))
+                                               if (next && buts_are_horiz(but, next)) {
                                                        flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT;
+                                               }
                                                else {
                                                        /* last button in top row */
                                                        flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT;
                                                }
                                        }
-                                       else
+                                       else {
                                                flag |= UI_BUT_ALIGN_DOWN;
+                                       }
                                }
-                               else
+                               else {
                                        flag |= UI_BUT_ALIGN_TOP;
+                               }
                        }
                }
 
@@ -674,8 +689,9 @@ static void ui_block_align_calc_but(uiBut *first, short nr)
                                        prev->rect.ymin = but->rect.ymax;
 
                                        but->rect.xmin = prev->rect.xmin;
-                                       if (next && buts_are_horiz(but, next) == 0)
+                                       if (next && buts_are_horiz(but, next) == 0) {
                                                but->rect.xmax = prev->rect.xmax;
+                                       }
                                }
                                else {
                                        /* the previous button is not a single one in its row */
index c8a9f3b..a4476b4 100644 (file)
@@ -86,16 +86,19 @@ void ui_but_anim_flag(uiBut *but, float cfra)
                         * we need to correct the frame number to "look inside" the
                         * remapped action
                         */
-                       if (adt)
+                       if (adt) {
                                cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
+                       }
 
-                       if (fcurve_frame_has_keyframe(fcu, cfra, 0))
+                       if (fcurve_frame_has_keyframe(fcu, cfra, 0)) {
                                but->flag |= UI_BUT_ANIMATED_KEY;
+                       }
 
                        /* XXX: this feature is totally broken and useless with NLA */
                        if (adt == NULL || adt->nla_tracks.first == NULL) {
-                               if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra))
+                               if (fcurve_is_changed(but->rnapoin, but->rnaprop, fcu, cfra)) {
                                        but->drawflag |= UI_BUT_ANIMATED_CHANGED;
+                               }
                        }
                }
                else {
@@ -196,15 +199,17 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
 
        /* button must have RNA-pointer to a numeric-capable property */
        if (ELEM(NULL, but->rnapoin.data, but->rnaprop)) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("ERROR: create expression failed - button has no RNA info attached\n");
+               }
                return false;
        }
 
        if (RNA_property_array_check(but->rnaprop) != 0) {
                if (but->rnaindex == -1) {
-                       if (G.debug & G_DEBUG)
+                       if (G.debug & G_DEBUG) {
                                printf("ERROR: create expression failed - can't create expression for entire array\n");
+                       }
                        return false;
                }
        }
@@ -214,8 +219,9 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str)
         * don't allow drivers to be created for them */
        id = (ID *)but->rnapoin.id.data;
        if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("ERROR: create expression failed - invalid data-block for adding drivers (%p)\n", id);
+               }
                return false;
        }
 
@@ -262,8 +268,9 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
 
        fcu = ui_but_get_fcurve(but, NULL, &action, &driven, &special);
 
-       if (fcu == NULL)
+       if (fcu == NULL) {
                return;
+       }
 
        if (special) {
                /* NLA Strip property */
index 5c870e6..b5eb630 100644 (file)
@@ -139,8 +139,9 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
        kmi_id = kmi->id;
 
        /* copy properties, prop can be NULL for reset */
-       if (prop)
+       if (prop) {
                prop = IDP_CopyProperty(prop);
+       }
        WM_keymap_properties_reset(kmi, prop);
 
        /* update and get pointers again */
@@ -407,8 +408,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
 
                /* second slower test,
                 * saved people finding keyframe items in menus when its not possible */
-               if (is_anim)
+               if (is_anim) {
                        is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
+               }
 
                /* determine if we can key a single component of an array */
                const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0;
index da85ed2..4185339 100644 (file)
@@ -637,7 +637,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors *UN
 #else
        ImBuf *ibuf = (ImBuf *)but->poin;
 
-       if (!ibuf) return;
+       if (!ibuf) {
+               return;
+       }
 
        float facx = 1.0f;
        float facy = 1.0f;
@@ -732,8 +734,9 @@ static void histogram_draw_one(
        float color[4] = {r, g, b, alpha};
 
        /* that can happen */
-       if (res == 0)
+       if (res == 0) {
                return;
+       }
 
        GPU_line_smooth(true);
        glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE);
@@ -846,12 +849,15 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
                histogram_draw_one(1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_a, res, is_line, pos);
        }
        else {
-               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R)
+               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_R) {
                        histogram_draw_one(1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res, is_line, pos);
-               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G)
+               }
+               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_G) {
                        histogram_draw_one(0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res, is_line, pos);
-               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B)
+               }
+               if (hist->mode == HISTO_MODE_RGB || hist->mode == HISTO_MODE_B) {
                        histogram_draw_one(0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res, is_line, pos);
+               }
        }
 
        immUnbindProgram();
@@ -891,7 +897,9 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
        float colors_alpha[3][3], colorsycc_alpha[3][3];
        float min, max;
 
-       if (scopes == NULL) return;
+       if (scopes == NULL) {
+               return;
+       }
 
        rctf rect = {
                .xmin = (float)recti->xmin + 1,
@@ -900,8 +908,9 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
                .ymax = (float)recti->ymax - 1,
        };
 
-       if (scopes->wavefrm_yfac < 0.5f)
+       if (scopes->wavefrm_yfac < 0.5f) {
                scopes->wavefrm_yfac = 0.98f;
+       }
        float w = BLI_rctf_size_x(&rect) - 7;
        float h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac;
        float yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) * 0.5f;
@@ -1083,10 +1092,12 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColors
                /* min max */
                if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA ) {
                        for (int c = 0; c < 3; c++) {
-                               if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB_PARADE, SCOPES_WAVEFRM_RGB))
+                               if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB_PARADE, SCOPES_WAVEFRM_RGB)) {
                                        immUniformColor3f(colors[c][0] * 0.75f, colors[c][1] * 0.75f, colors[c][2] * 0.75f);
-                               else
+                               }
+                               else {
                                        immUniformColor3f(colorsycc[c][0] * 0.75f, colorsycc[c][1] * 0.75f, colorsycc[c][2] * 0.75f);
+                               }
                                min = yofs + scopes->minmax[c][0] * h;
                                max = yofs + scopes->minmax[c][1] * h;
                                CLAMP(min, rect.ymin, rect.ymax);
@@ -1125,11 +1136,22 @@ static void vectorscope_draw_target(uint pos, float centerx, float centery, floa
        float dangle, dampli, dangle2, dampli2;
 
        rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v, BLI_YUV_ITU_BT709);
-       if (u > 0 && v >= 0) tangle = atanf(v / u);
-       else if (u > 0 && v < 0) tangle = atanf(v / u) + 2.0f * (float)M_PI;
-       else if (u < 0) tangle = atanf(v / u) + (float)M_PI;
-       else if (u == 0 && v > 0.0f) tangle = M_PI_2;
-       else if (u == 0 && v < 0.0f) tangle = -M_PI_2;
+
+       if (u > 0 && v >= 0) {
+               tangle = atanf(v / u);
+       }
+       else if (u > 0 && v < 0) {
+               tangle = atanf(v / u) + 2.0f * (float)M_PI;
+       }
+       else if (u < 0) {
+               tangle = atanf(v / u) + (float)M_PI;
+       }
+       else if (u == 0 && v > 0.0f) {
+               tangle = M_PI_2;
+       }
+       else if (u == 0 && v < 0.0f) {
+               tangle = -M_PI_2;
+       }
        tampli = sqrtf(u * u + v * v);
 
        /* small target vary by 2.5 degree and 2.5 IRE unit */
@@ -1249,8 +1271,9 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, const uiWidgetColo
        immEnd();
 
        /* saturation points */
-       for (int i = 0; i < 6; i++)
+       for (int i = 0; i < 6; i++) {
                vectorscope_draw_target(pos, centerx, centery, diam, colors[i]);
+       }
 
        if (scopes->ok && scopes->vecscope != NULL) {
                /* pixel point cloud */
@@ -1380,16 +1403,20 @@ static void ui_draw_colorband_handle(
 
        ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
 
-       if (active)
+       if (active) {
                immUniformColor3ub(196, 196, 196);
-       else
+       }
+       else {
                immUniformColor3ub(96, 96, 96);
+       }
        ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
 
-       if (active)
+       if (active) {
                immUniformColor3ub(255, 255, 255);
-       else
+       }
+       else {
                immUniformColor3ub(128, 128, 128);
+       }
        ui_draw_colorband_handle_tri_hlight(shdr_pos, x, y1 + height - 1, (half_width - 1), (half_width - 1));
 
        immUniformColor3ub(0, 0, 0);
@@ -1414,7 +1441,9 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const
        uint pos_id, col_id;
 
        ColorBand *coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin);
-       if (coba == NULL) return;
+       if (coba == NULL) {
+               return;
+       }
 
        float x1 = rect->xmin;
        float sizex = rect->xmax - x1;
@@ -1454,8 +1483,9 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const
        for (int a = 0; a <= sizex; a++) {
                float pos = ((float)a) / sizex;
                BKE_colorband_evaluate(coba, pos, colf);
-               if (display)
+               if (display) {
                        IMB_colormanagement_scene_linear_to_display_v3(colf, display);
+               }
 
                v1[0] = v2[0] = x1 + a;
 
@@ -1473,8 +1503,9 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const
        for (int a = 0; a <= sizex; a++) {
                float pos = ((float)a) / sizex;
                BKE_colorband_evaluate(coba, pos, colf);
-               if (display)
+               if (display) {
                        IMB_colormanagement_scene_linear_to_display_v3(colf, display);
+               }
 
                v1[0] = v2[0] = x1 + a;
 
@@ -1553,10 +1584,12 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec
        /* transform to button */
        GPU_matrix_push();
 
-       if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect))
+       if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect)) {
                size = 0.5f * BLI_rcti_size_x(rect);
-       else
+       }
+       else {
                size = 0.5f * BLI_rcti_size_y(rect);
+       }
 
        GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect));
        GPU_matrix_scale_1f(size);
@@ -1592,11 +1625,15 @@ static void ui_draw_but_curve_grid(uint pos, const rcti *rect, float zoomx, floa
 {
        float dx = step * zoomx;
        float fx = rect->xmin + zoomx * (-offsx);
-       if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin));
+       if (fx > rect->xmin) {
+               fx -= dx * (floorf(fx - rect->xmin));
+       }
 
        float dy = step * zoomy;
        float fy = rect->ymin + zoomy * (-offsy);
-       if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
+       if (fy > rect->ymin) {
+               fy -= dy * (floorf(fy - rect->ymin));
+       }
 
        float line_count = (
                floorf((rect->xmax - fx) / dx) + 1.0f +
@@ -1775,12 +1812,15 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
                        immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymax);
                }
                else {
-                       if (cumap->cur == 0)
+                       if (cumap->cur == 0) {
                                immUniformColor3ub(240, 100, 100);
-                       else if (cumap->cur == 1)
+                       }
+                       else if (cumap->cur == 1) {
                                immUniformColor3ub(100, 240, 100);
-                       else
+                       }
+                       else {
                                immUniformColor3ub(100, 100, 240);
+                       }
 
                        immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymin);
                        immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymax);
@@ -1791,8 +1831,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons
 
 
 
-       if (cuma->table == NULL)
+       if (cuma->table == NULL) {
                curvemapping_changed(cumap, false);
+       }
 
        CurveMapPoint *cmp = cuma->table;
        rctf line_range;
@@ -1937,8 +1978,9 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, const uiWidgetCol
                 ((!scopes->track_preview) ||
                  (scopes->track_preview->x != width || scopes->track_preview->y != height)))
        {
-               if (scopes->track_preview)
+               if (scopes->track_preview) {
                        IMB_freeImBuf(scopes->track_preview);
+               }
 
                ImBuf *tmpibuf = BKE_tracking_sample_pattern(
                        scopes->frame_width, scopes->frame_height,
@@ -1946,13 +1988,16 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, const uiWidgetCol
                        &scopes->undist_marker, true, scopes->use_track_mask,
                        width, height, scopes->track_pos);
                if (tmpibuf) {
-                       if (tmpibuf->rect_float)
+                       if (tmpibuf->rect_float) {
                                IMB_rect_from_float(tmpibuf);
+                       }
 
-                       if (tmpibuf->rect)
+                       if (tmpibuf->rect) {
                                scopes->track_preview = tmpibuf;
-                       else
+                       }
+                       else {
                                IMB_freeImBuf(tmpibuf);
+                       }
                }
        }
 
@@ -2001,10 +2046,12 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, const uiWidgetCol
                                        float x2 = pos_sel[i + 1] * (1 - axe);
                                        float y2 = pos_sel[i + 1] * axe;
 
-                                       if (i % 2 == 1)
+                                       if (i % 2 == 1) {
                                                immAttr4fv(col, col_sel);
-                                       else
+                                       }
+                                       else {
                                                immAttr4fv(col, col_outline);
+                                       }
 
                                        immVertex2f(pos, x1, y1);
                                        immVertex2f(pos, x2, y2);
@@ -2082,16 +2129,18 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, const uiWidgetColors *UNUSE
 
        GPU_blend(true);
        immBegin(GPU_PRIM_TRI_FAN, 16);
-       for (int a = 0; a < 16; a++)
+       for (int a = 0; a < 16; a++) {
                immVertex2f(pos, x + size * si[a], y + size * co[a]);
+       }
        immEnd();
 
        immUniformColor4ub(0, 0, 0, 150);
        GPU_line_width(1);
        GPU_line_smooth(true);
        immBegin(GPU_PRIM_LINE_LOOP, 16);
-       for (int a = 0; a < 16; a++)
+       for (int a = 0; a < 16; a++) {
                immVertex2f(pos, x + size * si[a], y + size * co[a]);
+       }
        immEnd();
        GPU_line_smooth(false);
        GPU_blend(false);
@@ -2200,10 +2249,12 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
 {
        float rad;
 
-       if (radius > (BLI_rctf_size_y(rct) - 10.0f) * 0.5f)
+       if (radius > (BLI_rctf_size_y(rct) - 10.0f) * 0.5f) {
                rad = (BLI_rctf_size_y(rct) - 10.0f) * 0.5f;
-       else
+       }
+       else {
                rad = radius;
+       }
 
        int a, i = 12;
 #if 0
index f47e0bc..0f0d2c3 100644 (file)
@@ -58,8 +58,9 @@ wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf)
        wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper Modal Map");
 
        /* this function is called for each spacetype, only needs to add map once */
-       if (keymap && keymap->modal_items)
+       if (keymap && keymap->modal_items) {
                return NULL;
+       }
 
        keymap = WM_modalkeymap_add(keyconf, "Eyedropper Modal Map", modal_items);
 
@@ -84,8 +85,9 @@ wmKeyMap *eyedropper_colorband_modal_keymap(wmKeyConfig *keyconf)
        };
 
        wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Eyedropper ColorRamp PointSampling Map");
-       if (keymap && keymap->modal_items)
+       if (keymap && keymap->modal_items) {
                return keymap;
+       }
 
        keymap = WM_modalkeymap_add(keyconf, "Eyedropper ColorRamp PointSampling Map", modal_items_point);
 
index e1f3886..dd2656e 100644 (file)
@@ -134,10 +134,12 @@ static void driverdropper_sample(bContext *C, wmOperator *op, const wmEvent *eve
                }
 
                /* cleanup */
-               if (target_path)
+               if (target_path) {
                        MEM_freeN(target_path);
-               if (dst_path)
+               }
+               if (dst_path) {
                        MEM_freeN(dst_path);
+               }
        }
 }
 
@@ -207,8 +209,12 @@ static int driverdropper_exec(bContext *C, wmOperator *op)
 
 static bool driverdropper_poll(bContext *C)
 {
-       if (!CTX_wm_window(C)) return 0;
-       else return 1;
+       if (!CTX_wm_window(C)) {
+               return 0;
+       }
+       else {
+               return 1;
+       }
 }
 
 void UI_OT_eyedropper_driver(wmOperatorType *ot)
index 212a174..b79bf86 100644 (file)
@@ -440,15 +440,18 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
                lastdy += dy;
 
                if (ABS(lastdy) > (int)UI_UNIT_Y) {
-                       if (U.uiflag2 & USER_TRACKPAD_NATURAL)
+                       if (U.uiflag2 & USER_TRACKPAD_NATURAL) {
                                dy = -dy;
+                       }
 
                        *val = KM_PRESS;
 
-                       if (dy > 0)
+                       if (dy > 0) {
                                *type = WHEELUPMOUSE;
-                       else
+                       }
+                       else {
                                *type = WHEELDOWNMOUSE;
+                       }
 
                        lastdy = 0;
                }
@@ -521,8 +524,9 @@ static void ui_mouse_scale_warp(
  */
 static bool ui_but_dragedit_update_mval(uiHandleButtonData *data, int mx)
 {
-       if (mx == data->draglastx)
+       if (mx == data->draglastx) {
                return false;
+       }
 
        if (data->draglock) {
                if (ABS(mx - data->dragstartx) <= BUTTON_DRAGLOCK_THRESH) {
@@ -646,8 +650,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
                        /* exception, this will crash due to removed button otherwise */
                        but->func(C, but->func_arg1, but->func_arg2);
                }
-               else
+               else {
                        after->func = but->func;
+               }
 
                after->func_arg1 = but->func_arg1;
                after->func_arg2 = but->func_arg2;
@@ -669,8 +674,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
                        after->a2 = but->a2;
                }
 
-               if (block->handle)
+               if (block->handle) {
                        after->popup_op = block->handle->popup_op;
+               }
 
                after->optype = but->optype;
                after->opcontext = but->opcontext;
@@ -679,8 +685,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
                after->rnapoin = but->rnapoin;
                after->rnaprop = but->rnaprop;
 
-               if (but->context)
+               if (but->context) {
                        after->context = CTX_store_copy(but->context);
+               }
 
                but->optype = NULL;
                but->opcontext = 0;
@@ -697,9 +704,15 @@ static void ui_apply_but_undo(uiBut *but)
                const char *str = NULL;
 
                /* define which string to use for undo */
-               if (but->type == UI_BTYPE_MENU) str = but->drawstr;
-               else if (but->drawstr[0]) str = but->drawstr;
-               else str = but->tip;
+               if (but->type == UI_BTYPE_MENU) {
+                       str = but->drawstr;
+               }
+               else if (but->drawstr[0]) {
+                       str = but->drawstr;
+               }
+               else {
+                       str = but->tip;
+               }
 
                /* fallback, else we don't get an undo! */
                if (str == NULL || str[0] == '\0') {
@@ -751,11 +764,13 @@ static void ui_apply_but_funcs_after(bContext *C)
                after = *afterf; /* copy to avoid memleak on exit() */
                BLI_freelinkN(&funcs, afterf);
 
-               if (after.context)
+               if (after.context) {
                        CTX_store_set(C, after.context);
+               }
 
-               if (after.popup_op)
+               if (after.popup_op) {
                        popup_check(C, after.popup_op);
+               }
 
                if (after.opptr) {
                        /* free in advance to avoid leak on exit */
@@ -763,39 +778,50 @@ static void ui_apply_but_funcs_after(bContext *C)
                        MEM_freeN(after.opptr);
                }
 
-               if (after.optype)
+               if (after.optype) {
                        WM_operator_name_call_ptr(C, after.optype, after.opcontext, (after.opptr) ? &opptr : NULL);
+               }
 
-               if (after.opptr)
+               if (after.opptr) {
                        WM_operator_properties_free(&opptr);
+               }
 
-               if (after.rnapoin.data)
+               if (after.rnapoin.data) {
                        RNA_property_update(C, &after.rnapoin, after.rnaprop);
+               }
 
                if (after.context) {
                        CTX_store_set(C, NULL);
                        CTX_store_free(after.context);
                }
 
-               if (after.func)
+               if (after.func) {
                        after.func(C, after.func_arg1, after.func_arg2);
-               if (after.funcN)
+               }
+               if (after.funcN) {
                        after.funcN(C, after.func_argN, after.func_arg2);
-               if (after.func_argN)
+               }
+               if (after.func_argN) {
                        MEM_freeN(after.func_argN);
+               }
 
-               if (after.handle_func)
+               if (after.handle_func) {
                        after.handle_func(C, after.handle_func_arg, after.retval);
-               if (after.butm_func)
+               }
+               if (after.butm_func) {
                        after.butm_func(C, after.butm_func_arg, after.a2);
+               }
 
-               if (after.rename_func)
+               if (after.rename_func) {
                        after.rename_func(C, after.rename_arg1, after.rename_orig);
-               if (after.rename_orig)
+               }
+               if (after.rename_orig) {
                        MEM_freeN(after.rename_orig);
+               }
 
-               if (after.undostr[0])
+               if (after.undostr[0]) {
                        ED_undo_push(C, after.undostr);
+               }
        }
 }
 
@@ -818,8 +844,9 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
 
 static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-       if (but->type == UI_BTYPE_MENU)
+       if (but->type == UI_BTYPE_MENU) {
                ui_but_value_set(but, data->value);
+       }
 
        ui_but_update_edited(but);
        ui_apply_but_func(C, but);
@@ -837,8 +864,12 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
 
        if (but->bit) {
                w = UI_BITBUT_TEST(lvalue, but->bitnr);
-               if (w) lvalue = UI_BITBUT_CLR(lvalue, but->bitnr);
-               else   lvalue = UI_BITBUT_SET(lvalue, but->bitnr);
+               if (w) {
+                       lvalue = UI_BITBUT_CLR(lvalue, but->bitnr);
+               }
+               else {
+                       lvalue = UI_BITBUT_SET(lvalue, but->bitnr);
+               }
 
                ui_but_value_set(but, (double)lvalue);
                if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) {
@@ -847,10 +878,16 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
        }
        else {
 
-               if (value == 0.0) push = 1;
-               else push = 0;
+               if (value == 0.0) {
+                       push = 1;
+               }
+               else {
+                       push = 0;
+               }
 
-               if (ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N)) push = !push;
+               if (ELEM(but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N)) {
+                       push = !push;
+               }
                ui_but_value_set(but, (double)push);
                if (but->type == UI_BTYPE_ICON_TOGGLE || but->type == UI_BTYPE_ICON_TOGGLE_N) {
                        ui_but_update_edited(but);
@@ -884,8 +921,9 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 
 static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-       if (!data->str)
+       if (!data->str) {
                return;
+       }
 
        ui_but_string_set(C, but, data->str);
        ui_but_update_edited(but);
@@ -1466,8 +1504,9 @@ static bool ui_selectcontext_begin(
        index = but->rnaindex;
 
        /* for now don't support whole colors */
-       if (index == -1)
+       if (index == -1) {
                return false;
+       }
 
        /* if there is a valid property that is editable... */
        if (ptr.data && prop) {
@@ -1877,10 +1916,13 @@ static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
        /* if we cancel and have not applied yet, there is nothing to do,
         * otherwise we have to restore the original value again */
        if (data->cancel) {
-               if (!data->applied)
+               if (!data->applied) {
                        return;
+               }
 
-               if (data->str) MEM_freeN(data->str);
+               if (data->str) {
+                       MEM_freeN(data->str);
+               }
                data->str = data->origstr;
                data->origstr = NULL;
                data->value = data->origvalue;
@@ -1968,10 +2010,12 @@ static void ui_apply_but(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        ui_apply_but_BLOCK(C, but, data);
                        break;
                case UI_BTYPE_COLOR:
-                       if (data->cancel)
+                       if (data->cancel) {
                                ui_apply_but_VEC(C, but, data);
-                       else
+                       }
+                       else {
                                ui_apply_but_BLOCK(C, but, data);
+                       }
                        break;
                case UI_BTYPE_BUT_MENU:
                        ui_apply_but_BUTM(C, but, data);
@@ -2106,7 +2150,9 @@ static void ui_but_set_float_array(bContext *C, uiBut *but, uiHandleButtonData *
        for (int i = 0; i < array_length; i++) {
                RNA_property_float_set_index(&but->rnapoin, but->rnaprop, i, values[i]);
        }
-       if (data) data->value = values[but->rnaindex];
+       if (data) {
+               data->value = values[but->rnaindex];
+       }
 
        button_activate_state(C, but, BUTTON_STATE_EXIT);
 }
@@ -2223,16 +2269,19 @@ static void ui_but_copy_color(uiBut *but, char *output, int output_len_max)
 {
        float rgba[4];
 
-       if (but->rnaprop && get_but_property_array_length(but) == 4)
+       if (but->rnaprop && get_but_property_array_length(but) == 4) {
                rgba[3] = RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
-       else
+       }
+       else {
                rgba[3] = 1.0f;
+       }
 
        ui_but_v3_get(but, rgba);
 
        /* convert to linear color to do compatible copy between gamma and non-gamma */
-       if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+       if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
                srgb_to_linearrgb_v3_v3(rgba, rgba);
+       }
 
        float_array_to_string(rgba, 4, output, output_len_max);
 }
@@ -2286,8 +2335,9 @@ static void ui_but_copy_colorband(uiBut *but)
 static void ui_but_paste_colorband(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
        if (but_copypaste_coba.tot != 0) {
-               if (!but->poin)
+               if (!but->poin) {
                        but->poin = MEM_callocN(sizeof(ColorBand), "colorband");
+               }
 
                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand));
@@ -2307,8 +2357,9 @@ static void ui_but_copy_curvemapping(uiBut *but)
 static void ui_but_paste_curvemapping(bContext *C, uiBut *but)
 {
        if (but_copypaste_curve_alive) {
-               if (!but->poin)
+               if (!but->poin) {
                        but->poin = MEM_callocN(sizeof(CurveMapping), "curvemapping");
+               }
 
                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
                curvemapping_free_data((CurveMapping *) but->poin);
@@ -2366,7 +2417,9 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
        switch (but->type) {
                case UI_BTYPE_NUM:
                case UI_BTYPE_NUM_SLIDER:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        if (copy_array && ui_but_has_array_value(but)) {
                                ui_but_copy_numeric_array(but, buf, buf_max_len);
                        }
@@ -2377,20 +2430,26 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
                        break;
 
                case UI_BTYPE_UNITVEC:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_copy_numeric_array(but, buf, buf_max_len);
                        is_buf_set = true;
                        break;
 
                case UI_BTYPE_COLOR:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_copy_color(but, buf, buf_max_len);
                        is_buf_set = true;
                        break;
 
                case UI_BTYPE_TEXT:
                case UI_BTYPE_SEARCH_MENU:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_copy_text(but, buf, buf_max_len);
                        is_buf_set = true;
                        break;
@@ -2442,7 +2501,9 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
        switch (but->type) {
                case UI_BTYPE_NUM:
                case UI_BTYPE_NUM_SLIDER:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        if (paste_array && ui_but_has_array_value(but)) {
                                ui_but_paste_numeric_array(C, but, data, buf_paste);
                        }
@@ -2452,18 +2513,24 @@ static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, cons
                        break;
 
                case UI_BTYPE_UNITVEC:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_paste_normalized_vector(C, but, buf_paste);
                        break;
 
                case UI_BTYPE_COLOR:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_paste_color(C, but, buf_paste);
                        break;
 
                case UI_BTYPE_TEXT:
                case UI_BTYPE_SEARCH_MENU:
-                       if (!has_required_data) break;
+                       if (!has_required_data) {
+                               break;
+                       }
                        ui_but_paste_text(C, but, data, buf_paste);
                        break;
 
@@ -2525,8 +2592,9 @@ void ui_but_text_password_hide(char password_str[UI_MAX_PASSWORD_STR], uiBut *bu
 {
        char *butstr;
 
-       if (!(but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_PASSWORD))
+       if (!(but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_PASSWORD)) {
                return;
+       }
 
        butstr = (but->editstr) ? but->editstr : but->drawstr;
 
@@ -2641,8 +2709,10 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
 
        UI_fontstyle_set(fstyle);
 
-       if (fstyle->kerning == 1) /* for BLF_width */
+       if (fstyle->kerning == 1) {
+               /* for BLF_width */
                BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
+       }
 
        ui_but_text_password_hide(password_str, but, false);
 
@@ -2702,7 +2772,9 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
                        /* done with tricky distance checks */
 
                        pos_i = but->pos;
-                       if (but->pos <= 0) break;
+                       if (but->pos <= 0) {
+                               break;
+                       }
                        if (BLI_str_cursor_step_prev_utf8(str, but->ofs, &pos_i)) {
                                but->pos = pos_i;
                                str_last = &str[but->pos + but->ofs];
@@ -2712,11 +2784,14 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
                        }
                }
                but->pos += but->ofs;
-               if (but->pos < 0) but->pos = 0;
+               if (but->pos < 0) {
+                       but->pos = 0;
+               }
        }
 
-       if (fstyle->kerning == 1)
+       if (fstyle->kerning == 1) {
                BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
+       }
 
        ui_but_text_password_hide(password_str, but, true);
 
@@ -2725,13 +2800,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con
 
 static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, const float x)
 {
-       if      (x > data->selstartx) data->selextend = EXTEND_RIGHT;
-       else if (x < data->selstartx) data->selextend = EXTEND_LEFT;
+       if      (x > data->selstartx) { data->selextend = EXTEND_RIGHT; }
+       else if (x < data->selstartx) { data->selextend = EXTEND_LEFT; }
 
        ui_textedit_set_cursor_pos(but, data, x);
 
-       if      (data->selextend == EXTEND_RIGHT) but->selend = but->pos;
-       else if (data->selextend == EXTEND_LEFT)  but->selsta = but->pos;
+       if      (data->selextend == EXTEND_RIGHT) { but->selend = but->pos; }
+       else if (data->selextend == EXTEND_LEFT)  { but->selsta = but->pos; }
 
        ui_but_update(but);
 }
@@ -2885,7 +2960,9 @@ static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directi
        bool changed = false;
 
        if (jump == STRCUR_JUMP_ALL) {
-               if (len) changed = true;
+               if (len) {
+                       changed = true;
+               }
                str[0] = '\0';
                but->pos = 0;
        }
@@ -2930,10 +3007,12 @@ static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData
 
        str = data->str;
 
-       if (data->searchbox)
+       if (data->searchbox) {
                changed = ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
-       else
+       }
+       else {
                changed = but->autocomplete_func(C, str, but->autofunc_arg);
+       }
 
        but->pos = strlen(str);
        but->selsta = but->selend = but->pos;
@@ -3171,8 +3250,9 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
        uiBut *but;
 
        /* label and roundbox can overlap real buttons (backdrops...) */
-       if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX))
+       if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX)) {
                return;
+       }
 
        for (but = actbut->next; but; but = but->next) {
                if (ui_but_is_editable_as_text(but)) {
@@ -3199,8 +3279,9 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
        uiBut *but;
 
        /* label and roundbox can overlap real buttons (backdrops...) */
-       if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX))
+       if (ELEM(actbut->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX)) {
                return;
+       }
 
        for (but = actbut->prev; but; but = but->prev) {
                if (ui_but_is_editable_as_text(but)) {
@@ -3276,8 +3357,9 @@ static void ui_do_but_textedit(
 
                        /* exit on LMB only on RELEASE for searchbox, to mimic other popups,
                         * and allow multiple menu levels */
-                       if (data->searchbox)
+                       if (data->searchbox) {
                                inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
+                       }
 
                        /* for double click: we do a press again for when you first click on button
                         * (selects all text, no cursor pos) */
@@ -3298,8 +3380,9 @@ static void ui_do_but_textedit(
                                }
                                else if (inbox == false) {
                                        /* if searchbox, click outside will cancel */
-                                       if (data->searchbox)
+                                       if (data->searchbox) {
                                                data->cancel = data->escapecancel = true;
+                                       }
                                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                                        retval = WM_UI_HANDLER_BREAK;
                                }
@@ -3330,12 +3413,15 @@ static void ui_do_but_textedit(
                        case XKEY:
                        case CKEY:
                                if (IS_EVENT_MOD(event, ctrl, oskey)) {
-                                       if (event->type == VKEY)
+                                       if (event->type == VKEY) {
                                                changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_PASTE);
-                                       else if (event->type == CKEY)
+                                       }
+                                       else if (event->type == CKEY) {
                                                changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_COPY);
-                                       else if (event->type == XKEY)
+                                       }
+                                       else if (event->type == XKEY) {
                                                changed = ui_textedit_copypaste(but, data, UI_TEXTEDIT_CUT);
+                                       }
 
                                        retval = WM_UI_HANDLER_BREAK;
                                }
@@ -3436,8 +3522,9 @@ static void ui_do_but_textedit(
                                        int autocomplete = ui_textedit_autocomplete(C, but, data);
                                        changed = autocomplete != AUTOCOMPLETE_NO_MATCH;
 
-                                       if (autocomplete == AUTOCOMPLETE_FULL_MATCH)
+                                       if (autocomplete == AUTOCOMPLETE_FULL_MATCH) {
                                                button_activate_state(C, but, BUTTON_STATE_EXIT);
+                                       }
                                }
                                /* the hotkey here is not well defined, was G.qual so we check all */
                                else if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) {
@@ -3525,12 +3612,14 @@ static void ui_do_but_textedit(
                }
                but->changed = true;
 
-               if (data->searchbox)
+               if (data->searchbox) {
                        ui_searchbox_update(C, data->searchbox, but, true);  /* true = reset */
+               }
        }
 
-       if (changed || (retval == WM_UI_HANDLER_BREAK))
+       if (changed || (retval == WM_UI_HANDLER_BREAK)) {
                ED_region_tag_redraw(data->region);
+       }
 }
 
 static void ui_do_but_textedit_select(
@@ -3551,8 +3640,9 @@ static void ui_do_but_textedit_select(
                        break;
                }
                case LEFTMOUSE:
-                       if (event->val == KM_RELEASE)
+                       if (event->val == KM_RELEASE) {
                                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
+                       }
                        retval = WM_UI_HANDLER_BREAK;
                        break;
        }
@@ -3681,18 +3771,21 @@ static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *dat
 
        if (func || handlefunc) {
                data->menu = ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
-               if (but->block->handle)
+               if (but->block->handle) {
                        data->menu->popup = but->block->handle->popup;
+               }
        }
        else if (menufunc) {
                data->menu = ui_popup_menu_create(C, data->region, but, menufunc, arg);
-               if (but->block->handle)
+               if (but->block->handle) {
                        data->menu->popup = but->block->handle->popup;
+               }
        }
        else if (popoverfunc) {
                data->menu = ui_popover_panel_create(C, data->region, but, popoverfunc, arg);
-               if (but->block->handle)
+               if (but->block->handle) {
                        data->menu->popup = but->block->handle->popup;
+               }
        }
 
 #ifdef USE_ALLSELECT
@@ -3705,7 +3798,9 @@ static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *dat
 #endif
 
        /* this makes adjacent blocks auto open from now on */
-       //if (but->block->auto_open == 0) but->block->auto_open = 1;
+       //if (but->block->auto_open == 0) {
+       //      but->block->auto_open = 1;
+       //}
 }
 
 static void ui_block_open_end(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -3727,8 +3822,9 @@ int ui_but_menu_direction(uiBut *but)
 {
        uiHandleButtonData *data = but->active;
 
-       if (data && data->menu)
+       if (data && data->menu) {
                return data->menu->direction;
+       }
 
        return 0;
 }
@@ -3815,8 +3911,9 @@ static int ui_do_but_BUT(
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE && but->block->handle) {
                        /* regular buttons will be 'UI_SELECT', menu items 'UI_ACTIVE' */
-                       if (!(but->flag & (UI_SELECT | UI_ACTIVE)))
+                       if (!(but->flag & (UI_SELECT | UI_ACTIVE))) {
                                data->cancel = true;
+                       }
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -3827,8 +3924,9 @@ static int ui_do_but_BUT(
        }
        else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
                if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
-                       if (!(but->flag & UI_SELECT))
+                       if (!(but->flag & UI_SELECT)) {
                                data->cancel = true;
+                       }
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                        return WM_UI_HANDLER_BREAK;
                }
@@ -3858,10 +3956,12 @@ static int ui_do_but_HOTKEYEVT(
                        /* only cancel if click outside the button */
                        if (ui_but_contains_point_px(but, but->active->region, event->x, event->y) == 0) {
                                /* data->cancel doesn't work, this button opens immediate */
-                               if (but->flag & UI_BUT_IMMEDIATE)
+                               if (but->flag & UI_BUT_IMMEDIATE) {
                                        ui_but_value_set(but, 0);
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                                return WM_UI_HANDLER_BREAK;
                        }
@@ -3869,20 +3969,30 @@ static int ui_do_but_HOTKEYEVT(
 
                /* always set */
                but->modifier_key = 0;
-               if (event->shift) but->modifier_key |= KM_SHIFT;
-               if (event->alt) but->modifier_key |= KM_ALT;
-               if (event->ctrl) but->modifier_key |= KM_CTRL;
-               if (event->oskey) but->modifier_key |= KM_OSKEY;
+               if (event->shift) {
+                       but->modifier_key |= KM_SHIFT;
+               }
+               if (event->alt) {
+                       but->modifier_key |= KM_ALT;
+               }
+               if (event->ctrl) {
+                       but->modifier_key |= KM_CTRL;
+               }
+               if (event->oskey) {
+                       but->modifier_key |= KM_OSKEY;
+               }
 
                ui_but_update(but);
                ED_region_tag_redraw(data->region);
 
                if (event->val == KM_PRESS) {
                        if (ISHOTKEY(event->type) && (event->type != ESCKEY)) {
-                               if (WM_key_event_string(event->type, false)[0])
+                               if (WM_key_event_string(event->type, false)[0]) {
                                        ui_but_value_set(but, event->type);
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                                return WM_UI_HANDLER_BREAK;
@@ -3917,10 +4027,12 @@ static int ui_do_but_KEYEVT(
                }
 
                if (event->val == KM_PRESS) {
-                       if (WM_key_event_string(event->type, false)[0])
+                       if (WM_key_event_string(event->type, false)[0]) {
                                ui_but_value_set(but, event->type);
-                       else
+                       }
+                       else {
                                data->cancel = true;
+                       }
 
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
                }
@@ -4238,21 +4350,22 @@ static float ui_numedit_apply_snapf(
                }
 
                if (snap == SNAP_ON) {
-                       if      (softrange < 2.10f) tempf = roundf(tempf * 10.0f) * 0.1f;
-                       else if (softrange < 21.0f) tempf = roundf(tempf);
-                       else                        tempf = roundf(tempf * 0.1f) * 10.0f;
+                       if      (softrange < 2.10f) { tempf = roundf(tempf * 10.0f) * 0.1f; }
+                       else if (softrange < 21.0f) { tempf = roundf(tempf); }
+                       else                        { tempf = roundf(tempf * 0.1f) * 10.0f; }
                }
                else if (snap == SNAP_ON_SMALL) {
-                       if      (softrange < 2.10f) tempf = roundf(tempf * 100.0f) * 0.01f;
-                       else if (softrange < 21.0f) tempf = roundf(tempf * 10.0f)  * 0.1f;
-                       else                        tempf = roundf(tempf);
+                       if      (softrange < 2.10f) { tempf = roundf(tempf * 100.0f) * 0.01f; }
+                       else if (softrange < 21.0f) { tempf = roundf(tempf * 10.0f)  * 0.1f; }
+                       else                        { tempf = roundf(tempf); }
                }
                else {
                        BLI_assert(0);
                }
 
-               if (fac != 1.0f)
+               if (fac != 1.0f) {
                        tempf *= fac;
+               }
        }
 
        return tempf;
@@ -4262,8 +4375,9 @@ static float ui_numedit_apply_snap(
         int temp, float softmin, float softmax,
         const enum eSnapType snap)
 {
-       if (temp == softmin || temp == softmax)
+       if (temp == softmin || temp == softmax) {
                return temp;
+       }
 
        switch (snap) {
                case SNAP_OFF:
@@ -4328,9 +4442,9 @@ static bool ui_numedit_but_NUM(
                        }
                }
                else {
-                       if      (softrange > 256) fac = 1.0;        /* 1px == 1 */
-                       else if (softrange >  32) fac = 1.0 / 2.0;  /* 2px == 1 */
-                       else                      fac = 1.0 / 16.0; /* 16px == 1? */
+                       if      (softrange > 256) { fac = 1.0; }        /* 1px == 1 */
+                       else if (softrange >  32) { fac = 1.0 / 2.0; }  /* 2px == 1 */
+                       else                      { fac = 1.0 / 16.0; } /* 16px == 1? */
 
                        temp = data->startvalue + (((double)mx - data->dragstartx) * (double)fac);
                        temp = ui_numedit_apply_snap(temp, softmin, softmax, snap);
@@ -4377,9 +4491,9 @@ static bool ui_numedit_but_NUM(
                        non_linear_pixel_map = 250.0f;
 
                        /* prevent large ranges from getting too out of control */
-                       if      (softrange > 600) deler = powf(softrange, 0.75f);
-                       else if (softrange <  25) deler = 50.0;
-                       else if (softrange < 100) deler = 100.0;
+                       if      (softrange > 600) { deler = powf(softrange, 0.75f); }
+                       else if (softrange <  25) { deler = 50.0; }
+                       else if (softrange < 100) { deler = 100.0; }
                }
                deler /= fac;
 
@@ -4583,7 +4697,9 @@ static int ui_do_but_NUM(
 #endif
 
                        fac = 1.0f;
-                       if (event->shift) fac /= 10.0f;
+                       if (event->shift) {
+                               fac /= 10.0f;
+                       }
 
                        if (ui_numedit_but_NUM(but, data, (ui_but_is_cursor_warp(but) ? screen_mx : mx), is_motion, snap, fac)) {
                                ui_numedit_apply(C, block, but, data);
@@ -4621,10 +4737,12 @@ static int ui_do_but_NUM(
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                temp = (int)data->value - 1;
-                               if (temp >= softmin && temp <= softmax)
+                               if (temp >= softmin && temp <= softmax) {
                                        data->value = (double)temp;
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
@@ -4632,10 +4750,12 @@ static int ui_do_but_NUM(
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                temp = (int)data->value + 1;
-                               if (temp >= softmin && temp <= softmax)
+                               if (temp >= softmin && temp <= softmax) {
                                        data->value = (double)temp;
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
                        }
@@ -4648,7 +4768,9 @@ static int ui_do_but_NUM(
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                tempf = (float)data->value - (UI_PRECISION_FLOAT_SCALE * but->a1);
-                               if (tempf < softmin) tempf = softmin;
+                               if (tempf < softmin) {
+                                       tempf = softmin;
+                               }
                                data->value = tempf;
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4657,7 +4779,9 @@ static int ui_do_but_NUM(
                                button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                                tempf = (float)data->value + (UI_PRECISION_FLOAT_SCALE * but->a1);
-                               if (tempf > softmax) tempf = softmax;
+                               if (tempf > softmax) {
+                                       tempf = softmax;
+                               }
                                data->value = tempf;
 
                                button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4750,14 +4874,14 @@ static bool ui_numedit_but_SLI(
 
                        if (shift) {
                                if      (tempf == softmin || tempf == softmax) {}
-                               else if (softrange < 2.10f) tempf = roundf(tempf * 100.0f) * 0.01f;
-                               else if (softrange < 21.0f) tempf = roundf(tempf * 10.0f)  * 0.1f;
-                               else                        tempf = roundf(tempf);
+                               else if (softrange < 2.10f) { tempf = roundf(tempf * 100.0f) * 0.01f; }
+                               else if (softrange < 21.0f) { tempf = roundf(tempf * 10.0f)  * 0.1f; }
+                               else                        { tempf = roundf(tempf); }
                        }
                        else {
-                               if      (softrange < 2.10f) tempf = roundf(tempf * 10.0f) * 0.1f;
-                               else if (softrange < 21.0f) tempf = roundf(tempf);
-                               else                        tempf = roundf(tempf * 0.1f) * 10.0f;
+                               if      (softrange < 2.10f) { tempf = roundf(tempf * 10.0f) * 0.1f; }
+                               else if (softrange < 21.0f) { tempf = roundf(tempf); }
+                               else                        { tempf = roundf(tempf * 0.1f) * 10.0f; }
                        }
                }
                else {
@@ -4832,10 +4956,12 @@ static int ui_do_but_SLI(
                        else if (event->type == LEFTMOUSE && event->alt) {
                                int halfpos = BLI_rctf_cent_x(&but->rect);
                                click = 2;
-                               if (mx < halfpos)
+                               if (mx < halfpos) {
                                        mx = but->rect.xmin;
-                               else
+                               }
+                               else {
                                        mx = but->rect.xmax;
+                               }
                        }
 #endif
                        else if (event->type == LEFTMOUSE) {
@@ -4945,22 +5071,34 @@ static int ui_do_but_SLI(
                        f = softmin + f * softrange;
 
                        if (!ui_but_is_float(but)) {
-                               if (f < temp) temp--;
-                               else temp++;
+                               if (f < temp) {
+                                       temp--;
+                               }
+                               else {
+                                       temp++;
+                               }
 
-                               if (temp >= softmin && temp <= softmax)
+                               if (temp >= softmin && temp <= softmax) {
                                        data->value = temp;
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
                        }
                        else {
-                               if (f < tempf) tempf -= 0.01f;
-                               else tempf += 0.01f;
+                               if (f < tempf) {
+                                       tempf -= 0.01f;
+                               }
+                               else {
+                                       tempf += 0.01f;
+                               }
 
-                               if (tempf >= softmin && tempf <= softmax)
+                               if (tempf >= softmin && tempf <= softmax) {
                                        data->value = tempf;
-                               else
+                               }
+                               else {
                                        data->cancel = true;
+                               }
                        }
 
                        button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -5007,8 +5145,9 @@ static int ui_do_but_SCROLL(
                        }
                        /* UNUSED - otherwise code is ok, add back if needed */
 #if 0
-                       else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS)
+                       else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) {
                                click = 1;
+                       }
 #endif
                }
        }
@@ -5327,10 +5466,12 @@ static int ui_do_but_COLOR(
                        ui_but_v3_get(but, col);
                        rgb_to_hsv_compat_v(col, hsv);
 
-                       if (event->type == WHEELDOWNMOUSE)
+                       if (event->type == WHEELDOWNMOUSE) {
                                hsv[2] = clamp_f(hsv[2] - 0.05f, 0.0f, 1.0f);
-                       else if (event->type == WHEELUPMOUSE)
+                       }
+                       else if (event->type == WHEELUPMOUSE) {
                                hsv[2] = clamp_f(hsv[2] + 0.05f, 0.0f, 1.0f);
+                       }
                        else {
                                float fac = 0.005 * (event->y - event->prevy);
                                hsv[2] = clamp_f(hsv[2] + fac, 0.0f, 1.0f);
@@ -5444,8 +5585,9 @@ static int ui_do_but_UNITVEC(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_UNITVEC(but, data, mx, my, snap))
+                       if (ui_numedit_but_UNITVEC(but, data, mx, my, snap)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -5454,8 +5596,9 @@ static int ui_do_but_UNITVEC(
                if ((event->type == MOUSEMOVE) || ui_event_is_snap(event)) {
                        if (mx != data->draglastx || my != data->draglasty || event->type != MOUSEMOVE) {
                                const enum eSnapType snap = ui_event_to_snap(event);
-                               if (ui_numedit_but_UNITVEC(but, data, mx, my, snap))
+                               if (ui_numedit_but_UNITVEC(but, data, mx, my, snap)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -5475,34 +5618,46 @@ static void clamp_axis_max_v3(float v[3], const float max)
        const float v_max = max_fff(v[0], v[1], v[2]);
        if (v_max > max) {
                mul_v3_fl(v, max / v_max);
-               if (v[0] > max) v[0] = max;
-               if (v[1] > max) v[1] = max;
-               if (v[2] > max) v[2] = max;
+               if (v[0] > max) {
+                       v[0] = max;
+               }
+               if (v[1] > max) {
+                       v[1] = max;
+               }
+               if (v[2] > max) {
+                       v[2] = max;
+               }
        }
 }
 
 static void ui_rgb_to_color_picker_HSVCUBE_compat_v(uiBut *but, const float rgb[3], float hsv[3])
 {
-       if (but->a1 == UI_GRAD_L_ALT)
+       if (but->a1 == UI_GRAD_L_ALT) {
                rgb_to_hsl_compat_v(rgb, hsv);
-       else
+       }
+       else {
                rgb_to_hsv_compat_v(rgb, hsv);
+       }
 }
 
 static void ui_rgb_to_color_picker_HSVCUBE_v(uiBut *but, const float rgb[3], float hsv[3])
 {
-       if (but->a1 == UI_GRAD_L_ALT)
+       if (but->a1 == UI_GRAD_L_ALT) {
                rgb_to_hsl_v(rgb, hsv);
-       else
+       }
+       else {
                rgb_to_hsv_v(rgb, hsv);
+       }
 }
 
 static void ui_color_picker_to_rgb_HSVCUBE_v(uiBut *but, const float hsv[3], float rgb[3])
 {
-       if (but->a1 == UI_GRAD_L_ALT)
+       if (but->a1 == UI_GRAD_L_ALT) {
                hsl_to_rgb_v(hsv, rgb);
-       else
+       }
+       else {
                hsv_to_rgb_v(hsv, rgb);
+       }
 }
 
 static bool ui_numedit_but_HSVCUBE(
@@ -5711,8 +5866,9 @@ static int ui_do_but_HSVCUBE(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_HSVCUBE(but, data, mx, my, snap, event->shift != 0))
+                       if (ui_numedit_but_HSVCUBE(but, data, mx, my, snap, event->shift != 0)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -5773,8 +5929,9 @@ static int ui_do_but_HSVCUBE(
                        if (mx != data->draglastx || my != data->draglasty || event->type != MOUSEMOVE) {
                                const enum eSnapType snap = ui_event_to_snap(event);
 
-                               if (ui_numedit_but_HSVCUBE(but, data, mx, my, snap, event->shift != 0))
+                               if (ui_numedit_but_HSVCUBE(but, data, mx, my, snap, event->shift != 0)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -5827,11 +5984,17 @@ static bool ui_numedit_but_HSVCIRCLE(
         * allow choosing a hue for black values, by giving a tiny increment */
        if (cpicker->use_color_lock) {
                if (U.color_picker_type == USER_CP_CIRCLE_HSV) { // lock
-                       if (hsv[2] == 0.f) hsv[2] = 0.0001f;
+                       if (hsv[2] == 0.f) {
+                               hsv[2] = 0.0001f;
+                       }
                }
                else {
-                       if (hsv[2] == 0.0f) hsv[2] = 0.0001f;
-                       if (hsv[2] >= 0.9999f) hsv[2] = 0.9999f;
+                       if (hsv[2] == 0.0f) {
+                               hsv[2] = 0.0001f;
+                       }
+                       if (hsv[2] >= 0.9999f) {
+                               hsv[2] = 0.9999f;
+                       }
                }
        }
 
@@ -5924,11 +6087,17 @@ static void ui_ndofedit_but_HSVCIRCLE(
         * allow choosing a hue for black values, by giving a tiny increment */
        if (cpicker->use_color_lock) {
                if (U.color_picker_type == USER_CP_CIRCLE_HSV) { // lock
-                       if (hsv[2] == 0.f) hsv[2] = 0.0001f;
+                       if (hsv[2] == 0.f) {
+                               hsv[2] = 0.0001f;
+                       }
                }
                else {
-                       if (hsv[2] == 0.f) hsv[2] = 0.0001f;
-                       if (hsv[2] == 1.f) hsv[2] = 0.9999f;
+                       if (hsv[2] == 0.f) {
+                               hsv[2] = 0.0001f;
+                       }
+                       if (hsv[2] == 1.f) {
+                               hsv[2] = 0.9999f;
+                       }
                }
        }
 
@@ -5972,8 +6141,9 @@ static int ui_do_but_HSVCIRCLE(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, snap, event->shift != 0))
+                       if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, snap, event->shift != 0)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -6064,11 +6234,13 @@ static bool ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int m
        float dx;
        bool changed = false;
 
-       if (data->draglastx == mx)
+       if (data->draglastx == mx) {
                return changed;
+       }
 
-       if (data->coba->tot == 0)
+       if (data->coba->tot == 0) {
                return changed;
+       }
 
        dx = ((float)(mx - data->draglastx)) / BLI_rctf_size_x(&but->rect);
        data->dragcbd->pos += dx;
@@ -6117,7 +6289,10 @@ static int ui_do_but_COLORBAND(
                                for (a = 0, cbd = coba->data; a < coba->tot; a++, cbd++) {
                                        xco = but->rect.xmin + (cbd->pos * BLI_rctf_size_x(&but->rect));
                                        xco = ABS(xco - mx);
-                                       if (a == coba->cur) xco += 5;  // selected one disadvantage
+                                       if (a == coba->cur) {
+                                               /* Selected one disadvantage. */
+                                               xco += 5;
+                                       }
                                        if (xco < mindist) {
                                                coba->cur = a;
                                                mindist = xco;
@@ -6135,8 +6310,9 @@ static int ui_do_but_COLORBAND(
        else if (data->state == BUTTON_STATE_NUM_EDITING) {
                if (event->type == MOUSEMOVE) {
                        if (mx != data->draglastx || my != data->draglasty) {
-                               if (ui_numedit_but_COLORBAND(but, data, mx))
+                               if (ui_numedit_but_COLORBAND(but, data, mx)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -6188,8 +6364,9 @@ static bool ui_numedit_but_CURVE(
                d[0] = mx - data->dragstartx;
                d[1] = my - data->dragstarty;
 
-               if (len_squared_v2(d) < (3.0f * 3.0f))
+               if (len_squared_v2(d) < (3.0f * 3.0f)) {
                        snap = false;
+               }
        }
 
        if (data->dragsel != -1) {
@@ -6212,8 +6389,9 @@ static bool ui_numedit_but_CURVE(
                                        cmp[a].x = 0.125f * roundf(8.0f * cmp[a].x);
                                        cmp[a].y = 0.125f * roundf(8.0f * cmp[a].y);
                                }
-                               if (cmp[a].x != origx || cmp[a].y != origy)
+                               if (cmp[a].x != origx || cmp[a].y != origy) {
                                        moved_point = true;
+                               }
 
                                cmp_last = &cmp[a];
                        }
@@ -6247,14 +6425,18 @@ static bool ui_numedit_but_CURVE(
 
                /* clamp for clip */
                if (cumap->flag & CUMA_DO_CLIP) {
-                       if (cumap->curr.xmin - fx < cumap->clipr.xmin)
+                       if (cumap->curr.xmin - fx < cumap->clipr.xmin) {
                                fx = cumap->curr.xmin - cumap->clipr.xmin;
-                       else if (cumap->curr.xmax - fx > cumap->clipr.xmax)
+                       }
+                       else if (cumap->curr.xmax - fx > cumap->clipr.xmax) {
                                fx = cumap->curr.xmax - cumap->clipr.xmax;
-                       if (cumap->curr.ymin - fy < cumap->clipr.ymin)
+                       }
+                       if (cumap->curr.ymin - fy < cumap->clipr.ymin) {
                                fy = cumap->curr.ymin - cumap->clipr.ymin;
-                       else if (cumap->curr.ymax - fy > cumap->clipr.ymax)
+                       }
+                       else if (cumap->curr.ymax - fy > cumap->clipr.ymax) {
                                fy = cumap->curr.ymax - cumap->clipr.ymax;
+                       }
                }
 
                cumap->curr.xmin -= fx;
@@ -6388,8 +6570,9 @@ static int ui_do_but_CURVE(
                if (event->type == MOUSEMOVE) {
                        if (event->x != data->draglastx || event->y != data->draglasty) {
 
-                               if (ui_numedit_but_CURVE(block, but, data, event->x, event->y, event->ctrl != 0, event->shift != 0))
+                               if (ui_numedit_but_CURVE(block, but, data, event->x, event->y, event->ctrl != 0, event->shift != 0)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -6401,8 +6584,9 @@ static int ui_do_but_CURVE(
                                if (data->dragchange == false) {
                                        /* deselect all, select one */
                                        if (!event->shift) {
-                                               for (a = 0; a < cuma->totpoint; a++)
+                                               for (a = 0; a < cuma->totpoint; a++) {
                                                        cmp[a].flag &= ~CUMA_SELECT;
+                                               }
                                                cmp[data->dragsel].flag |= CUMA_SELECT;
                                        }
                                }
@@ -6462,8 +6646,9 @@ static int ui_do_but_HISTOGRAM(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
+                       if (ui_numedit_but_HISTOGRAM(but, data, mx, my)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -6486,8 +6671,9 @@ static int ui_do_but_HISTOGRAM(
                }
                else if (event->type == MOUSEMOVE) {
                        if (mx != data->draglastx || my != data->draglasty) {
-                               if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
+                               if (ui_numedit_but_HISTOGRAM(but, data, mx, my)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -6537,8 +6723,9 @@ static int ui_do_but_WAVEFORM(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_WAVEFORM(but, data, mx, my))
+                       if (ui_numedit_but_WAVEFORM(but, data, mx, my)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -6561,8 +6748,9 @@ static int ui_do_but_WAVEFORM(
                }
                else if (event->type == MOUSEMOVE) {
                        if (mx != data->draglastx || my != data->draglasty) {
-                               if (ui_numedit_but_WAVEFORM(but, data, mx, my))
+                               if (ui_numedit_but_WAVEFORM(but, data, mx, my)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -6592,8 +6780,9 @@ static bool ui_numedit_but_TRACKPREVIEW(
        }
 
        if (!scopes->track_locked) {
-               if (scopes->marker->framenr != scopes->framenr)
+               if (scopes->marker->framenr != scopes->framenr) {
                        scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr);
+               }
 
                scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
                scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_rctf_size_x(&but->block->rect);
@@ -6629,8 +6818,9 @@ static int ui_do_but_TRACKPREVIEW(
                        button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
                        /* also do drag the first time */
-                       if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift != 0))
+                       if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift != 0)) {
                                ui_numedit_apply(C, block, but, data);
+                       }
 
                        return WM_UI_HANDLER_BREAK;
                }
@@ -6645,8 +6835,9 @@ static int ui_do_but_TRACKPREVIEW(
                }
                else if (event->type == MOUSEMOVE) {
                        if (mx != data->draglastx || my != data->draglasty) {
-                               if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift != 0))
+                               if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift != 0)) {
                                        ui_numedit_apply(C, block, but, data);
+                               }
                        }
                }
                else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
@@ -6805,10 +6996,13 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
                        retval = ui_do_but_BUT(C, but, data, event);
                        break;
                case UI_BTYPE_COLOR:
-                       if (but->a1 == -1)  /* signal to prevent calling up color picker */
+                       if (but->a1 == -1) {
+                               /* signal to prevent calling up color picker */
                                retval = ui_do_but_EXIT(C, but, data, event);
-                       else
+                       }
+                       else {
                                retval = ui_do_but_COLOR(C, but, data, event);
+                       }
                        break;
                case UI_BTYPE_UNITVEC:
                        retval = ui_do_but_UNITVEC(C, block, but, data, event);
@@ -6925,13 +7119,15 @@ static void ui_blocks_set_tooltips(ARegion *ar, const bool enable)
 {
        uiBlock *block;
 
-       if (!ar)
+       if (!ar) {
                return;
+       }
 
        /* we disabled buttons when when they were already shown, and
         * re-enable them on mouse move */
-       for (block = ar->uiblocks.first; block; block = block->next)
+       for (block = ar->uiblocks.first; block; block = block->next) {
                block->tooltipdisabled = !enable;
+       }
 }
 
 /**
@@ -7032,8 +7228,9 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
        uiHandleButtonData *data;
 
        data = but->active;
-       if (data->state == state)
+       if (data->state == state) {
                return;
+       }
 
        /* highlight has timers for tooltips and auto open */
        if (state == BUTTON_STATE_HIGHLIGHT) {
@@ -7073,17 +7270,21 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
        }
 
        /* text editing */
-       if (state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
+       if (state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING) {
                ui_textedit_begin(C, but, data);
-       else if (data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
+       }
+       else if (data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING) {
                ui_textedit_end(C, but, data);
-       else if (data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
+       }
+       else if (data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING) {
                ui_textedit_end(C, but, data);
+       }
 
        /* number editing */
        if (state == BUTTON_STATE_NUM_EDITING) {
-               if (ui_but_is_cursor_warp(but))
+               if (ui_but_is_cursor_warp(but)) {
                        WM_cursor_grab_enable(CTX_wm_window(C), true, true, NULL);
+               }
                ui_numedit_begin(but, data);
        }
        else if (data->state == BUTTON_STATE_NUM_EDITING) {
@@ -7119,10 +7320,12 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
                }
        }
        /* menu open */
-       if (state == BUTTON_STATE_MENU_OPEN)
+       if (state == BUTTON_STATE_MENU_OPEN) {
                ui_block_open_begin(C, but, data);
-       else if (data->state == BUTTON_STATE_MENU_OPEN)
+       }
+       else if (data->state == BUTTON_STATE_MENU_OPEN) {
                ui_block_open_end(C, but, data);
+       }
 
        /* add a short delay before exiting, to ensure there is some feedback */
        if (state == BUTTON_STATE_WAIT_FLASH) {
@@ -7146,8 +7349,9 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
         * but not for popups, because we already have a window level handler*/
        if (!(but->block->handle && but->block->handle->popup)) {
                if (button_modal_state(state)) {
-                       if (!button_modal_state(data->state))
+                       if (!button_modal_state(data->state)) {
                                WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data, 0);
+                       }
                }
                else {
                        if (button_modal_state(data->state)) {
@@ -7170,8 +7374,9 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
                 * highlight when not in a popup menu, we remove because data used in
                 * button below popup might have been removed by action of popup. Needs
                 * a more reliable solution... */
-               if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
+               if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP)) {
                        ui_but_update(but);
+               }
        }
 
        /* redraw */
@@ -7211,9 +7416,11 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
        /* we disable auto_open in the block after a threshold, because we still
         * want to allow auto opening adjacent menus even if no button is activated
         * in between going over to the other button, but only for a short while */
-       if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == true)
-               if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
+       if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == true) {
+               if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer()) {
                        but->block->auto_open = false;
+               }
+       }
 
        if (type == BUTTON_ACTIVATE_OVER) {
                data->used_mouse = true;
@@ -7222,8 +7429,9 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
 
        /* activate right away */
        if (but->flag & UI_BUT_IMMEDIATE) {
-               if (but->type == UI_BTYPE_HOTKEY_EVENT)
+               if (but->type == UI_BTYPE_HOTKEY_EVENT) {
                        button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
+               }
                /* .. more to be added here */
        }
 
@@ -7239,15 +7447,18 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
                        if (subblock) {
                                subbut = ui_but_first(subblock);
 
-                               if (subbut)
+                               if (subbut) {
                                        ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
+                               }
                        }
                }
        }
-       else if (type == BUTTON_ACTIVATE_TEXT_EDITING)
+       else if (type == BUTTON_ACTIVATE_TEXT_EDITING) {
                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-       else if (type == BUTTON_ACTIVATE_APPLY)
+       }
+       else if (type == BUTTON_ACTIVATE_APPLY) {
                button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
+       }
 
        if (but->type == UI_BTYPE_GRIP) {
                const bool horizontal = (BLI_rctf_size_x(&but->rect) < BLI_rctf_size_y(&but->rect));
@@ -7283,12 +7494,14 @@ static void button_activate_exit(
        }
 
        /* ensure we are in the exit state */
-       if (data->state != BUTTON_STATE_EXIT)
+       if (data->state != BUTTON_STATE_EXIT) {
                button_activate_state(C, but, BUTTON_STATE_EXIT);
+       }
 
        /* apply the button action or value */
-       if (!onfree)
+       if (!onfree) {
                ui_apply_but(C, block, but, data, false);
+       }
 
 #ifdef USE_DRAG_MULTINUM
        if (data->multi_data.has_mbuts) {
@@ -7338,14 +7551,16 @@ static void button_activate_exit(
 #endif
 
                /* popup menu memory */
-               if (block->flag & UI_BLOCK_POPUP_MEMORY)
+               if (block->flag & UI_BLOCK_POPUP_MEMORY) {
                        ui_popup_menu_memory_set(block, but);
+               }
        }
 
        /* disable tooltips until mousemove + last active flag */
        for (block = data->region->uiblocks.first; block; block = block->next) {
-               for (bt = block->buttons.first; bt; bt = bt->next)
+               for (bt = block->buttons.first; bt; bt = bt->next) {
                        bt->flag &= ~UI_BUT_LAST_ACTIVE;
+               }
 
                block->tooltipdisabled = 1;
        }
@@ -7353,10 +7568,12 @@ static void button_activate_exit(
        ui_blocks_set_tooltips(data->region, false);
 
        /* clean up */
-       if (data->str)
+       if (data->str) {
                MEM_freeN(data->str);
-       if (data->origstr)
+       }
+       if (data->origstr) {
                MEM_freeN(data->origstr);
+       }
 
 #ifdef USE_ALLSELECT
        ui_selectcontext_end(but, &data->select_others);
@@ -7378,14 +7595,16 @@ static void button_activate_exit(
 
        but->flag &= ~(UI_ACTIVE | UI_SELECT);
        but->flag |= UI_BUT_LAST_ACTIVE;
-       if (!onfree)
+       if (!onfree) {
                ui_but_update(but);
+       }
 
        /* adds empty mousemove in queue for re-init handler, in case mouse is
         * still over a button. We cannot just check for this ourselves because
         * at this point the mouse may be over a button in another region */
-       if (mousemove)
+       if (mousemove) {
                WM_event_add_mousemove(C);
+       }
 }
 
 void ui_but_active_free(const bContext *C, uiBut *but)
@@ -7414,10 +7633,12 @@ static uiBut *ui_context_button_active(ARegion *ar, bool (*but_check_cb)(uiBut *
                /* find active button */
                for (block = ar->uiblocks.first; block; block = block->next) {
                        for (but = block->buttons.first; but; but = but->next) {
-                               if (but->active)
+                               if (but->active) {
                                        activebut = but;
-                               else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+                               }
+                               else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE)) {
                                        activebut = but;
+                               }
                        }
                }
 
@@ -7599,9 +7820,11 @@ static uiBut *ui_but_find_open_event(ARegion *ar, const wmEvent *event)
        uiBut *but;
 
        for (block = ar->uiblocks.first; block; block = block->next) {
-               for (but = block->buttons.first; but; but = but->next)
-                       if (but == event->customdata)
+               for (but = block->buttons.first; but; but = but->next) {
+                       if (but == event->customdata) {
                                return but;
+                       }
+               }
        }
        return NULL;
 }
@@ -8037,8 +8260,9 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar,
 
                /* if type still is mousepan, we call it handled, since delta-y accumulate */
                /* also see wm_event_system.c do_wheel_ui hack */
-               if (type == MOUSEPAN)
+               if (type == MOUSEPAN) {
                        retval = WM_UI_HANDLER_BREAK;
+               }
        }
 
        if (val == KM_PRESS) {
@@ -8154,10 +8378,12 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
 
        /* copy over return values from the closing menu */
        if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
-               if (but->type == UI_BTYPE_COLOR)
+               if (but->type == UI_BTYPE_COLOR) {
                        copy_v3_v3(data->vec, menu->retvec);
-               else if (but->type == UI_BTYPE_MENU)
+               }
+               else if (but->type == UI_BTYPE_MENU) {
                        data->value = menu->retvalue;
+               }
        }
 
        if (menu->menuretval & UI_RETURN_UPDATE) {
@@ -8173,8 +8399,9 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u
 
        /* now change button state or exit, which will close the submenu */
        if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
-               if (menu->menuretval != UI_RETURN_OK)
+               if (menu->menuretval != UI_RETURN_OK) {
                        data->cancel = true;
+               }
 
                button_activate_exit(C, but, data, true, false);
        }
@@ -8221,10 +8448,12 @@ static void ui_mouse_motion_towards_init_ex(uiPopupBlockHandle *menu, const int
                menu->towards_xy[0] = xy[0];
                menu->towards_xy[1] = xy[1];
 
-               if (force)
+               if (force) {
                        menu->towardstime = DBL_MAX;  /* unlimited time */
-               else
+               }
+               else {
                        menu->towardstime = PIL_check_seconds_timer();
+               }
        }
 }
 
@@ -8272,8 +8501,9 @@ static bool ui_mouse_motion_towards_check(
                return false;
        }
 
-       if (len_squared_v2v2(oldp, newp) < (4.0f * 4.0f))
+       if (len_squared_v2v2(oldp, newp) < (4.0f * 4.0f)) {
                return menu->dotowards;
+       }
 
        /* verify that we are moving towards one of the edges of the
         * menu block, in other words, in the triangle formed by the
@@ -8310,12 +8540,14 @@ static bool ui_mouse_motion_towards_check(
                  isect_point_tri_v2(newp, oldp, p3, p4) ||
                  isect_point_tri_v2(newp, oldp, p4, p1));
 
-       if (!closer)
+       if (!closer) {
                menu->dotowards = false;
+       }
 
        /* 1 second timer */
-       if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
+       if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH) {
                menu->dotowards = false;
+       }
 
        return menu->dotowards;
 }
@@ -8349,12 +8581,16 @@ static bool ui_mouse_motion_keynav_test(struct uiKeyNavLock *keynav, const wmEve
 static char ui_menu_scroll_test(uiBlock *block, int my)
 {
        if (block->flag & (UI_BLOCK_CLIPTOP | UI_BLOCK_CLIPBOTTOM)) {
-               if (block->flag & UI_BLOCK_CLIPTOP)
-                       if (my > block->rect.ymax - UI_MENU_SCROLL_MOUSE)
+               if (block->flag & UI_BLOCK_CLIPTOP) {
+                       if (my > block->rect.ymax - UI_MENU_SCROLL_MOUSE) {
                                return 't';
-               if (block->flag & UI_BLOCK_CLIPBOTTOM)
-                       if (my < block->rect.ymin + UI_MENU_SCROLL_MOUSE)
+                       }
+               }
+               if (block->flag & UI_BLOCK_CLIPBOTTOM) {
+                       if (my < block->rect.ymin + UI_MENU_SCROLL_MOUSE) {
                                return 'b';
+                       }
+               }
        }
        return 0;
 }
@@ -8519,13 +8755,21 @@ static int ui_handle_menu_button(bContext *C, const wmEvent *event, uiPopupBlock
                ScrArea *ctx_area = CTX_wm_area(C);
                ARegion *ctx_region = CTX_wm_region(C);
 
-               if (menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
-               if (menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
+               if (menu->ctx_area) {
+                       CTX_wm_area_set(C, menu->ctx_area);
+               }
+               if (menu->ctx_region) {
+                       CTX_wm_region_set(C, menu->ctx_region);
+               }
 
                retval = ui_handle_button_event(C, event, but);
 
-               if (menu->ctx_area) CTX_wm_area_set(C, ctx_area);
-               if (menu->ctx_region) CTX_wm_region_set(C, ctx_region);
+               if (menu->ctx_area) {
+                       CTX_wm_area_set(C, ctx_area);
+               }
+               if (menu->ctx_region) {
+                       CTX_wm_region_set(C, ctx_region);
+               }
        }
        else {
                retval = ui_handle_button_over(C, event, ar);
@@ -8551,10 +8795,12 @@ float ui_block_calc_pie_segment(uiBlock *block, const float event_xy[2])
 
        len = normalize_v2_v2(block->pie_data.pie_dir, seg2);
 
-       if (len < U.pie_menu_threshold * U.dpi_fac)
+       if (len < U.pie_menu_threshold * U.dpi_fac) {
                block->pie_data.flags |= UI_PIE_INVALID_DIR;
-       else
+       }
+       else {
                block->pie_data.flags &= ~UI_PIE_INVALID_DIR;
+       }
 
        return len;
 }
@@ -8618,8 +8864,9 @@ static int ui_handle_menu_event(
                }
        }
        else if (event->type == TIMER) {
-               if (event->customdata == menu->scrolltimer)
+               if (event->customdata == menu->scrolltimer) {
                        ui_menu_scroll_to_y(ar, block, my);
+               }
        }
        else {
                /* for ui_mouse_motion_towards_block */
@@ -8629,10 +8876,12 @@ static int ui_handle_menu_event(
                        }
 
                        /* add menu scroll timer, if needed */
-                       if (ui_menu_scroll_test(block, my))
-                               if (menu->scrolltimer == NULL)
+                       if (ui_menu_scroll_test(block, my)) {
+                               if (menu->scrolltimer == NULL) {
                                        menu->scrolltimer =
                                            WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
+                               }
+                       }
                }
 
                /* first block own event func */
@@ -8668,9 +8917,11 @@ static int ui_handle_menu_event(
 
                                /* Closing sub-levels of pull-downs. */
                                case LEFTARROWKEY:
-                                       if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP))
-                                               if (block->saferct.first)
+                                       if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+                                               if (block->saferct.first) {
                                                        menu->menuretval = UI_RETURN_OUT;
+                                               }
+                                       }
 
                                        retval = WM_UI_HANDLER_BREAK;
                                        break;
@@ -8679,19 +8930,25 @@ static int ui_handle_menu_event(
                                case RIGHTARROWKEY:
                                        if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
 
-                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval))
+                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) {
                                                        break;
+                                               }
 
                                                but = ui_region_find_active_but(ar);
 
                                                if (!but) {
                                                        /* no item active, we make first active */
-                                                       if (block->direction & UI_DIR_UP) but = ui_but_last(block);
-                                                       else but = ui_but_first(block);
+                                                       if (block->direction & UI_DIR_UP) {
+                                                               but = ui_but_last(block);
+                                                       }
+                                                       else {
+                                                               but = ui_but_first(block);
+                                                       }
                                                }
 
-                                               if (but && ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN))
+                                               if (but && ELEM(but->type, UI_BTYPE_BLOCK, UI_BTYPE_PULLDOWN)) {
                                                        ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
+                                               }
                                        }
 
                                        retval = WM_UI_HANDLER_BREAK;
@@ -8728,16 +8985,18 @@ static int ui_handle_menu_event(
                                                int val = event->val;
 
                                                /* convert pan to scrollwheel */
-                                               if (type == MOUSEPAN)
+                                               if (type == MOUSEPAN) {
                                                        ui_pan_to_scroll(event, &type, &val);
+                                               }
 
                                                if (val == KM_PRESS) {
                                                        const bool is_next =
                                                                (ELEM(type, DOWNARROWKEY, WHEELDOWNMOUSE) ==
                                                                ((block->flag & UI_BLOCK_IS_FLIP) != 0));
 
-                                                       if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval))
+                                                       if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) {
                                                                break;
+                                                       }
 
 #ifdef USE_KEYNAV_LIMIT
                                                        ui_mouse_motion_keynav_init(&menu->keynav_state, event);
@@ -8770,40 +9029,71 @@ static int ui_handle_menu_event(
                                        break;
 
                                case ONEKEY:    case PAD1:
-                                       act = 1; ATTR_FALLTHROUGH;
+                                       act = 1;
+                                       ATTR_FALLTHROUGH;
                                case TWOKEY:    case PAD2:
-                                       if (act == 0) act = 2; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 2;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case THREEKEY:  case PAD3:
-                                       if (act == 0) act = 3; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 3;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case FOURKEY:   case PAD4:
-                                       if (act == 0) act = 4; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 4;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case FIVEKEY:   case PAD5:
-                                       if (act == 0) act = 5; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 5;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case SIXKEY:    case PAD6:
-                                       if (act == 0) act = 6; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 6;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case SEVENKEY:  case PAD7:
-                                       if (act == 0) act = 7; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 7;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case EIGHTKEY:  case PAD8:
-                                       if (act == 0) act = 8; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 8;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case NINEKEY:   case PAD9:
-                                       if (act == 0) act = 9; ATTR_FALLTHROUGH;
+                                       if (act == 0) {
+                                               act = 9;
+                                       }
+                                       ATTR_FALLTHROUGH;
                                case ZEROKEY:   case PAD0:
-                                       if (act == 0) act = 10;
+                                       if (act == 0) {
+                                               act = 10;
+                                       }
 
                                        if ((block->flag & UI_BLOCK_NUMSELECT) && event->val == KM_PRESS) {
                                                int count;
 
-                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval))
+                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) {
                                                        break;
+                                               }
 
-                                               if (event->alt) act += 10;
+                                               if (event->alt) {
+                                                       act += 10;
+                                               }
 
                                                count = 0;
                                                for (but = block->buttons.first; but; but = but->next) {
                                                        bool doit = false;
 
-                                                       if (!ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE))
+                                                       if (!ELEM(but->type, UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
                                                                count++;
+                                                       }
 
                                                        /* exception for rna layer buts */
                                                        if (but->rnapoin.data && but->rnaprop &&
@@ -8873,8 +9163,9 @@ static int ui_handle_menu_event(
                                        if ((event->val  == KM_PRESS || event->val == KM_DBL_CLICK) &&
                                            !IS_EVENT_MOD(event, shift, ctrl, oskey))
                                        {
-                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval))
+                                               if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) {
                                                        break;
+                                               }
 
                                                for (but = block->buttons.first; but; but = but->next) {
                                                        if (!(but->flag & UI_BUT_DISABLED) && but->menu_key == event->type) {
@@ -8923,16 +9214,20 @@ static int ui_handle_menu_event(
                                        if (ELEM(event->val, KM_PRESS, KM_DBL_CLICK)) {
                                                if ((is_parent_menu == false) && (U.uiflag & USER_MENUOPENAUTO) == 0) {
                                                        /* for root menus, allow clicking to close */
-                                                       if (block->flag & (UI_BLOCK_OUT_1))
+                                                       if (block->flag & (UI_BLOCK_OUT_1)) {
                                                                menu->menuretval = UI_RETURN_OK;
-                                                       else
+                                                       }
+                                                       else {
                                                                menu->menuretval = UI_RETURN_OUT;
+                                                       }
                                                }
                                                else if (saferct && !BLI_rctf_isect_pt(&saferct->parent, event->x, event->y)) {
-                                                       if (block->flag & (UI_BLOCK_OUT_1))
+                                                       if (block->flag & (UI_BLOCK_OUT_1)) {
                                                                menu->menuretval = UI_RETURN_OK;
-                                                       else
+                                                       }
+                                                       else {
                                                                menu->menuretval = UI_RETURN_OUT;
+                                                       }
                                                }
                                        }
                                        else if (ELEM(event->val, KM_RELEASE, KM_CLICK)) {
@@ -8963,8 +9258,9 @@ static int ui_handle_menu_event(
                        else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) {
                                /* enter will always close this block, we let the event
                                 * get handled by the button if it is activated, otherwise we cancel */
-                               if (!ui_region_find_active_but(ar))
+                               if (!ui_region_find_active_but(ar)) {
                                        menu->menuretval = UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
+                               }
                        }
 #ifdef USE_DRAG_POPUP
                        else if ((event->type == LEFTMOUSE) && (event->val == KM_PRESS) &&
@@ -8995,22 +9291,27 @@ static int ui_handle_menu_event(
                                                 * events we check all preceding block rects too to make
                                                 * arrow keys navigation work */
                                                if (event->type != MOUSEMOVE || saferct == block->saferct.first) {
-                                                       if (BLI_rctf_isect_pt(&saferct->parent, (float)event->x, (float)event->y))
+                                                       if (BLI_rctf_isect_pt(&saferct->parent, (float)event->x, (float)event->y)) {
                                                                break;
-                                                       if (BLI_rctf_isect_pt(&saferct->safety, (float)event->x, (float)event->y))
+                                                       }
+                                                       if (BLI_rctf_isect_pt(&saferct->safety, (float)event->x, (float)event->y)) {
                                                                break;
+                                                       }
                                                }
                                        }
 
                                        /* strict check, and include the parent rect */
                                        if (!menu->dotowards && !saferct) {
-                                               if (block->flag & (UI_BLOCK_OUT_1))
+                                               if (block->flag & (UI_BLOCK_OUT_1)) {
                                                        menu->menuretval = UI_RETURN_OK;
-                                               else
+                                               }
+                                               else {
                                                        menu->menuretval = UI_RETURN_OUT;
+                                               }
                                        }
-                                       else if (menu->dotowards && event->type == MOUSEMOVE)
+                                       else if (menu->dotowards && event->type == MOUSEMOVE) {
                                                retval = WM_UI_HANDLER_BREAK;
+                                       }
                                }
                        }
 
@@ -9045,12 +9346,15 @@ static int ui_handle_menu_event(
        /* if we set a menu return value, ensure we continue passing this on to
         * lower menus and buttons, so always set continue then, and if we are
         * inside the region otherwise, ensure we swallow the event */
-       if (menu->menuretval)
+       if (menu->menuretval) {
                return WM_UI_HANDLER_CONTINUE;
-       else if (inside)
+       }
+       else if (inside) {
                return WM_UI_HANDLER_BREAK;
-       else
+       }
+       else {
                return retval;
+       }
 }
 
 static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPopupBlockHandle *menu)
@@ -9089,8 +9393,9 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo
                 * will actually close the submenu too */
                ui_handle_button_return_submenu(C, event, but);
 
-               if (update)
+               if (update) {
                        submenu->menuretval = 0;
+               }
        }
 
        if (block->flag & (UI_BLOCK_MOVEMOUSE_QUIT | UI_BLOCK_POPOVER)) {
@@ -9168,13 +9473,15 @@ static int ui_but_pie_button_activate(bContext *C, uiBut *but, uiPopupBlockHandl
 {
        uiBut *active_but;
 
-       if (but == NULL)
+       if (but == NULL) {
                return WM_UI_HANDLER_BREAK;
+       }
 
        active_but = ui_region_find_active_but(menu->region);
 
-       if (active_but)
+       if (active_but) {
                button_activate_exit(C, active_but, active_but->active, false, false);
+       }
 
        button_activate_init(C, menu->region, but, BUTTON_ACTIVATE_OVER);
        return ui_but_pie_menu_apply(C, menu, but, false);
@@ -9317,8 +9624,9 @@ static int ui_pie_handler(bContext *C, const wmEvent *event, uiPopupBlockHandle
                                        if (but && (U.pie_menu_confirm > 0) &&
                                            (dist >= U.dpi_fac * (U.pie_menu_threshold + U.pie_menu_confirm)))
                                        {
-                                               if (but)
+                                               if (but) {
                                                        return ui_but_pie_menu_apply(C, menu, but, true);
+                                               }
                                        }
 
                                        retval = ui_but_pie_menu_apply(C, menu, but, true);
@@ -9589,15 +9897,18 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use
        }
 
        if (retval == WM_UI_HANDLER_CONTINUE) {
-               if (but)
+               if (but) {
                        retval = ui_handle_button_event(C, event, but);
-               else
+               }
+               else {
                        retval = ui_handle_button_over(C, event, ar);
+               }
        }
 
        /* re-enable tooltips */
-       if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
+       if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) {
                ui_blocks_set_tooltips(ar, true);
+       }
 
        /* delayed apply callbacks */
        ui_apply_but_funcs_after(C);
@@ -9611,18 +9922,23 @@ static void ui_region_handler_remove(bContext *C, void *UNUSED(userdata))
        ARegion *ar;
 
        ar = CTX_wm_region(C);
-       if (ar == NULL) return;
+       if (ar == NULL) {
+               return;
+       }
 
        UI_blocklist_free(C, &ar->uiblocks);
 
        sc = CTX_wm_screen(C);
-       if (sc == NULL) return;
+       if (sc == NULL) {
+               return;
+       }
 
        /* delayed apply callbacks, but not for screen level regions, those
         * we rather do at the very end after closing them all, which will
         * be done in ui_region_handler/window */
-       if (BLI_findindex(&sc->regionbase, ar) == -1)
+       if (BLI_findindex(&sc->regionbase, ar) == -1) {
                ui_apply_but_funcs_after(C);
+       }
 }
 
 /* handle buttons at the window level, modal, for example while
@@ -9634,8 +9950,9 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
        int retval = WM_UI_HANDLER_CONTINUE;
 
        ar = CTX_wm_menu(C);
-       if (!ar)
+       if (!ar) {
                ar = CTX_wm_region(C);
+       }
 
        but = ui_region_find_active_but(ar);
 
@@ -9706,8 +10023,9 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
        }
 
        /* re-enable tooltips */
-       if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
+       if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) {
                ui_blocks_set_tooltips(ar, true);
+       }
 
        /* delayed apply callbacks */
        ui_apply_but_funcs_after(C);
@@ -9778,20 +10096,24 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
 #endif
 
                if ((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
-                       if (temp.popup_func)
+                       if (temp.popup_func) {
                                temp.popup_func(C, temp.popup_arg, temp.retvalue);
-                       if (temp.optype)
+                       }
+                       if (temp.optype) {
                                WM_operator_name_call_ptr(C, temp.optype, temp.opcontext, NULL);
+                       }
                }
-               else if (temp.cancel_func)
+               else if (temp.cancel_func) {
                        temp.cancel_func(C, temp.popup_arg);
+               }
 
                WM_event_add_mousemove(C);
        }
        else {
                /* re-enable tooltips */
-               if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
+               if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy)) {
                        ui_blocks_set_tooltips(menu->region, true);
+               }
        }
 
        /* delayed apply callbacks */
@@ -9801,8 +10123,9 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
                /* reaqcuire window in case pie invalidates it somehow */
                wmWindow *win = CTX_wm_window(C);
 
-               if (win)
+               if (win) {
                        win->last_pie_event = EVENT_NONE;
+               }
        }
 
        CTX_wm_region_set(C, menu_region);
@@ -9890,8 +10213,9 @@ bool UI_textbutton_activate_rna(
                                }
                        }
                }
-               if (but)
+               if (but) {
                        break;
+               }
        }
 
        if (but) {
@@ -9910,12 +10234,15 @@ bool UI_textbutton_activate_but(const bContext *C, uiBut *actbut)
        uiBut *but = NULL;
 
        for (block = ar->uiblocks.first; block; block = block->next) {
-               for (but = block->buttons.first; but; but = but->next)
-                       if (but == actbut && but->type == UI_BTYPE_TEXT)
+               for (but = block->buttons.first; but; but = but->next) {
+                       if (but == actbut && but->type == UI_BTYPE_TEXT) {
                                break;
+                       }
+               }
 
-               if (but)
+               if (but) {
                        break;
+               }
        }
 
        if (but) {
@@ -9944,9 +10271,11 @@ void UI_screen_free_active_but(const bContext *C, bScreen *screen)
                        if (but) {
                                uiHandleButtonData *data = but->active;
 
-                               if (data->menu == NULL && data->searchbox == NULL)
-                                       if (data->state == BUTTON_STATE_HIGHLIGHT)
+                               if (data->menu == NULL && data->searchbox == NULL) {
+                                       if (data->state == BUTTON_STATE_HIGHLIGHT) {
                                                ui_but_active_free(C, but);
+                                       }
+                               }
                        }
                }
        }
@@ -9961,8 +10290,9 @@ bool UI_but_active_drop_name(bContext *C)
        uiBut *but = ui_region_find_active_but(ar);
 
        if (but) {
-               if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU))
+               if (ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_SEARCH_MENU)) {
                        return 1;
+               }
        }
 
        return 0;
@@ -9975,8 +10305,9 @@ bool UI_but_active_drop_color(bContext *C)
        if (ar) {
                uiBut *but = ui_region_find_active_but(ar);
 
-               if (but && but->type == UI_BTYPE_COLOR)
+               if (but && but->type == UI_BTYPE_COLOR) {
                        return true;
+               }
        }
 
        return false;
index 8606779..96086b2 100644 (file)
@@ -206,8 +206,9 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
                        iimg->rect = MEM_mallocN(size * size * sizeof(uint), "icon_rect");
 
                        /* Here we store the rect in the icon - same as before */
-                       if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0)
+                       if (size == bbuf->x && size == bbuf->y && xofs == 0 && yofs == 0) {
                                memcpy(iimg->rect, bbuf->rect, size * size * sizeof(int));
+                       }
                        else {
                                /* this code assumes square images */
                                imgsize = bbuf->x;
@@ -674,15 +675,17 @@ static void init_event_icons(void)
 static void icon_verify_datatoc(IconImage *iimg)
 {
        /* if it has own rect, things are all OK */
-       if (iimg->rect)
+       if (iimg->rect) {
                return;
+       }
 
        if (iimg->datatoc_rect) {
                ImBuf *bbuf = IMB_ibImageFromMemory(iimg->datatoc_rect,
                                                    iimg->datatoc_size, IB_rect, NULL, "<matcap icon>");
                /* w and h were set on initialize */
-               if (bbuf->x != iimg->h && bbuf->y != iimg->w)
+               if (bbuf->x != iimg->h && bbuf->y != iimg->w) {
                        IMB_scaleImBuf(bbuf, iimg->w, iimg->h);
+               }
 
                iimg->rect = bbuf->rect;
                bbuf->rect = NULL;
@@ -718,17 +721,21 @@ static void init_internal_icons(void)
                }
        }
 #endif
-       if (b16buf == NULL)
+       if (b16buf == NULL) {
                b16buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons16_png,
                                               datatoc_blender_icons16_png_size, IB_rect, NULL, "<blender icons>");
-       if (b16buf)
+       }
+       if (b16buf) {
                IMB_premultiply_alpha(b16buf);
+       }
 
-       if (b32buf == NULL)
+       if (b32buf == NULL) {
                b32buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons32_png,
                                               datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>");
-       if (b32buf)
+       }
+       if (b32buf) {
                IMB_premultiply_alpha(b32buf);
+       }
 
        if (b16buf && b32buf) {
                /* Free existing texture if any. */
@@ -835,8 +842,9 @@ static void init_iconfile_list(struct ListBase *list)
        BLI_listbase_clear(list);
        icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons");
 
-       if (icondir == NULL)
+       if (icondir == NULL) {
                return;
+       }
 
        totfile = BLI_filelist_dir_contents(icondir, &dir);
 
@@ -944,8 +952,9 @@ void UI_icons_free_drawinfo(void *drawinfo)
        if (di) {
                if (di->type == ICON_TYPE_BUFFER) {
                        if (di->data.buffer.image) {
-                               if (di->data.buffer.image->rect)
+                               if (di->data.buffer.image->rect) {
                                        MEM_freeN(di->data.buffer.image->rect);
+                               }
                                MEM_freeN(di->data.buffer.image);
                        }
                }
@@ -1008,8 +1017,9 @@ int UI_icon_get_width(int icon_id)
        icon = BKE_icon_get(icon_id);
 
        if (icon == NULL) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
+               }
                return 0;
        }
 
@@ -1025,8 +1035,9 @@ int UI_icon_get_height(int icon_id)
 {
        Icon *icon = BKE_icon_get(icon_id);
        if (icon == NULL) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
+               }
                return 0;
        }
 
@@ -1069,8 +1080,9 @@ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
        uint render_size = UI_preview_render_size(size);
 
        if (!prv_img) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("%s, error: requested preview image does not exist", __func__);
+               }
        }
        else if (!prv_img->rect[size]) {
                prv_img->w[size] = render_size;
@@ -1105,8 +1117,9 @@ static void ui_studiolight_free_function(StudioLight *sl, void *data)
        wmWindowManager *wm = data;
 
        /* Happens if job was canceled or already finished. */
-       if (wm == NULL)
+       if (wm == NULL) {
                return;
+       }
 
        // get icons_id, get icons and kill wm jobs
        if (sl->icon_id_radiance) {
@@ -1195,8 +1208,9 @@ static void icon_set_image(
         const bContext *C, Scene *scene, ID *id, PreviewImage *prv_img, enum eIconSizes size, const bool use_job)
 {
        if (!prv_img) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("%s: no preview image for this ID: %s\n", __func__, id->name);
+               }
                return;
        }
 
@@ -1321,8 +1335,9 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
        immDrawPixelsTex(&state, draw_x, draw_y, draw_w, draw_h, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, rect,
                         1.0f, 1.0f, col);
 
-       if (ima)
+       if (ima) {
                IMB_freeImBuf(ima);
+       }
 }
 
 /* High enough to make a difference, low enough so that
@@ -1353,8 +1368,9 @@ void UI_icon_draw_cache_begin(void)
 
 static void icon_draw_cache_flush_ex(void)
 {
-       if (g_icon_draw_cache.calls == 0)
+       if (g_icon_draw_cache.calls == 0) {
                return;
+       }
 
        /* We need to flush widget base first to ensure correct ordering. */
        UI_widgetbase_draw_cache_flush();
@@ -1388,8 +1404,9 @@ void UI_icon_draw_cache_end(void)
        g_icon_draw_cache.enabled = false;
 
        /* Don't change blend state if it's not needed. */
-       if (g_icon_draw_cache.calls == 0)
+       if (g_icon_draw_cache.calls == 0) {
                return;
+       }
 
        GPU_blend(true);
        icon_draw_cache_flush_ex();
@@ -1418,8 +1435,12 @@ static void icon_draw_texture_cached(
        call->tex.ymin = iy * icongltex.invh;
        call->tex.ymax = (iy + ih) * icongltex.invh;
 
-       if (rgb) copy_v4_fl4(call->color, rgb[0], rgb[1], rgb[2], alpha);
-       else     copy_v4_fl(call->color, alpha);
+       if (rgb) {
+               copy_v4_fl4(call->color, rgb[0], rgb[1], rgb[2], alpha);
+       }
+       else {
+               copy_v4_fl(call->color, alpha);
+       }
 
        if (g_icon_draw_cache.calls == ICON_DRAW_CACHE_SIZE) {
                icon_draw_cache_flush_ex();
@@ -1453,8 +1474,12 @@ static void icon_draw_texture(
        GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR);
        GPU_shader_bind(shader);
 
-       if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha);
-       else     glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
+       if (rgb) {
+               glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha);
+       }
+       else {
+               glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha);
+       }
 
        glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0);
        glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), x1, y1, x2, y2);
@@ -1496,8 +1521,9 @@ static void icon_draw_size(
        alpha *= btheme->tui.icon_alpha;
 
        if (icon == NULL) {
-               if (G.debug & G_DEBUG)
+               if (G.debug & G_DEBUG) {
                        printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
+               }
                return;
        }
 
@@ -1583,7 +1609,10 @@ static void icon_draw_size(
 #ifndef WITH_HEADLESS
                icon_verify_datatoc(iimg);
 #endif
-               if (!iimg->rect) return;  /* something has gone wrong! */
+               if (!iimg->rect) {
+                       /* something has gone wrong! */
+                       return;
+               }
 
                icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, desaturate);
        }
@@ -1592,7 +1621,10 @@ static void icon_draw_size(
 
                if (pi) {
                        /* no create icon on this level in code */
-                       if (!pi->rect[size]) return;  /* something has gone wrong! */
+                       if (!pi->rect[size]) {
+                               /* Something has gone wrong! */
+                               return;
+                       }
 
                        /* Preview images use premultiplied alpha. */
                        GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
@@ -1643,8 +1675,9 @@ static void ui_id_icon_render(const bContext *C, ID *id, bool use_jobs)
        PreviewImage *pi = BKE_previewimg_id_ensure(id);
        enum eIconSizes i;
 
-       if (!pi)
+       if (!pi) {
                return;
+       }
 
        for (i = 0; i < NUM_ICON_SIZES; i++) {
                /* check if rect needs to be created; changed
@@ -1809,8 +1842,9 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big
 {
        ID *id = NULL;
 
-       if (!ptr->data)
+       if (!ptr->data) {
                return rnaicon;
+       }
 
        /* try ID, material, texture or dynapaint slot */
        if (RNA_struct_is_ID(ptr->type)) {
@@ -1825,12 +1859,15 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big
        else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) {
                DynamicPaintSurface *surface = ptr->data;
 
-               if (surface->format == MOD_DPAINT_SURFACE_F_PTEX)
+               if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
                        return ICON_SHADING_TEXTURE;
-               else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX)
+               }
+               else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
                        return ICON_OUTLINER_DATA_MESH;
-               else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
+               }
+               else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
                        return ICON_FILE_IMAGE;
+               }
        }
        else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) {
                StudioLight *sl = ptr->data;
index b02b327..bb3172d 100644 (file)
@@ -236,8 +236,9 @@ static int ui_item_fit(int item, int pos, int all, int available, bool is_last,
 
        if (all > available) {
                /* contents is bigger than available space */
-               if (is_last)
+               if (is_last) {
                        return available - pos;
+               }
                else {
                        float width = *extra_pixel + (item * available) / (float)all;
                        *extra_pixel = width - (int)width;
@@ -247,8 +248,9 @@ static int ui_item_fit(int item, int pos, int all, int available, bool is_last,
        else {
                /* contents is smaller or equal to available space */
                if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
-                       if (is_last)
+                       if (is_last) {
                                return available - pos;
+                       }
                        else {
                                float width = *extra_pixel + (item * available) / (float)all;
                                *extra_pixel = width - (int)width;
@@ -286,8 +288,9 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool
        bool variable;
        const int unit_x = UI_UNIT_X * (layout->scale[0] ? layout->scale[0] : 1.0f);
 
-       if (icon && !name[0])
+       if (icon && !name[0]) {
                return unit_x;  /* icon only */
+       }
 
        variable = ui_layout_variable_size(layout);
 
@@ -315,14 +318,22 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h)
        if (item->type == ITEM_BUTTON) {
                uiButtonItem *bitem = (uiButtonItem *)item;
 
-               if (r_w) *r_w = BLI_rctf_size_x(&bitem->but->rect);
-               if (r_h) *r_h = BLI_rctf_size_y(&bitem->but->rect);
+               if (r_w) {
+                       *r_w = BLI_rctf_size_x(&bitem->but->rect);
+               }
+               if (r_h) {
+                       *r_h = BLI_rctf_size_y(&bitem->but->rect);
+               }
        }
        else {
                uiLayout *litem = (uiLayout *)item;
 
-               if (r_w) *r_w = litem->w;
-               if (r_h) *r_h = litem->h;
+               if (r_w) {
+                       *r_w = litem->w;
+               }
+               if (r_h) {
+                       *r_h = litem->h;
+               }
        }
 }
 
@@ -331,12 +342,20 @@ static void ui_item_offset(uiItem *item, int *r_x, int *r_y)
        if (item->type == ITEM_BUTTON) {
                uiButtonItem *bitem = (uiButtonItem *)item;
 
-               if (r_x) *r_x = bitem->but->rect.xmin;
-               if (r_y) *r_y = bitem->but->rect.ymin;
+               if (r_x) {
+                       *r_x = bitem->but->rect.xmin;
+               }
+               if (r_y) {
+                       *r_y = bitem->but->rect.ymin;
+               }
        }
        else {
-               if (r_x) *r_x = 0;
-               if (r_y) *r_y = 0;
+               if (r_x) {
+                       *r_x = 0;
+               }
+               if (r_y) {
+                       *r_y = 0;
+               }
        }
 }
 
@@ -375,10 +394,12 @@ static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax)
        else {
                uiLayout *litem = (uiLayout *)item;
 
-               if (delta_xmin > 0)
+               if (delta_xmin > 0) {
                        litem->x += delta_xmin;
-               else
+               }
+               else {
                        litem->w += delta_xmax;
+               }
        }
 }
 
@@ -406,10 +427,12 @@ static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, bool
 {
        uiLayout *sub;
 
-       if (uiLayoutGetLocalDir(test) == UI_LAYOUT_HORIZONTAL)
+       if (uiLayoutGetLocalDir(test) == UI_LAYOUT_HORIZONTAL) {
                sub = uiLayoutRow(layout, align);
-       else
+       }
+       else {
                sub = uiLayoutColumn(layout, align);
+       }
 
        sub->space = 0;
        return sub;
@@ -428,14 +451,17 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
        if (!shift) {
                RNA_property_boolean_set_index(ptr, prop, index, true);
 
-               for (i = 0; i < len; i++)
-                       if (i != index)
+               for (i = 0; i < len; i++) {
+                       if (i != index) {
                                RNA_property_boolean_set_index(ptr, prop, i, 0);
+                       }
+               }
 
                RNA_property_update(C, ptr, prop);
 
-               for (cbut = but->block->buttons.first; cbut; cbut = cbut->next)
+               for (cbut = but->block->buttons.first; cbut; cbut = cbut->next) {
                        ui_but_update(cbut);
+               }
        }
 }
 
@@ -504,36 +530,42 @@ static void ui_item_array(
                                const uint layer_flag = (1u << layer_num);
 
                                if (layer_used & layer_flag) {
-                                       if (layer_active & layer_flag)
+                                       if (layer_active & layer_flag) {
                                                icon = ICON_LAYER_ACTIVE;
-                                       else
+                                       }
+                                       else {
                                                icon = ICON_LAYER_USED;
+                                       }
                                }
                                else {
                                        icon = ICON_BLANK1;
                                }
 
                                but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth);
-                               if (subtype == PROP_LAYER_MEMBER)
+                               if (subtype == PROP_LAYER_MEMBER) {
                                        UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num));
+                               }
                        }
                        for (a = 0; a < colbuts; a++) {
                                const int layer_num  = a + len / 2 + b * colbuts;
                                const uint layer_flag = (1u << layer_num);
 
                                if (layer_used & layer_flag) {
-                                       if (layer_active & layer_flag)
+                                       if (layer_active & layer_flag) {
                                                icon = ICON_LAYER_ACTIVE;
-                                       else
+                                       }
+                                       else {
                                                icon = ICON_LAYER_USED;
+                                       }
                                }
                                else {
                                        icon = ICON_BLANK1;
                                }
 
                                but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth);
-                               if (subtype == PROP_LAYER_MEMBER)
+                               if (subtype == PROP_LAYER_MEMBER) {
                                        UI_but_func_set(but, ui_layer_but_cb, but, POINTER_FROM_INT(layer_num));
+                               }
                        }
                        UI_block_align_end(block);
 
@@ -547,7 +579,10 @@ static void ui_item_array(
                UI_block_layout_set_current(block, uiLayoutAbsolute(layout, true));
 
                totdim = RNA_property_array_dimension(ptr, prop, dim_size);
-               if (totdim != 2) return;    /* only 2D matrices supported in UI so far */
+               if (totdim != 2) {
+                       /* Only 2D matrices supported in UI so far. */
+                       return;
+               }
 
                w /= dim_size[0];
                /* h /= dim_size[1]; */ /* UNUSED */
@@ -557,8 +592,9 @@ static void ui_item_array(
                        row = a / dim_size[0];
 
                        but = uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w * col, y + (dim_size[1] * UI_UNIT_Y) - (row * UI_UNIT_Y), w, UI_UNIT_Y);
-                       if (slider && but->type == UI_BTYPE_NUM)
+                       if (slider && but->type == UI_BTYPE_NUM) {
                                but->type = UI_BTYPE_NUM_SLIDER;
+                       }
                }
        }
        else if (subtype == PROP_DIRECTION && !expand) {
@@ -608,12 +644,15 @@ static void ui_item_array(
                                        min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w);
 
                                but = uiDefAutoButR(block, ptr, prop, a, str_buf, icon, 0, 0, width_item, UI_UNIT_Y);
-                               if (slider && but->type == UI_BTYPE_NUM)
+                               if (slider && but->type == UI_BTYPE_NUM) {
                                        but->type = UI_BTYPE_NUM_SLIDER;
-                               if (toggle && but->type == UI_BTYPE_CHECKBOX)
+                               }
+                               if (toggle && but->type == UI_BTYPE_CHECKBOX) {
                                        but->type = UI_BTYPE_TOGGLE;
-                               if ((a == 0) && (subtype == PROP_AXISANGLE))
+                               }
+                               if ((a == 0) && (subtype == PROP_AXISANGLE)) {
                                        UI_but_unit_type_set(but, PROP_UNIT_ROTATION);
+                               }
                        }
 
                        if (boolarr) {
@@ -665,10 +704,12 @@ static void ui_item_enum_expand_exec(
 
        BLI_assert(RNA_property_type(prop) == PROP_ENUM);
 
-       if (radial)
+       if (radial) {
                RNA_property_enum_items_gettexted_all(block->evil_C, ptr, prop, &item_array, NULL, &free);
-       else
+       }
+       else {
                RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item_array, NULL, &free);
+       }
 
        /* we dont want nested rows, cols in menus */
        if (radial) {
@@ -721,12 +762,15 @@ static void ui_item_enum_expand_exec(
                value = item->value;
                itemw = ui_text_icon_width(block->curlayout, icon_only ? "" : name, icon, 0);
 
-               if (icon && name[0] && !icon_only)
+               if (icon && name[0] && !icon_only) {
                        but = uiDefIconTextButR_prop(block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
-               else if (icon)
+               }
+               else if (icon) {
                        but = uiDefIconButR_prop(block, but_type, 0, icon, 0, 0, (is_first) ? itemw : ceilf(itemw - U.pixelsize), h, ptr, prop, -1, 0, value, -1, -1, NULL);
-               else
+               }
+               else {
                        but = uiDefButR_prop(block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+               }
 
                if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
                        /* If this is set, assert since we're clobbering someone elses callback. */
@@ -734,8 +778,9 @@ static void ui_item_enum_expand_exec(
                        UI_but_func_set(but, ui_item_enum_expand_handle, but, POINTER_FROM_INT(value));
                }
 
-               if (uiLayoutGetLocalDir(layout) != UI_LAYOUT_HORIZONTAL)
+               if (uiLayoutGetLocalDir(layout) != UI_LAYOUT_HORIZONTAL) {
                        but->drawflag |= UI_BUT_TEXT_LEFT;
+               }
 
                /* Allow quick, inaccurate swipe motions to switch tabs
                 * (no need to keep cursor over them). */
@@ -849,8 +894,9 @@ static uiBut *ui_item_with_label(
 
                        but = uiDefButR_prop(block, UI_BTYPE_HOTKEY_EVENT, 0, buf, x, y, prop_but_width, h, ptr, prop, 0, 0, 0, -1, -1, NULL);
                        UI_but_func_set(but, ui_keymap_but_cb, but, NULL);
-                       if (flag & UI_ITEM_R_IMMEDIATE)
+                       if (flag & UI_ITEM_R_IMMEDIATE) {
                                UI_but_flag_enable(but, UI_BUT_IMMEDIATE);
+                       }
                }
        }
        else {
@@ -887,8 +933,9 @@ void UI_context_active_but_prop_get_filebrowser(
        *r_prop = NULL;
        *r_is_undo = false;
 
-       if (!ar)
+       if (!ar) {
                return;
+       }
 
        for (block = ar->uiblocks.first; block; block = block->next) {
                for (but = block->buttons.first; but; but = but->next) {
@@ -932,8 +979,9 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
 
        UI_block_layout_set_current(block, layout);
 
-       if (!name)
+       if (!name) {
                name = "";
+       }
 
        w = ui_text_icon_width(layout, name, 0, 0);
 
@@ -958,14 +1006,17 @@ static uiBut *uiItemFullO_ptr_ex(
        int w;
 
        if (!name) {
-               if (ot && ot->srna && (flag & UI_ITEM_R_ICON_ONLY) == 0)
+               if (ot && ot->srna && (flag & UI_ITEM_R_ICON_ONLY) == 0) {
                        name = RNA_struct_ui_name(ot->srna);
-               else
+               }
+               else {
                        name = "";
+               }
        }
 
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        /* create button */
        UI_block_layout_set_current(block, layout);
@@ -993,8 +1044,9 @@ static uiBut *uiItemFullO_ptr_ex(
        assert(but->optype != NULL);
 
        /* text alignment for toolbar buttons */
-       if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
+       if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon) {
                but->drawflag |= UI_BUT_TEXT_LEFT;
+       }
 
        if (flag & UI_ITEM_R_NO_BG) {
                layout->emboss = prev_emboss;
@@ -1004,8 +1056,9 @@ static uiBut *uiItemFullO_ptr_ex(
                but->flag |= UI_SELECT_DRAW;
        }
 
-       if (layout->redalert)
+       if (layout->redalert) {
                UI_but_flag_enable(but, UI_BUT_REDALERT);
+       }
 
        /* assign properties */
        if (properties || r_opptr) {
@@ -1139,8 +1192,9 @@ void uiItemEnumO_ptr(uiLayout *layout, wmOperatorType *ot, const char *name, int
 
        RNA_property_enum_set(&ptr, prop, value);
 
-       if (!name)
+       if (!name) {
                name = ui_menu_enumpropname(layout, &ptr, prop, value);
+       }
 
        uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0, NULL);
 }
@@ -1205,9 +1259,11 @@ void uiItemsFullEnumO_items(
 
                                /* Check if there are more visible items for the next level. If not, we don't
                                 * add a new level and add the remaining item instead of the 'more' button. */
-                               for (tmp = item + 1; tmp->identifier; tmp++)
-                                       if (tmp->name)
+                               for (tmp = item + 1; tmp->identifier; tmp++) {
+                                       if (tmp->name) {
                                                break;
+                                       }
+                               }
 
                                if (tmp->identifier) { /* only true if loop above found item and did early-exit */
                                        ui_pie_menu_level_create(block, ot, propname, properties, item_array, totitem, context, flag);
@@ -1374,8 +1430,9 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
        RNA_property_enum_set(&ptr, prop, value);
 
        /* same as uiItemEnumO */
-       if (!name)
+       if (!name) {
                name = ui_menu_enumpropname(layout, &ptr, prop, value);
+       }
 
        uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0, NULL);
 }
@@ -1418,8 +1475,9 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
        RNA_property_enum_set(&ptr, prop, value);
 
        /* same as uiItemEnumO */
-       if (!name)
+       if (!name) {
                name = ui_menu_enumpropname(layout, &ptr, prop, value);
+       }
 
        uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0, NULL);
 }
@@ -1525,8 +1583,9 @@ static void ui_item_rna_size(
        if (!w) {
                if (type == PROP_ENUM && icon_only) {
                        w = ui_text_icon_width(layout, "", ICON_BLANK1, compact);
-                       if (index != RNA_ENUM_VALUE)
+                       if (index != RNA_ENUM_VALUE) {
                                w += 0.6f * UI_UNIT_X;
+                       }
                }
                else {
                        /* not compact for float/int buttons, looks too squashed */
@@ -1537,24 +1596,32 @@ static void ui_item_rna_size(
 
        /* increase height for arrays */
        if (index == RNA_NO_INDEX && len > 0) {
-               if (!name[0] && icon == ICON_NONE)
+               if (!name[0] && icon == ICON_NONE) {
                        h = 0;
-               if (layout->item.flag & UI_ITEM_PROP_SEP)
+               }
+               if (layout->item.flag & UI_ITEM_PROP_SEP) {
                        h = 0;
-               if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
+               }
+               if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
                        h += 2 * UI_UNIT_Y;
-               else if (subtype == PROP_MATRIX)
+               }
+               else if (subtype == PROP_MATRIX) {
                        h += ceilf(sqrtf(len)) * UI_UNIT_Y;
-               else
+               }
+               else {
                        h += len * UI_UNIT_Y;
+               }
        }
        else if (ui_layout_variable_size(layout)) {
-               if (type == PROP_BOOLEAN && name[0])
+               if (type == PROP_BOOLEAN && name[0]) {
                        w += UI_UNIT_X / 5;
-               else if (type == PROP_ENUM && !icon_only)
+               }
+               else if (type == PROP_ENUM && !icon_only) {
                        w += UI_UNIT_X / 4;
-               else if (type == PROP_FLOAT || type == PROP_INT)
+               }
+               else if (type == PROP_FLOAT || type == PROP_INT) {
                        w += UI_UNIT_X * 3;
+               }
        }
 
        *r_w = w;
@@ -1611,8 +1678,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
                }
        }
 
-       if (icon == ICON_NONE)
+       if (icon == ICON_NONE) {
                icon = RNA_property_ui_icon(prop);
+       }
 
        if (flag & UI_ITEM_R_ICON_ONLY) {
                /* pass */
@@ -1802,12 +1870,15 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
        }
        /* enum item */
        else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
-               if (icon && name[0] && !icon_only)
+               if (icon && name[0] && !icon_only) {
                        uiDefIconTextButR_prop(block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
-               else if (icon)
+               }
+               else if (icon) {
                        uiDefIconButR_prop(block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
-               else
+               }
+               else {
                        uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+               }
        }
        /* expanded enum */
        else if (type == PROP_ENUM && expand) {
@@ -1818,27 +1889,33 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
                but = ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
                ui_but_add_search(but, ptr, prop, NULL, NULL);
 
-               if (layout->redalert)
+               if (layout->redalert) {
                        UI_but_flag_enable(but, UI_BUT_REDALERT);
+               }
 
-               if (layout->activate_init)
+               if (layout->activate_init) {
                        UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
+               }
        }
        /* single button */
        else {
                but = uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
 
-               if (slider && but->type == UI_BTYPE_NUM)
+               if (slider && but->type == UI_BTYPE_NUM) {
                        but->type = UI_BTYPE_NUM_SLIDER;
+               }
 
-               if (toggle && but->type == UI_BTYPE_CHECKBOX)
+               if (toggle && but->type == UI_BTYPE_CHECKBOX) {
                        but->type = UI_BTYPE_TOGGLE;
+               }
 
-               if (layout->redalert)
+               if (layout->redalert) {
                        UI_but_flag_enable(but, UI_BUT_REDALERT);
+               }
 
-               if (layout->activate_init)
+               if (layout->activate_init) {
                        UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
+               }
 
                if (use_prop_sep && (use_prop_sep_split_label == false)) {
                        /* When the button uses it's own text right align it. */
@@ -2040,8 +2117,9 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
 
                                        ui_but_tip_from_enum_item(bt, &item[i]);
                                }
-                               else
+                               else {
                                        uiItemS(column);
+                               }
                        }
                }
 
@@ -2160,15 +2238,18 @@ void uiItemPointerR_prop(
 
        /* get icon & name */
        if (icon == ICON_NONE) {
-               if (type == PROP_POINTER)
+               if (type == PROP_POINTER) {
                        icontype = RNA_property_pointer_type(ptr, prop);
-               else
+               }
+               else {
                        icontype = RNA_property_pointer_type(searchptr, searchprop);
+               }
 
                icon = RNA_struct_ui_icon(icontype);
        }
-       if (!name)
+       if (!name) {
                name = RNA_property_ui_name(prop);
+       }
 
        if (use_prop_sep == false) {
                name = ui_item_name_add_colon(name, namestr);
@@ -2239,10 +2320,12 @@ static uiBut *ui_item_menu(
 
        UI_block_layout_set_current(block, layout);
 
-       if (!name)
+       if (!name) {
                name = "";
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       }
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        w = ui_text_icon_width(layout, name, icon, 1);
        h = UI_UNIT_Y;
@@ -2304,8 +2387,9 @@ void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon)
                name = CTX_IFACE_(mt->translation_context, mt->label);
        }
 
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        ui_item_menu(
                layout, name, icon, ui_item_menutype_func, mt, NULL,
@@ -2404,10 +2488,12 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
 
        UI_block_layout_set_current(block, layout);
 
-       if (!name)
+       if (!name) {
                name = "";
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       }
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        w = ui_text_icon_width(layout, name, icon, 0);
 
@@ -2450,9 +2536,11 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
 {
        uiBut *but = uiItemL_(layout, name, icon);
 
-       if (ptr && ptr->type)
-               if (RNA_struct_is_ID(ptr->type))
+       if (ptr && ptr->type) {
+               if (RNA_struct_is_ID(ptr->type)) {
                        UI_but_drag_set_id(but, ptr->id.data);
+               }
+       }
 }
 
 
@@ -2466,19 +2554,24 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
 
        UI_block_layout_set_current(block, layout);
 
-       if (!name)
+       if (!name) {
                name = "";
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       }
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        w = ui_text_icon_width(layout, name, icon, 0);
 
-       if (icon && name[0])
+       if (icon && name[0]) {
                uiDefIconTextButI(block, UI_BTYPE_BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
-       else if (icon)
+       }
+       else if (icon) {
                uiDefIconButI(block, UI_BTYPE_BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
-       else
+       }
+       else {
                uiDefButI(block, UI_BTYPE_BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, -1, "");
+       }
 }
 
 /* separator item */
@@ -2522,8 +2615,9 @@ void uiItemSpacer(uiLayout *layout)
 /* level items */
 void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
 {
-       if (!func)
+       if (!func) {
                return;
+       }
 
        ui_item_menu(layout, name, icon, func, arg, NULL, "", false);
 }
@@ -2533,8 +2627,9 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc
  */
 void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN)
 {
-       if (!func)
+       if (!func) {
                return;
+       }
 
        /* Second 'argN' only ensures it gets freed. */
        ui_item_menu(layout, name, icon, func, argN, argN, "", false);
@@ -2576,8 +2671,9 @@ void uiItemMenuEnumO_ptr(
                name = RNA_struct_ui_name(ot->srna);
        }
 
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        lvl = MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
        BLI_strncpy(lvl->opname, ot->idname, sizeof(lvl->opname));
@@ -2632,10 +2728,12 @@ void uiItemMenuEnumR_prop(uiLayout *layout, struct PointerRNA *ptr, PropertyRNA
 {
        MenuItemLevel *lvl;
 
-       if (!name)
+       if (!name) {
                name = RNA_property_ui_name(prop);
-       if (layout->root->type == UI_LAYOUT_MENU && !icon)
+       }
+       if (layout->root->type == UI_LAYOUT_MENU && !icon) {
                icon = ICON_BLANK1;
+       }
 
        lvl = MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
        lvl->rnapoin = *ptr;
@@ -2687,8 +2785,9 @@ static void ui_litem_estimate_row(uiLayout *litem)
                litem->w += itemw;
                litem->h = MAX2(itemh, litem->h);
 
-               if (item->next)
+               if (item->next) {
                        litem->w += litem->space;
+               }
        }
 
        if (min_size_flag) {
@@ -2720,11 +2819,13 @@ static void ui_litem_layout_row(uiLayout *litem)
                tot++;
        }
 
-       if (totw == 0)
+       if (totw == 0) {
                return;
+       }
 
-       if (w != 0)
+       if (w != 0) {
                w -= (tot - 1) * litem->space;
+       }
        fixedw = 0;
 
        /* keep clamping items to fixed minimum size until all are done */
@@ -2736,16 +2837,19 @@ static void ui_litem_layout_row(uiLayout *litem)
                extra_pixel = 0.0f;
 
                for (item = litem->items.first; item; item = item->next) {
-                       if (item->flag & UI_ITEM_FIXED)
+                       if (item->flag & UI_ITEM_FIXED) {
                                continue;
+                       }
 
                        ui_item_size(item, &itemw, &itemh);
                        minw = ui_litem_min_width(itemw);
 
-                       if (w - lastw > 0)
+                       if (w - lastw > 0) {
                                neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, &extra_pixel);
-                       else
+                       }
+                       else {
                                neww = 0;  /* no space left, all will need clamping to minimum size */
+                       }
 
                        x += neww;
 
@@ -2807,20 +2911,23 @@ static void ui_litem_layout_row(uiLayout *litem)
                /* align right/center */
                offset = 0;
                if (litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
-                       if (freew + fixedw > 0 && freew + fixedw < w)
+                       if (freew + fixedw > 0 && freew + fixedw < w) {
                                offset = w - (fixedw + freew);
+                       }
                }
                else if (litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
-                       if (freew + fixedw > 0 && freew + fixedw < w)
+                       if (freew + fixedw > 0 && freew + fixedw < w) {
                                offset = (w - (fixedw + freew)) / 2;
+                       }
                }
 
                /* position item */
                ui_item_position(item, x + offset, y - itemh, itemw, itemh);
 
                x += itemw;
-               if (item->next)
+               if (item->next) {
                        x += litem->space;
+               }
        }
 
        /* add extra pixel */
@@ -2830,8 +2937,9 @@ static void ui_litem_layout_row(uiLayout *litem)
            last_free_item && last_item && last_item->flag & UI_ITEM_FIXED)
        {
                ui_item_move(last_free_item, 0, extra_pixel);
-               for (item = last_free_item->next; item; item = item->next)
+               for (item = last_free_item->next; item; item = item->next) {
                        ui_item_move(item, extra_pixel, extra_pixel);
+               }
        }
 
        litem->w = x - litem->x;
@@ -2858,8 +2966,9 @@ static void ui_litem_estimate_column(uiLayout *litem, bool is_box)
                litem->w = MAX2(litem->w, itemw);
                litem->h += itemh;
 
-               if (item->next && (!is_box || item != litem->items.first))
+               if (item->next && (!is_box || item != litem->items.first)) {
                        litem->h += litem->space;
+               }
        }
 
        if (min_size_flag) {
@@ -2881,8 +2990,9 @@ static void ui_litem_layout_column(uiLayout *litem, bool is_box)
                y -= itemh;
                ui_item_position(item, x, y, litem->w, itemh);
 
-               if (item->next && (!is_box || item != litem->items.first))
+               if (item->next && (!is_box || item != litem->items.first)) {
                        y -= litem->space;
+               }
 
                if (is_box) {
                        item->flag |= UI_ITEM_BOX_ITEM;
@@ -2914,8 +3024,9 @@ static RadialDirection ui_get_radialbut_vec(float vec[2], short itemnum)
 static bool ui_item_is_radial_displayable(uiItem *item)
 {
 
-       if ((item->type == ITEM_BUTTON) && (((uiButtonItem *)item)->but->type == UI_BTYPE_LABEL))
+       if ((item->type == ITEM_BUTTON) && (((uiButtonItem *)item)->but->type == UI_BTYPE_LABEL)) {
                return false;
+       }
 
        return true;
 }
@@ -2923,8 +3034,9 @@ static bool ui_item_is_radial_displayable(uiItem *item)
 static bool ui_item_is_radial_drawable(uiButtonItem *bitem)
 {
 
-       if (ELEM(bitem->but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER))
+       if (ELEM(bitem->but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_SEPR_SPACER)) {
                return false;
+       }
 
        return true;
 }
@@ -2949,11 +3061,13 @@ static void ui_litem_layout_radial(uiLayout *litem)
        int minx = x, miny = y, maxx = x, maxy = y;
 
        /* first count total items */
-       for (item = litem->items.first; item; item = item->next)
+       for (item = litem->items.first; item; item = item->next) {
                totitems++;
+       }
 
-       if (totitems < 5)
+       if (totitems < 5) {
                litem->root->block->pie_data.flags |= UI_PIE_DEGREES_RANGE_LARGE;
+       }
 
        for (item = litem->items.first; item; item = item->next) {
                /* not all button types are drawn in a radial menu, do filtering here */
@@ -3024,12 +3138,15 @@ static void ui_litem_layout_root_radial(uiLayout *litem)
 
 static void ui_litem_layout_root(uiLayout *litem)
 {
-       if (litem->root->type == UI_LAYOUT_HEADER)
+       if (litem->root->type == UI_LAYOUT_HEADER) {
                ui_litem_layout_row(litem);
-       else if (litem->root->type == UI_LAYOUT_PIEMENU)
+       }
+       else if (litem->root->type == UI_LAYOUT_PIEMENU) {
                ui_litem_layout_root_radial(litem);
-       else
+       }
+       else {
                ui_litem_layout_column(litem, false);
+       }
 }
 
 /* box layout */
@@ -3055,16 +3172,24 @@ static void ui_litem_layout_box(uiLayout *litem)
        litem->x += style->boxspace;
        litem->y -= style->boxspace;
 
-       if (w != 0) litem->w -= 2 * style->boxspace;
-       if (h != 0) litem->h -= 2 * style->boxspace;
+       if (w != 0) {
+               litem->w -= 2 * style->boxspace;
+       }
+       if (h != 0) {
+               litem->h -= 2 * style->boxspace;
+       }
 
        ui_litem_layout_column(litem, true);
 
        litem->x -= style->boxspace;
        litem->y -= style->boxspace;
 
-       if (w != 0) litem->w += 2 * style->boxspace;
-       if (h != 0) litem->h += 2 * style->boxspace;
+       if (w != 0) {
+               litem->w += 2 * style->boxspace;
+       }
+       if (h != 0) {
+               litem->h += 2 * style->boxspace;
+       }
 
        /* roundbox around the sublayout */
        but = box->roundbox;
@@ -3607,10 +3732,12 @@ static void ui_litem_layout_absolute(uiLayout *litem)
        totw -= minx;
        toth -= miny;
 
-       if (litem->w && totw > 0)
+       if (litem->w && totw > 0) {
                scalex = (float)litem->w / (float)totw;
-       if (litem->h && toth > 0)
+       }
+       if (litem->h && toth > 0) {
                scaley = (float)litem->h / (float)toth;
+       }
 
        x = litem->x;
        y = litem->y - scaley * toth;
@@ -3655,8 +3782,9 @@ static void ui_litem_layout_split(uiLayout *litem)
        const int tot = BLI_listbase_count(&litem->items);
        int itemh, x, y, w, colw = 0;
 
-       if (tot == 0)
+       if (tot == 0) {
                return;
+       }
 
        x = litem->x;
        y = litem->y;
@@ -3837,8 +3965,9 @@ uiLayout *uiLayoutRadial(uiLayout *layout)
        uiItem *item;
 
        /* radial layouts are only valid for radial menus */
-       if (layout->root->type != UI_LAYOUT_PIEMENU)
+       if (layout->root->type != UI_LAYOUT_PIEMENU) {
                return ui_item_local_sublayout(layout, layout, 0);
+       }
 
        /* only one radial wheel per root layout is allowed, so check and return that, if it exists */
        for (item = layout->root->layout->items.first; item; item = item->next) {
@@ -4135,8 +4264,9 @@ static void ui_item_estimate(uiItem *item)
        if (item->type != ITEM_BUTTON) {
                uiLayout *litem = (uiLayout *)item;
 
-               for (subitem = litem->items.first; subitem; subitem = subitem->next)
+               for (subitem = litem->items.first; subitem; subitem = subitem->next) {
                        ui_item_estimate(subitem);
+               }
 
                if (BLI_listbase_is_empty(&litem->items)) {
                        litem->w = 0;
@@ -4144,8 +4274,9 @@ static void ui_item_estimate(uiItem *item)
                        return;
                }
 
-               if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
+               if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f) {
                        ui_item_scale(litem, litem->scale);
+               }
 
                switch (litem->item.type) {
                        case ITEM_LAYOUT_COLUMN:
@@ -4247,15 +4378,19 @@ static void ui_item_layout(uiItem *item)
        if (item->type != ITEM_BUTTON) {
                uiLayout *litem = (uiLayout *)item;
 
-               if (BLI_listbase_is_empty(&litem->items))
+               if (BLI_listbase_is_empty(&litem->items)) {
                        return;
+               }
 
-               if (litem->align)
+               if (litem->align) {
                        ui_item_align(litem, ++litem->root->block->alignnr);
-               if (!litem->active)
+               }
+               if (!litem->active) {
                        ui_item_flag(litem, UI_BUT_INACTIVE);
-               if (!litem->enabled)
+               }
+               if (!litem->enabled) {
                        ui_item_flag(litem, UI_BUT_DISABLED);
+               }
 
                switch (litem->item.type) {
                        case ITEM_LAYOUT_COLUMN:
@@ -4309,14 +4444,19 @@ static void ui_item_layout(uiItem *item)
 
 static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
 {
-       if (layout->root->handlefunc)
+       if (layout->root->handlefunc) {
                UI_block_func_handle_set(block, layout->root->handlefunc, layout->root->argv);
+       }
 
        ui_item_estimate(&layout->item);
        ui_item_layout(&layout->item);
 
-       if (x) *x = layout->x;
-       if (y) *y = layout->y;
+       if (x) {
+               *x = layout->x;
+       }
+       if (y) {
+               *y = layout->y;
+       }
 }
 
 static void ui_layout_free(uiLayout *layout)
@@ -4326,10 +4466,12 @@ static void ui_layout_free(uiLayout *layout)
        for (item = layout->items.first; item; item = next) {
                next = item->next;
 
-               if (item->type == ITEM_BUTTON)
+               if (item->type == ITEM_BUTTON) {
                        MEM_freeN(item);
-               else
+               }
+               else {
                        ui_layout_free((uiLayout *)item);
+               }
        }
 
        MEM_freeN(layout);
@@ -4375,8 +4517,9 @@ uiLayout *UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int s
        layout->context = NULL;
        layout->emboss = UI_EMBOSS_UNDEFINED;
 
-       if (type == UI_LAYOUT_MENU || type == UI_LAYOUT_PIEMENU)
+       if (type == UI_LAYOUT_MENU || type == UI_LAYOUT_PIEMENU) {
                layout->space = 0;
+       }
 
        if (dir == UI_LAYOUT_HORIZONTAL) {
                layout->h = size;
@@ -4462,8 +4605,12 @@ void UI_block_layout_resolve(uiBlock *block, int *x, int *y)
 
        BLI_assert(block->active);
 
-       if (x) *x = 0;
-       if (y) *y = 0;
+       if (x) {
+               *x = 0;
+       }
+       if (y) {
+               *y = 0;
+       }
 
        block->curlayout = NULL;
 
index c7c039b..97dd798 100644 (file)
@@ -257,8 +257,9 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
 
        /* if there is a valid property that is editable... */
        if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
-               if (RNA_property_reset(&ptr, prop, (all) ? -1 : index))
+               if (RNA_property_reset(&ptr, prop, (all) ? -1 : index)) {
                        return operator_button_property_finish(C, &ptr, prop);
+               }
        }
 
        return OPERATOR_CANCELLED;
@@ -316,8 +317,9 @@ static int assign_default_button_exec(bContext *C, wmOperator *UNUSED(op))
 
        /* if there is a valid property that is editable... */
        if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
-               if (RNA_property_assign_default(&ptr, prop))
+               if (RNA_property_assign_default(&ptr, prop)) {
                        return operator_button_property_finish(C, &ptr, prop);
+               }
        }
 
        return OPERATOR_CANCELLED;
@@ -1298,8 +1300,9 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch
        BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);
        BLI_join_dirfile(path, maxlen, root, uilng);
        BLI_path_append(path, maxlen, tstr);
-       if (BLI_is_file(path))
+       if (BLI_is_file(path)) {
                return;
+       }
 
        /* Now try without the second iso code part (_ES in es_ES). */
        {
@@ -1316,14 +1319,16 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch
                if (tstr[0]) {
                        /* Because of some codes like sr_SR@latin... */
                        tc = strchr(uilng, '@');
-                       if (tc)
+                       if (tc) {
                                BLI_strncpy(tstr + szt, tc, sizeof(tstr) - szt);
+                       }
 
                        BLI_join_dirfile(path, maxlen, root, tstr);
                        strcat(tstr, ".po");
                        BLI_path_append(path, maxlen, tstr);
-                       if (BLI_is_file(path))
+                       if (BLI_is_file(path)) {
                                return;
+                       }
                }
        }
 
@@ -1397,26 +1402,36 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
                ret = WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
 
                /* Clean up */
-               if (but_label.strinfo)
+               if (but_label.strinfo) {
                        MEM_freeN(but_label.strinfo);
-               if (rna_label.strinfo)
+               }
+               if (rna_label.strinfo) {
                        MEM_freeN(rna_label.strinfo);
-               if (enum_label.strinfo)
+               }
+               if (enum_label.strinfo) {
                        MEM_freeN(enum_label.strinfo);
-               if (but_tip.strinfo)
+               }
+               if (but_tip.strinfo) {
                        MEM_freeN(but_tip.strinfo);
-               if (rna_tip.strinfo)
+               }
+               if (rna_tip.strinfo) {
                        MEM_freeN(rna_tip.strinfo);
-               if (enum_tip.strinfo)
+               }
+               if (enum_tip.strinfo) {
                        MEM_freeN(enum_tip.strinfo);
-               if (rna_struct.strinfo)