From c2497d16e37f9a932709d96bf0422ce41311ea71 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Wed, 16 Jul 2025 17:07:33 +0200 Subject: [PATCH] Cleanup: Remove redundant parameter in new UI layout function Mistake in 2658754324. This was changed from a free standing to a member function during review. But forgot to update the parameters accordingly. This can be confusing since you can call the function on one layout, but pass it another one that it will actually operate on. --- source/blender/editors/include/UI_interface_layout.hh | 3 +-- source/blender/editors/interface/interface_layout.cc | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/include/UI_interface_layout.hh b/source/blender/editors/include/UI_interface_layout.hh index 1630db9cd4e..273720847e1 100644 --- a/source/blender/editors/include/UI_interface_layout.hh +++ b/source/blender/editors/include/UI_interface_layout.hh @@ -659,8 +659,7 @@ struct uiLayout : uiItem, blender::NonCopyable, blender::NonMovable { const char *menu_type); /** Simple button executing \a func on click. */ - uiBut *button(uiLayout *layout, - blender::StringRef name, + uiBut *button(blender::StringRef name, int icon, std::function func, std::optional tooltip = std::nullopt); diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 836a0c239d7..84995d8d693 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -3091,13 +3091,12 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, StringRef name, int icon) } } -uiBut *uiLayout::button(uiLayout *layout, - const StringRef name, +uiBut *uiLayout::button(const StringRef name, const int icon, std::function func, std::optional tooltip) { - uiBut *but = uiItem_simple(layout, name, icon, tooltip, UI_BTYPE_BUT); + uiBut *but = uiItem_simple(this, name, icon, tooltip, UI_BTYPE_BUT); UI_but_func_set(but, std::move(func)); return but; }