UI: Asset Shelf (Experimental Feature) #104831
|
@ -752,7 +752,8 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
|
|||
if (but->func != oldbut->func) {
|
||||
return false;
|
||||
}
|
||||
/* Looks a bit confusing, but simply compares the contained function pointers. */
|
||||
/* Compares the contained function pointers. Buttons with different apply functions can be
|
||||
* considered to do different things, and as such do not equal each other. */
|
||||
if (but->apply_func.target<void(bContext &)>() != oldbut->apply_func.target<void(bContext &)>())
|
||||
{
|
||||
return false;
|
||||
|
@ -6065,7 +6066,7 @@ void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2)
|
|||
|
||||
void UI_but_func_set(uiBut *but, std::function<void(bContext &)> func)
|
||||
{
|
||||
but->apply_func = func;
|
||||
but->apply_func = std::move(func);
|
||||
}
|
||||
|
||||
void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2)
|
||||
|
|
|
@ -193,8 +193,10 @@ struct uiBut {
|
|||
uiButHandleFunc func = nullptr;
|
||||
void *func_arg1 = nullptr;
|
||||
void *func_arg2 = nullptr;
|
||||
/** C++ version of #func above. Allows storing arbitrary data in a type safe way, no void
|
||||
* pointer arguments.*/
|
||||
/**
|
||||
* C++ version of #func above. Allows storing arbitrary data in a type safe way, no void
|
||||
* pointer arguments.
|
||||
*/
|
||||
std::function<void(bContext &)> apply_func;
|
||||
|
||||
uiButHandleNFunc funcN = nullptr;
|
||||
|
|
Loading…
Reference in New Issue