Download

[Feature Request] TAttribute delegate construction shortcuts

TAttributes are very handy to use, and easy to bind if you happen to have a simple member function pointer:


TAttribute<int32>( this, &UFoo::GetThatInt )

Unfortunately, there are no shortcuts for the many other kinds of delegates, including those with payloads. When dealing with those, we have to go through the much more cumbersome syntax of creating a delegate:


TAttribute<int32>::Create( TAttribute<int32>::FGetter::CreateSP( this, &UFoo::GetThatIntWithPayload, Payload ) )


TAttribute<int32>::Create( TAttribute<int32>::FGetter::CreateLambda( [this] { return ThatInt; } ) )

It would be nice to have the same shorthand construction:


TAttribute<int32>( this, &UFoo::GetThatIntWithPayload, Payload )


TAttribute<int32>( [this] { return ThatInt; } )

I understand that in the case of payloads, there is a great amount of permutations that can only be handled by combination of variadic templates and autogenerated macros. But just like Slate’s declarative syntax is able to handle most attributes, it’d be nice to have that functionality extended to plain TAttributes for when Slate syntax is not an option.

-Camille