diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-01-11 11:44:25 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-01-11 11:44:25 +0300 |
commit | 77dcf0fbc51afffb0d359dfaae4c30f864565522 (patch) | |
tree | ff662fa8d458fab0ba9413964c3dfded1f978d18 /source/blender/editors | |
parent | 80865bd583c28fcad9cc6ef8dc7185aaccf0ed50 (diff) | |
parent | e041bf757944efee55a4a8bdc599c12bb8829863 (diff) |
Merge remote-tracking branch 'origin/master' into blender2.8
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 52 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sound/sound_ops.c | 2 |
3 files changed, 52 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 940e982d326..b02a909d009 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -125,6 +125,11 @@ typedef struct uiItem { int flag; } uiItem; +enum { + UI_ITEM_FIXED = 1 << 0, + UI_ITEM_MIN = 1 << 1, +}; + typedef struct uiButtonItem { uiItem item; uiBut *but; @@ -232,6 +237,7 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, bool variable = (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X); if (variable) { + layout->item.flag |= UI_ITEM_MIN; const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; /* it may seem odd that the icon only adds (UI_UNIT_X / 4) * but taking margins into account its fine */ @@ -2060,6 +2066,7 @@ static void ui_litem_estimate_row(uiLayout *litem) { uiItem *item; int itemw, itemh; + bool min_size_flag = true; litem->w = 0; litem->h = 0; @@ -2067,12 +2074,26 @@ static void ui_litem_estimate_row(uiLayout *litem) for (item = litem->items.first; item; item = item->next) { ui_item_size(item, &itemw, &itemh); + if (item->type == ITEM_BUTTON) { + const uiBut *but = ((uiButtonItem *)item)->but; + const bool icon_only = (but->flag & UI_HAS_ICON) && (but->str == NULL || but->str[0] == '\0'); + + min_size_flag = min_size_flag && icon_only; + } + else { + min_size_flag = min_size_flag && (item->flag & UI_ITEM_MIN); + } + litem->w += itemw; litem->h = MAX2(itemh, litem->h); if (item->next) litem->w += litem->space; } + + if (min_size_flag) { + litem->item.flag |= UI_ITEM_MIN; + } } static int ui_litem_min_width(int itemw) @@ -2113,7 +2134,7 @@ static void ui_litem_layout_row(uiLayout *litem) newtotw = totw; for (item = litem->items.first; item; item = item->next) { - if (item->flag) + if (item->flag & UI_ITEM_FIXED) continue; ui_item_size(item, &itemw, &itemh); @@ -2126,16 +2147,19 @@ static void ui_litem_layout_row(uiLayout *litem) x += neww; - if ((neww < minw || itemw == minw) && w != 0) { + if ((neww < minw || itemw == minw || item->flag & UI_ITEM_MIN) && w != 0) { /* fixed size */ - item->flag = 1; + item->flag |= UI_ITEM_FIXED; + if (item->type != ITEM_BUTTON && item->flag & UI_ITEM_MIN) { + minw = itemw; + } fixedw += minw; flag = 1; newtotw -= itemw; } else { /* keep free size */ - item->flag = 0; + item->flag &= ~UI_ITEM_FIXED; freew += itemw; } } @@ -2152,8 +2176,11 @@ static void ui_litem_layout_row(uiLayout *litem) ui_item_size(item, &itemw, &itemh); minw = ui_litem_min_width(itemw); - if (item->flag) { + if (item->flag & UI_ITEM_FIXED) { /* fixed minimum size items */ + if (item->type != ITEM_BUTTON && item->flag & UI_ITEM_MIN) { + minw = itemw; + } itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment); fixedx += itemw; } @@ -2193,6 +2220,7 @@ static void ui_litem_estimate_column(uiLayout *litem) { uiItem *item; int itemw, itemh; + bool min_size_flag = true; litem->w = 0; litem->h = 0; @@ -2200,12 +2228,26 @@ static void ui_litem_estimate_column(uiLayout *litem) for (item = litem->items.first; item; item = item->next) { ui_item_size(item, &itemw, &itemh); + if (item->type == ITEM_BUTTON) { + const uiBut *but = ((uiButtonItem *)item)->but; + const bool icon_only = (but->flag & UI_HAS_ICON) && (but->str == NULL || but->str[0] == '\0'); + + min_size_flag = min_size_flag && icon_only; + } + else { + min_size_flag = min_size_flag && (item->flag & UI_ITEM_MIN); + } + litem->w = MAX2(litem->w, itemw); litem->h += itemh; if (item->next) litem->h += litem->space; } + + if (min_size_flag) { + litem->item.flag |= UI_ITEM_MIN; + } } static void ui_litem_layout_column(uiLayout *litem) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index b44ddf925a8..06f495fb9f1 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -98,12 +98,12 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc ModifierData *md = NULL, *new_md = NULL; const ModifierTypeInfo *mti = modifierType_getInfo(type); - /* only geometry objects should be able to get modifiers [#25291] */ - if (!ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { + /* Check compatibility of modifier [T25291, T50373]. */ + if (!BKE_object_support_modifier_type_check(ob, type)) { BKE_reportf(reports, RPT_WARNING, "Modifiers cannot be added to object '%s'", ob->id.name + 2); return NULL; } - + if (mti->flags & eModifierTypeFlag_Single) { if (modifiers_findByType(ob, type)) { BKE_report(reports, RPT_WARNING, "Only one modifier of this type is allowed"); diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 432918f0e37..c2c52f58181 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -383,6 +383,8 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA + 1) * specs.rate / FPS, accuracy, filename, specs, container, codec, bitrate); + BKE_sound_reset_scene_specs(scene); + if (result) { BKE_report(op->reports, RPT_ERROR, result); return OPERATOR_CANCELLED; |