From d2c52d4de2ca20dd2ba0254dd6207a70e9bd0597 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 3 Sep 2020 17:39:57 +0200 Subject: Cleanup: Add/use function to disable buttons with a disabled hint We do this in a couple of places, so it's worth having the logic wrapped into a function. Also, the only way to set the disabled hint for a button from outside of `interface/` was through `UI_block_lock_set()`/`UI_block_lock_clear()`, for which the usage isn't obvious when you just try to disable a single button. --- source/blender/editors/interface/interface_layout.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/editors/interface/interface_layout.c') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e1f3e14eda1..7b4bb067eb8 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1139,8 +1139,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name) w = ui_text_icon_width(layout, name, 0, 0); but = uiDefBut(block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - but->flag |= UI_BUT_DISABLED; - but->disabled_info = ""; + UI_but_disable(but, ""); } /** -- cgit v1.2.3