Fix: Icon alignment for scaled pie buttons with no text
authorraa <roaoao@gmail.com>
Tue, 20 Jun 2017 17:15:04 +0000 (20:15 +0300)
committerraa <roaoao@gmail.com>
Tue, 20 Jun 2017 17:15:04 +0000 (20:15 +0300)
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_layout.c

index 7180e18ab92baf9d9687fe553107700354773b64..64b26406f8453297eacd29ed3765c369423d5979 100644 (file)
@@ -3168,7 +3168,9 @@ static uiBut *ui_def_but(
        }
 
        if (block->flag & UI_BLOCK_RADIAL) {
-               but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT);
+               but->drawflag |= UI_BUT_TEXT_LEFT;
+               if (but->str && but->str[0])
+                       but->drawflag |= UI_BUT_ICON_LEFT;
        }
        else if ((block->flag & UI_BLOCK_LOOP) ||
                 ELEM(but->type,
index 30a2094fee717475f0c21106e9d9932eef570419..da43a58bc746c588f5edf3def85f4d1fc6cb141d 100644 (file)
@@ -2396,8 +2396,10 @@ static void ui_litem_layout_radial(uiLayout *litem)
                                /* add a little bit more here to include number */
                                bitem->but->rect.xmax += 1.5f * UI_UNIT_X;
                                /* enable drawing as pie item if supported by widget */
-                               if (ui_item_is_radial_drawable(bitem))
+                               if (ui_item_is_radial_drawable(bitem)) {
                                        bitem->but->dt = UI_EMBOSS_RADIAL;
+                                       bitem->but->drawflag |= UI_BUT_ICON_LEFT;
+                               }
                        }
 
                        ui_item_size(item, &itemw, &itemh);